Framework · Vercel
Vercel AI SDK w skrócie
Niezależny od dostawcy zestaw narzędzi TypeScript od Vercel, w którym ToolLoopAgent jest główną klasą agentów od AI SDK 7. Łączy pętle wywołań narzędzi z helperami do strumieniowania UI, a WorkflowAgent dodaje przebiegi, które przetrwają ponowne uruchomienie.
Najlepszy do: Programiści Next.js i aplikacji webowych, którzy chcą agentów z pętlą wywołań narzędzi ściśle zintegrowanych ze strumieniowanym UI.
Najważniejsze informacje
- Opiekun
- Vercel
- Języki
- TypeScript
- Licencja
- Apache-2.0
- Najnowsza wersja
ai 7.0.126· 30 września 2026- Repozytorium
- vercel/ai
- Opcja hostowana
- Vercel Functions + Vercel Workflow
Quickstart
Zainstaluj pakiet, skonfiguruj dane uwierzytelniające, a następnie uruchom najprostszego agenta z oficjalnej dokumentacji. Użyte identyfikatory modeli pochodzą z dokumentacji; dostęp do nich może nie być włączony na Twoim koncie.
npm install ai zod (inferred; not copied from docs)import { ToolLoopAgent, tool } from 'ai';
import { z } from 'zod';
const weatherAgent = new ToolLoopAgent({
model: "anthropic/claude-sonnet-5.5",
tools: {
weather: tool({
description: 'Get the weather in a location (in Fahrenheit)',
inputSchema: z.object({
location: z.string().describe('The location to get the weather for'),
}),
execute: async ({ location }) => ({
location,
temperature: 72 + Math.floor(Math.random() * 21) - 10,
}),
}),
convertFahrenheitToCelsius: tool({
description: 'Convert temperature from Fahrenheit to Celsius',
inputSchema: z.object({
temperature: z.number().describe('Temperature in Fahrenheit'),
}),
execute: async ({ temperature }) => {
const celsius = Math.round((temperature - 32) * (5 / 9));
return { celsius };
},
}),
},
});
const result = await weatherAgent.generate({
prompt: 'What is the weather in San Francisco in celsius?',
});
console.log(result.text); // agent's final answer
console.log(result.steps); // steps taken by the agentFunkcje
| Dowolny model | Tak | Dowolny pakiet dostawcy albo ciągi AI Gateway, takie jak anthropic/claude-sonnet-5.5 |
|---|---|---|
| Klient MCP | Tak | klient @ai-sdk/mcp |
| Serwer MCP | Niepotwierdzone | |
| Wielu agentów | Tak | Podagenci; HarnessAgent uruchamia Claude Code, Codex lub Pi |
| Trwałe uruchomienia | Tak | WorkflowAgent, który wymaga wersji beta Workflow 5 |
| Zatwierdzanie przez człowieka | Tak | toolApproval z zatwierdzeniami podpisanymi HMAC i politykami OPA |
| Śledzenie | Niepotwierdzone | |
| Ewaluacje | Niepotwierdzone |
Najnowsze zmiany
- AI SDK 7 wskazuje ToolLoopAgent jako zalecaną klasę agenta.
- HarnessAgent uruchamia Claude Code, Codex lub Pi jako agenta.
- WorkflowAgent (@ai-sdk/workflow) zastępuje DurableAgent z Workflow DevKit.
- runtimeContext i toolsContext zastępują experimental_context.