Vercel AI SDK
Provider-agnostic TypeScript toolkit for AI apps. It owns the React/Next.js streaming UI layer, and AI SDK 7 expands into durable workflows, approvals, runtime context, files, skills, MCP Apps, telemetry, sandbox support, and harness portability.
What It Is
The AI SDK is the TypeScript layer for AI app development: provider adapters, text/object generation, streaming, embeddings, tool calling, and UI hooks. It is the default choice when the product surface is a React/Next.js app with streaming or generated UI.
Core app primitives:
generateTextstreamTextgenerateObjectstreamObjectembeduseChatuseCompletion- provider packages such as
@ai-sdk/openaiand@ai-sdk/anthropic
Version Snapshot
Checked 2026-07-04 against the npm registry:
| Package | Latest stable | Release note |
|---|---|---|
ai |
7.0.15 (latest) |
Registry modified 2026-07-04 06:10 UTC; dist-tags still expose prior major channels plus canary/beta channels. |
@ai-sdk/react |
4.0.16 (latest) |
Registry modified 2026-07-04 06:10 UTC. Package major does not match the ai package major. |
@ai-sdk/workflow |
1.0.15 (latest) |
Registry modified 2026-07-04 06:10 UTC. |
@ai-sdk/gateway |
4.0.12 (latest) |
Registry modified 2026-07-04 06:10 UTC; voice/realtime calls use this package for AI Gateway routing. |
@ai-sdk/provider-utils |
5.0.5 (latest) |
Registry modified 2026-07-02 20:42 UTC. |
@ai-sdk/harness |
1.0.18 (latest) |
HarnessAgent package checked after Deep Agents/OpenCode source review. |
@ai-sdk/harness-claude-code |
1.0.18 (latest) |
Initial HarnessAgent adapter for Claude Code. |
@ai-sdk/harness-codex |
1.0.19 (latest) |
Initial HarnessAgent adapter for Codex; one patch ahead of the shared harness package. |
@ai-sdk/harness-pi |
1.0.18 (latest) |
Initial HarnessAgent adapter for Pi. |
@ai-sdk/sandbox-vercel |
1.0.18 (latest) |
Sandbox provider used by HarnessAgent examples. |
@ai-sdk/harness-deepagents |
1.0.17 (latest) |
Adapter package for LangChain Deep Agents. |
@ai-sdk/harness-opencode |
1.0.18 (latest) |
Adapter package for OpenCode via @opencode-ai/sdk. |
Do not infer AI SDK compatibility from a social announcement alone. Check the package versions and docs for the exact subpackage being used before coding. Source: npm registry packument, 2026-07-04
Two Abstraction Layers
| Layer | What it swaps | API surface |
|---|---|---|
| Provider/model | GPT, Claude, Gemini, Gateway models | generateText, streamText, AI SDK Agent |
| Workflow | Durable, resumable agent runs | WorkflowAgent, @ai-sdk/workflow |
| Harness | Claude Code, Codex, Pi, other agent runtimes | HarnessAgent |
AI SDK 5 made custom agent loops and typed UI messages a strong default. AI SDK 7 extends the abstraction from model portability into durable workflow execution, app/harness embedding, and richer agent control surfaces. Source: X/@aisdk announcement thread, 2026-06-25; Source: AI SDK v7 WorkflowAgent docs, 2026-06-25
AI SDK 7 Control Surfaces
The 2026-06-25 AI SDK announcement lists these surfaces as available: reasoning control, agent-level tool approval, tool/runtime context, file and skill uploads, MCP Apps, durable workflows, terminal UI, sandbox support, harness integrations, telemetry, lifecycle events, and migration support. Treat the tweet as the release signal and the docs/source as the implementation authority. Source: X/@aisdk announcement thread, 2026-06-25
Routing:
- Use
WorkflowAgentwhen the agent must survive restarts, deploys, interruptions, or delayed approvals. Official docs describe it as a durable, resumable agent that runs inside a workflow and handles tool schema serialization across step boundaries. Source: AI SDK v7 WorkflowAgent docs, 2026-06-25 - Use
HarnessAgentwhen embedding an established harness such as Claude Code, Codex, or Pi into a TypeScript app with AI SDK-compatible streams. - Use
Agent,generateText, orstreamTextwhen the product owns the loop and does not need workflow durability or harness portability. - Use ai-test-kit or built-in
ai/testprimitives when behavior must be deterministic without provider calls.
Voice Agent Lane
Vercel's 2026-06-29 voice-agent launch adds realtime voice support through AI Gateway and AI SDK 7. The named primitives are experimental_useRealtime / useRealtime, generateSpeech, and transcribe, covering realtime transport, speech output, and transcription input. Install with ai @ai-sdk/react @ai-sdk/gateway, mint short-lived realtime tokens server-side with gateway.experimental_realtime.getToken, and keep the AI Gateway key out of the browser. Route voice-agent experiments here when the app is already TypeScript/React/Next and benefits from AI Gateway provider routing, observability, spend controls, and BYOK. Source: X/@vercel, 2026-06-29; Source: Vercel blog, 2026-06-29
The reviewed launch video is a teaser rather than implementation evidence: it shows the pixel voice-agent mascot, "Audio is live on AI Gateway", and tiny install/run hints. Treat the blog and package docs as source authority. Source: local X video artifact review, 2026-07-02
AI Gateway Provider Sorting
AI Gateway provider sorting is an AI SDK routing knob: set providerOptions.gateway.sort to cost, ttft, or tps to rank available providers behind a model by listed input price, median time to first token, or median tokens per second. Providers are tried in sort order, and fallback only advances when a higher-ranked provider is unavailable. Sorting composes with ZDR and order; metadata exposes the sort option, attempted execution order, metric values, and deprioritized providers. Source: Vercel changelog and docs, 2026-07-04
Use this for production routing experiments, not as a blanket "cheapest wins" rule. Provider sorting changes the economic objective, so the route still needs evals, latency/error measurement, data-retention checks, spend caps, and outcome-quality tracking. The package authority for this surface is @ai-sdk/gateway@4.0.12 as of the 2026-07-04 npm check. Source: npm registry, 2026-07-04; Agent Unit Economics
AI Gateway Model Routes
AI Gateway model rows belong here only when the implementation surface is an AI SDK call. Sakana Fugu Ultra is the current model-pool example: Vercel exposes it as model: "sakana/fugu-ultra", while the model page/changelog describe a Sakana AI route that coordinates a pool of frontier models behind one slug. The SDK lesson is the interface boundary, not that every Gateway model deserves custom app code. Source: Vercel changelog, 2026-06-22; Source: Vercel AI Gateway model page, checked 2026-07-04
AI SDK 7 HarnessAgent
Vercel's 2026-06-12 changelog introduced HarnessAgent: a unified API for established agent harnesses including Claude Code, Codex, and Pi. It runs harnesses in sandboxed workspaces, accepts custom tools and skills, and exposes generate() / stream() results compatible with the AI SDK. Vercel notes the packages are experimental and breaking changes should be expected. Source: Vercel changelog, https://vercel.com/changelog/program-agent-harnesses-with-ai-sdk, 2026-06-12
Use HarnessAgent when:
- embedding a mature coding/agent harness in a product
- the UI already consumes AI SDK streams
- sandboxed sessions matter
- skills/tools should travel with the harness
- the goal is harness portability rather than building a loop from scratch
As of the 2026-06-25 Vercel changelog, the supported harness family includes Claude Code, Codex, Deep Agents, OpenCode, and Pi. Deep Agents brings LangChain's runtime, multi-turn sessions, attach/resume, shell/file tools, skills, host tools, and approvals; OpenCode boots a real OpenCode server in the sandbox and streams its events through the harness. Source: Vercel changelog, 2026-06-25
Use lower-level AI SDK primitives when:
- the tool loop is simple
- the product needs custom step control
- the app is mostly chat/generative UI
- you need tight control over message parts and tool states
Where It Fits Kevin's Stack
Loop and Lumachor are natural AI SDK-shaped products. AI-Native Design Patterns uses AI SDK message/tool state patterns. AI SDK HarnessAgent is strategically important because it lets Kevin embed Claude Code/Codex-class harnesses behind a stable TypeScript UI stream rather than writing per-harness glue.
Compared with OpenAI Agents SDK, Vercel AI SDK wins when the application surface is TypeScript UI. OpenAI Agents SDK wins when OpenAI-centered orchestration, guardrails, sessions, and tracing are the product's center of gravity.
The Agentic Infrastructure page is the broader Vercel route: AI SDK handles app-level model/tool/UI primitives, while Vercel's agent stack also includes AI Gateway, Sandbox, Workflows, Eve, deployment APIs, observability, and skills. Do not route every Vercel-agent question here unless the implementation surface is actually AI SDK code. Source: Vercel home page capture, 2026-06-21
Caveats
- AI SDK 7 surfaces are broad and release quickly. Verify current local
node_modules/ai/docs/, source, orai-sdk.devbefore coding. - Harness portability does not erase permissions, sandbox, auth, or state design.
- Existing AI SDK UI code can consume harness streams, but product semantics still need explicit UI states, approvals, and provenance.
Timeline
- 2026-07-12 | Added Chat SDK + Vercel Connect, Native SDK, and a GitHub-agent demo as application-surface evidence. Verify the live Vercel docs and package releases before treating those launch posts as API contracts. Source: X Bookmark Ingest 2026-07-12; X/@vercel_dev and @ctatedev, 2026-07-09–10
- 2026-07-04 | Source-reviewed the Deep Agents/OpenCode HarnessAgent bookmark and expanded the npm snapshot with harness packages:
@ai-sdk/harness@1.0.18,@ai-sdk/harness-deepagents@1.0.17, and@ai-sdk/harness-opencode@1.0.18. Source: X/@vercel_dev, 2026-06-26; Source: npm registry, 2026-07-04 - 2026-07-04 | Source-reviewed the original HarnessAgent Vercel Developers bookmark and added the initial adapter package snapshot:
@ai-sdk/harness-claude-code@1.0.18,@ai-sdk/harness-codex@1.0.19,@ai-sdk/harness-pi@1.0.18, and@ai-sdk/sandbox-vercel@1.0.18. Source: X/@vercel_dev, 2026-06-12; Source: npm registry, 2026-07-04 - 2026-07-04 | Source-reviewed the AI Gateway provider-sorting bookmark. Added
providerOptions.gateway.sortforcost,ttft, andtps, plus the routing-economics caveat and current@ai-sdk/gateway@4.0.12package authority. Source: X/@vercel_dev, 2026-05-18; Source: Vercel changelog/docs and npm registry, 2026-07-04 - 2026-07-04 | Source-reviewed the Vercel Developers Fugu Ultra row and linked Sakana Fugu Ultra as the Gateway model-pool route exposed through
model: "sakana/fugu-ultra". Source: X/@vercel_dev, 2026-06-22; Source: Vercel changelog/model page, checked 2026-07-04 - 2026-07-04 | Refreshed npm snapshot after source-reviewing the Vercel voice-agent bookmark:
ai7.0.15,@ai-sdk/react4.0.16,@ai-sdk/workflow1.0.15,@ai-sdk/gateway4.0.12, and@ai-sdk/provider-utils5.0.5. Source: npm registry packument, 2026-07-04 - 2026-07-02 | Deep-reviewed the Vercel voice-agent bookmark and video artifact. Added the AI Gateway package snapshot (
@ai-sdk/gateway@4.0.8,@ai-sdk/provider-utils@5.0.3) and clarified the server-minted token pattern for realtime browser sessions. Source: X/@vercel, 2026-06-29; Vercel blog; npm registry, 2026-07-02 - 2026-07-01 | Refreshed npm snapshot:
ai7.0.11,@ai-sdk/react4.0.12, and@ai-sdk/workflow1.0.11. Source: npm registry packument, 2026-07-01 - 2026-06-30 | Linked Agentic Infrastructure after the 2026-06-21 Vercel homepage/performance bookmark showed AI SDK as one layer in a broader agent stack rather than the whole stack. Source: X/@rauchg, 2026-06-21
- 2026-06-29 | Added the voice-agent lane: AI Gateway realtime, speech, and transcription surfaced through AI SDK 7 primitives
useRealtime,generateSpeech, andtranscribe. Source: Vercel blog, 2026-06-29 - 2026-06-30 | Refreshed npm snapshot:
ai7.0.8,@ai-sdk/react4.0.9, and@ai-sdk/workflow1.0.8. Source: npm registry vianpm view, 2026-06-30 - 2026-06-29 | Recorded npm version snapshot for
ai7.0.5,@ai-sdk/react4.0.6, and@ai-sdk/workflow1.0.5. Source: npm registry vianpm view, 2026-06-29 - 2026-06-18 | Refreshed from Vercel HarnessAgent docs/changelog and clarified AI SDK's provider-vs-harness abstraction split and Kevin routing. Source: Vercel changelog, https://vercel.com/changelog/program-agent-harnesses-with-ai-sdk, 2026-06-12; AI SDK harness docs, https://ai-sdk.dev/v7/docs/ai-sdk-harnesses/overview, 2026-06-18
- 2026-06-26 | Added Deep Agents and OpenCode HarnessAgent adapters and updated the supported harness family. Source: Vercel changelog, 2026-06-25
- 2026-06-25 | Added AI SDK 7 release surfaces,
WorkflowAgentdurable routing, and ai-test-kit testing route. Source: X/@aisdk announcement thread, 2026-06-25; AI SDK v7 docs; GitHubzirkelc/ai-test-kit - 2026-06-12 | AI SDK 7 canary introduced
HarnessAgent: unified harness abstraction for Claude Code, Codex, Pi, sandboxed sessions, and AI SDK-compatible streams. Source: Vercel changelog, 2026-06-12 - 2025-07-31 | AI SDK 5 released: typed chat, agentic loop control, tool schemas, speech, V2 specs, Zod 4. Source: Vercel blog, https://vercel.com/blog/ai-sdk-5, 2025-07-31
- 2026-05-31 | Tool page created from
vercel/ai. Source: https://github.com/vercel/ai, 2026-05-31