AI SDK 7

AI SDK, with over 16 million weekly downloads, is the TypeScript SDK for building AI applications, features, frameworks, and agents across any model provider. It's the same layer eve, Vercel's open-source agent framework, is built on.
AI SDK 7 adds production depth for agent work across five areas:
Develop agents with reasoning control, tool and runtime context, provider files and skills support, MCP Apps, and a terminal UI.
Run agents with tool approvals, durability (WorkflowAgent), timeouts, and sandbox support.
Integrate any agent harness, such as Codex, Claude Code, Deep Agents, OpenCode, or Pi.
Observe agents with telemetry, Node.js tracing channel, lifecycle events, and performance statistics.
Go beyond text agents with provider-agnostic real-time voice support and video generation.
pnpm add ai@latestInstall AI SDK 7
Upgrading from AI SDK 6? Run npx @ai-sdk/codemod v7 to migrate automatically with minimal code changes, or use the migration skill: npx skills add vercel/ai --skill migrate-ai-sdk-v6-to-v7
Develop agents
Building well-behaved agents requires fine-grained control over model reasoning, tool context, and file handling.
Reasoning control
Most frontier models support configurable reasoning, but every provider API exposes it differently.
AI SDK 7 standardizes this with a reasoning option for generateText and streamText. It maps to provider-native reasoning settings, letting you control reasoning effort in a single line. You can also still fall back to provider options when you need more detailed provider-specific reasoning configuration.
1import { generateText } from 'ai';2const result = await generateText({3 model,4 prompt,5 reasoning: 'high',6});Setting reasoning effort with a single option
Learn more in the reasoning documentation.
Tool context
Tools are increasingly developed independently of specific agents or applications. For example, third-party companies offer tools that enable agents to use their APIs. Therefore, tools require additional inputs that are not generated by LLMs, such as API keys or configuration settings.
AI SDK 7 adds a fully typed tool context that can be specified for each tool via a schema. The context is limited to the tool to prevent 3rd-party tools from accessing context they do not need.
1const agent = new ToolLoopAgent({2 model,3 tools: {4 weather: tool({5 description,6 inputSchema,7 contextSchema: z.object({8 apiKey: z.string(),9 }),10 execute: async (input, { context: { apiKey } }) => {11 // ...12 },13 }),14 },15 toolsContext: {16 weather: { apiKey: process.env.WEATHER_API_KEY! },17 },18});Scoping an API key to the tool that needs it
Learn more about Tool Context