AI SDK | Vercel Knowledge Base
AI SDK
The unified TypeScript SDK for building AI apps with modern streaming, fallbacks, and multi-model support.
Build with AI SDK 7
- How to classify, route, and score with Jev and AI SDK: Use Jev from TypeSafe AI with AI SDK's experimental
evaluateAPI to classify, route, score, and verify inside your application. Jev returns typed choices, scores, and boolean probabilities through AI Gateway. - Route form submissions with Jev and AI SDK: Route form submissions to the right team with the Jev x AI SDK Form Router template. Jev routes clear cases and a fallback model decides uncertain ones.
- How to migrate from DurableAgent to WorkflowAgent: Switch your app from
DurableAgent(@workflow/ai) toWorkflowAgent(@ai-sdk/workflow) by updating imports, stream output, message conversion, stop conditions, tool approval, and context. - Run Python code securely with AI SDK and Vercel Sandbox: Add an
executeCodetool to your AI SDK agent with theai-sdk-tool-code-executionpackage to run Python 3.13 inside an isolated Vercel Sandbox. - Run your AI SDK agent in the terminal: Use the @ai-sdk/tui package and runAgentTUI to run a ToolLoopAgent in an interactive terminal, with tool cards, reasoning, response statistics, and tool approval prompts.
- Add skills to your AI SDK agents: Use uploadSkill and provider references in the AI SDK to bundle a SKILL.md and supporting files, then attach the skill to generateText, streamText, or a ToolLoopAgent call on Anthropic or OpenAI.
- Upload provider files with AI SDK: Use uploadFile in the AI SDK to upload an image, PDF, or document to a provider, get a ProviderReference, and reference it in generateText and streamText messages, including across multiple providers.
- Add MCP Apps to your AI SDK application: Build an MCP Apps host with the AI SDK using @ai-sdk/mcp and @ai-sdk/react to filter model-visible tools, read ui:// resources, and render interactive tool UIs in a sandboxed iframe with experimental_MCPAppRenderer.
- Investigate GitHub issues with
HarnessAgentand Vercel Sandbox: Use HarnessAgent to run coding agent harnesses like Claude Code or Codex against untrusted code inside Vercel Sandbox. Reproduce GitHub issues with the agent harness and generate a report for the maintainer. - Pass state to AI SDK tools and agents with context: Use runtimeContext, toolsContext, and contextSchema in the AI SDK to pass tenant data, credentials, and other server-side state through a generation or agent loop without putting it in the prompt.
- Generate videos with AI SDK: Use experimental_generateVideo in the AI SDK to generate videos from a text prompt or an image, set aspect ratio, resolution, duration, FPS, and seed, and handle long-running generation with timeouts and polling.
Getting Started with AI SDK
- Build AI agents with AI Gateway and AI SDK: Build AI agents on Vercel with AI Gateway and AI SDK, then make them reliable, capable, and durable with Sandbox, Chat SDK, Vercel Connect, and Workflow.
- Build your own Slackbot with Vercel Connect: Learn how to build your very own Slackbot with Chat SDK and AI SDK. Vercel Connect supplies runtime Slack tokens and forwards triggers, so you never store a long-lived bot token.
- How to build a Slack bot that manages files in Vercel Blob: Build a Slack bot using Chat SDK, AI SDK, and Files SDK that can list, read, upload, and delete files in Vercel Blob through tool calls. Vercel Connect supplies runtime Slack tokens and forwards triggers.
- How to build an agent for Liveblocks with Chat SDK and AI SDK: Build an AI agent that replies to @-mentions in Liveblocks comment threads with streamed responses and tool calling, using Chat SDK, AI SDK, and Redis.
- How to build an AI agent for Slack with Chat SDK and AI SDK: Build a Slack AI agent using Chat SDK, AI SDK's ToolLoopAgent, and Vercel AI Gateway. Covers project setup, tool definitions, streaming responses, deployment to Vercel, and scaling tool selection with toolpick.
- Build a web research agent with Workflow SDK: Build a web research agent that searches the web and returns a cited report. Powered by AI SDK and Workflow SDK, it journals every step so progress survives any crash or retries.
Deploy an Agent with Vercel Connect
- Build your own Slackbot with Vercel Connect: Learn how to build your very own Slackbot with Chat SDK and AI SDK. Vercel Connect supplies runtime Slack tokens and forwards triggers, so you never store a long-lived bot token.
- Build a GitHub agent with Vercel Connect: Build a GitHub agent that helps your team work through issues and PRs. Chat SDK handles the interactivity and AI SDK runs the tool-calling loop.
- Build a Linear agent with Vercel Connect: Build a native Linear Agent that helps your team manage issues. Mention it on any issue and it responds in real time, powered by Chat SDK and AI SDK.
Build an agent with eve
- Build a software factory with eve: Foreman, a software factory built on eve. It turns GitHub and Linear work items into reviewed draft pull requests through four agent stations, triaging issues and fixing its own red CI along the way.
- Build an incident response sre agent with eve: sre is an incident response agent for Slack. It investigates production issues using a hypothesis-driven approach and returns verifiable evidence from connected sources.
- How to automatically approve tool calls in eve with Jev: Use Jev to review tool calls in eve, allow routine actions, and request human approval when needed. Configure the policy and test its failure paths.
- Run a marketing team from Slack with eve: Team of five marketing agents built on eve. The lead routes work to specialists that write long-form into Notion, queue social posts in Typefully, run email in Resend, and audit for SEO, with approvals for anything irreversible.
- How to build a browser agent that works behind a login: Build a browser agent with eve, Vercel Connect, and KERNEL managed auth that signs a user in through a human-in-the-loop handoff and completes tasks behind a login without exposing credentials.
- Give your eve agent an email inbox with Resend: Connect an eve agent to email using the Chat SDK channel and the Resend adapter. Handle inbound email, threaded replies, attachments, and proactive sends.
- Manage your Sanity project from Slack with eve: A Slack-based Sanity copilot built on eve. It queries and edits content with GROQ, shapes schemas, manages releases, and drafts long-form pieces into Notion.
All AI SDK Guides
- Vercel Workflows
- AI Gateway
- Vercel Sandbox
- Vercel Connect
- AI SDK
- Chat SDK
- Vercel Blob
- Next.js