Vercel's AI SDK 7 Turns Fragile Prototype Agents Into Production-Ready Systems

Vercel's AI SDK 7 lands with durable agents, unified reasoning control, tool approvals, MCP Apps, and a new harness abstraction for Claude Code and Codex

·
·
·
Read6 min
TypeNews
  • AI SDK 7 is now in beta — the biggest release yet, focused on production-grade agent infrastructure.
  • WorkflowAgent brings durable, resumable agents that survive crashes, restarts, and delayed human approvals without custom queue infrastructure.
  • Tool approvals let you gate sensitive operations automatically or with a human in the loop, based on tool input values.
  • Unified reasoning control adds a single reasoning parameter across OpenAI, Anthropic, Google, xAI, Groq, DeepSeek, and more.
  • HarnessAgent provides a single API to run Claude Code, Codex, and Pi — swap harnesses the same way you swap models.
  • MCP Apps extend MCP tools with sandboxed interactive UI, and migration codemods handle the v6-to-v7 upgrade automatically. Read the announcement.

AI SDK 7 is now available in beta, and it's the most agent-focused release the toolkit has shipped. Where earlier versions laid the groundwork for multi-step tool calling and streaming, version 7 tackles the hard problems that show up when you try to run agents in production: state that survives crashes, tools that need human sign-off, secrets that should never reach the model, and harnesses like Claude Code or Codex that you want to swap without rewriting your agent logic.

The durability problem, finally solved

The biggest addition is WorkflowAgent, a native integration between the AI SDK and Vercel's Workflow SDK. The core issue it addresses is simple but painful: a standard ToolLoopAgent runs entirely in memory, so if the process crashes, all progress is lost. For production agents that make multiple tool calls, this creates problems around statefulness, resumability, human-in-the-loop approvals, and observability.

WorkflowAgent solves these by running inside a Vercel Workflow, where each tool execution is a durable step with automatic retries. The practical upshot: durable streams persist agent output, and getWritable() gives you a persistent stream that multiple clients can connect to, disconnect from, and reconnect to later. The workflow keeps running even if the user closes the browser, and when they come back, the client resumes exactly where the stream left off , no Redis or custom pub/sub required.

Because the workflow is durable, approval requests survive process restarts , the user can approve hours later and the agent will resume. This is the kind of guarantee that previously required wiring up your own queue infrastructure.

AI SDK telemetry trace showing a weather comparison agent execution with timing, token usage, and cost breakdown

Tool approvals and context isolation

Agent safety gets a serious upgrade in v7. By default, tools with an execute function run automatically as the model calls them. You can now require approval before execution by setting needsApproval , useful for tools that perform sensitive operations like executing commands, processing payments, or modifying data.

Approvals can be fully automatic or involve a human. You can make approval decisions based on tool input by providing an async function , for example, only transactions over $1,000 require approval while smaller transactions execute automatically.

Alongside approvals, v7 introduces typed context isolation. Context lets you pass server-side state through a generation or agent loop without putting that state into the prompt. The AI SDK separates shared runtime state from per-tool execution state so agents can track their work while tools only receive the values they need. Use this for values such as tenant information, feature flags, session data, request IDs, API credentials, or access tokens , anything that should influence execution but must never appear in the model's context window.

One parameter to rule all reasoning models

Every major provider now exposes a "reasoning" or "thinking" mode, but each one has a different API. SDK 7 normalizes this. The AI SDK provides a top-level reasoning parameter on generateText and streamText that controls this behavior across providers with a single, portable setting. The reasoning parameter is supported by OpenAI, Anthropic, Google, xAI, Groq, DeepSeek, Fireworks, and Amazon Bedrock.

Some providers support all six reasoning levels natively, while others coerce to fewer levels (a warning is emitted when coercion occurs). Some providers use a numeric token budget instead of an enum, in which case the top-level value is mapped to a budget calculated as a percentage of the model's maximum output tokens. If you need exact token control, you can still drop down to providerOptions.

MCP Apps: interactive UI inside your agent

Model Context Protocol (MCP) support gets a significant expansion with MCP Apps. MCP Apps extend MCP tools with interactive UI resources. The model still calls ordinary MCP tools, but tools can point to a ui:// resource containing HTML that your app renders in a sandboxed iframe. This means an MCP server can now ship its own UI that lives inside your chat interface, not just return text.

The SDK provides two pieces to make this work: @ai-sdk/mcp helpers for advertising MCP Apps support, filtering model-visible and app-visible tools, and reading ui:// resources; and @ai-sdk/react components for rendering the app iframe and bridging MCP Apps JSON-RPC messages. Critically, app-only tools are never passed to the model , you use splitMCPAppTools and expose only modelVisible tools.

A unified harness abstraction

One of the more forward-looking additions is HarnessAgent. AI SDK 7 introduces HarnessAgent, a single API for running established agent harnesses, including Claude Code, Codex, and Pi. The idea mirrors what the SDK already does for model providers: AI SDK has always let you switch models without rewriting your agent , now you can switch the harness the same way. Write the agent once, use the best harness available.

Harnesses manage the components above a model call, including skills, sandboxes, sessions, permission flows, compaction, runtime configuration, and sub-agents. The AI SDK normalizes access to those capabilities through a unified harness abstraction. Every harness runs the agent in a sandboxed workspace, keeping the host environment safe.

Everything else in the box

The release also ships a long list of quality-of-life improvements that add up:

  • Terminal UI: Run agents in a terminal interface with just a few lines of code via @ai-sdk/tui.
  • File and skill uploads: Upload files once and reuse provider file references across multi-step model calls. Upload skills once and attach them to provider-managed agent runs.
  • Sandbox support: Run host-executed tools inside a restricted sandbox session, keeping dangerous operations isolated.
  • Telemetry: Register an OpenTelemetry provider once and get traces across all AI SDK operations, with full visibility into token usage, costs, and timing per step.
  • Lifecycle events: New callbacks for complete visibility into requests and model performance across the multiple steps in a model lifecycle.
AI SDK agent execution trace showing hierarchical call stack with timing, token counts, and costs

Migrating from v6

The AI SDK is a free open-source library from the creators of Next.js for building AI-powered applications and agents. The team expects very little friction to upgrade. The main reason for a breaking version bump is the strict provider specification , each change to @ai-sdk/provider is technically a breaking change, required to adapt to the fast-moving AI ecosystem.

The SDK provides automated code transformations (codemods) to help upgrade your codebase when features are deprecated, removed, or changed between versions. Codemods are transformations that run on your codebase programmatically, allowing you to apply many changes without manually editing every file. You can also use the new migration skill to guide a coding agent through the upgrade automatically. The v7 beta docs are live at ai-sdk.dev/v7, and the full source is on GitHub.

The broader picture here is that the AI SDK is evolving from a model-calling library into a full agent runtime. With WorkflowAgent, typed context, harness abstractions, and MCP Apps all landing in one release, the gap between "prototype agent" and "production agent" just got a lot narrower.

Trending
  • No trending articles

Comments

avatar

Next Reads