Framework · Vercel
Vercel AI SDK at a glance
Vercel's provider-agnostic TypeScript toolkit, where ToolLoopAgent is the main agent class as of AI SDK 7. It ties tool loops to streaming UI helpers, and WorkflowAgent adds runs that survive restarts.
Best for: Next.js and web developers who want tool-loop agents tied closely to streaming UI.
Key facts
- Maintainer
- Vercel
- Languages
- TypeScript
- Licence
- Apache-2.0
- Latest version
ai 7.0.126· September 30, 2026- Repository
- vercel/ai
- Hosted option
- Vercel Functions + Vercel Workflow
Quickstart
Install the package, set the credentials, then run the smallest agent from the official docs. Model IDs are the ones the docs use and may not be enabled on your account.
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 agentFeatures
| Any model | Yes | Any provider package, or AI Gateway strings such as anthropic/claude-sonnet-5.5 |
|---|---|---|
| MCP client | Yes | @ai-sdk/mcp client |
| MCP server | Not confirmed | |
| Multi-agent | Yes | Subagents; HarnessAgent runs Claude Code, Codex or Pi |
| Durable runs | Yes | WorkflowAgent, which needs the Workflow 5 beta |
| Human approval | Yes | toolApproval with HMAC-signed approvals and OPA policies |
| Tracing | Not confirmed | |
| Evals | Not confirmed |
Recent changes
- AI SDK 7 makes ToolLoopAgent the recommended agent class.
- HarnessAgent runs Claude Code, Codex or Pi as the agent.
- WorkflowAgent (@ai-sdk/workflow) replaces the Workflow DevKit's DurableAgent.
- runtimeContext and toolsContext replace experimental_context.