The Vercel AI SDK and TanStack AI are both open-source TypeScript toolkits for building AI-powered applications and agents. Both provide a unified interface across LLM providers, streaming, tool calling, structured outputs, and multi-modal generation. They differ in maturity, architecture, how much they own for you, and where they draw the line between library and platform.
AI SDK treats AI development as a full-stack production problem. AI SDK 7 includes agent-level tool approvals, durable WorkflowAgent execution, a HarnessAgent interface for running coding agents like Claude Code and Codex, and a telemetry system you register once for every call.
TanStack AI treats AI development as a library composition problem. It reached release candidate in August 2026 with an AG-UI wire protocol, app-level middleware, first-class persistence, and tree-shakable adapters for 24 providers.
Both SDKs are free, open source, and work with any hosting provider. Neither requires a specific platform. This guide breaks down where each SDK fits so you can decide which one matches what you're building.
Copy link to headingWhere each SDK stands in September 2026
AI SDK is on a stable major release. TanStack AI is a release candidate.
| AI SDK | TanStack AI | |
|---|---|---|
| Current release | 7.x, stable (June 25, 2026) | v0 RC (August 21, 2026) |
| License | Apache 2.0 | MIT |
| Runtime requirements | Node.js 22+, ESM imports only | Node.js and edge runtimes; per-package requirements vary |
| Languages | TypeScript; AI SDK for Python in public beta | TypeScript |
| Maintainers | Vercel core team plus 190+ community contributors | Volunteer maintainers plus community contributors |
| Adoption signal | 16 million+ weekly downloads at the AI SDK 7 launch | Won AI Project of the Year at the 2026 Open Source Awards |
AI SDK 7 is a major version with two breaking requirements, Node.js 22 and ESM-only imports. Upgrading from AI SDK 6 uses npx @ai-sdk/codemod v7 or the migrate-ai-sdk-v6-to-v7 agent skill. TanStack AI's release candidate locks in its architecture, and the team plans agent workflows and orchestration for after v1.
Copy link to headingHow AI SDK and TanStack AI compare
Both SDKs share a large set of capabilities. The differences are in how each toolkit exposes them and what it optimizes for.
| Feature | AI SDK | TanStack AI |
|---|---|---|
| Provider coverage | ~38 first-party provider packages, plus 100+ models through AI Gateway | 24 providers, plus OpenRouter (300+ models), a Vercel AI Gateway adapter, and an OpenAI-compatible adapter |
| Streaming | Built in, UI Message Stream protocol over SSE | Built in, AG-UI events end to end over SSE, WebSockets, or HTTP streams |
| Tool calling | tool() objects with automatic execution loops | toolDefinition() with isomorphic .server() and .client() implementations |
| Loop control | stopWhen conditions such as isStepCount(n) and hasToolCall(name) | Composable (state) => boolean strategies with combineStrategies() |
| Tool approval | Agent-level toolApproval with automatic, function-based, and human-in-the-loop modes; optional HMAC-signed approvals | Per-tool needsApproval with batched approvals and schema-driven interrupts |
| Type safety | Zod, Valibot, or JSON Schema; per-provider option types | Zod and Standard Schema; per-model type narrowing |
| Structured outputs | output: Output.object(), Output.array(), Output.choice(), and Output.json() on generateText and streamText | outputSchema on chat(), with typed StructuredOutputPart preserved in message history |
| MCP client | @ai-sdk/mcp (stable) with toolSearch() support for deferred MCP tools | @tanstack/ai-mcp host-side client with connection pools and generated types; provider-routed mcpTool() |
| MCP Apps | experimental_MCPAppRenderer (React) with model-visible and app-only tool separation | React and Preact renderers with multi-server routing |
| Multi-modal | Image generation and editing, speech, transcription, translation, embeddings, reranking, realtime (experimental), video (experimental) | Image, video, speech, transcription, audio and music, summarization, realtime, embeddings, reranking |
| UI hooks | useChat, useCompletion, useObject | useChat plus one hook per activity, including useGenerateImage and useRealtimeChat |
| DevTools | Server-side devToolsMiddleware with a local inspector | In-app TanStack DevTools panel across all frameworks |
| Telemetry | registerTelemetry() with @ai-sdk/otel, Node.js tracing channel, lifecycle callbacks | otelMiddleware and category-toggleable debug logging |
Copy link to headingFramework support
Both SDKs ship official packages for React, Svelte, Vue, and Angular. TanStack AI adds official Solid and Preact packages, while AI SDK's Solid support is a community package. Both document React Native and TanStack Start setups.
| Framework | AI SDK | TanStack AI |
|---|---|---|
| React / Next.js | @ai-sdk/react | @tanstack/ai-react |
| Svelte / SvelteKit | @ai-sdk/svelte | @tanstack/ai-svelte |
| Vue / Nuxt | @ai-sdk/vue | @tanstack/ai-vue |
| Angular | @ai-sdk/angular | @tanstack/ai-angular |
| Solid / SolidStart | Community package | @tanstack/ai-solid |
| Preact | -- | @tanstack/ai-preact |
| React Native / Expo | Expo getting-started guide | useChat with XHR streaming transports |
| TanStack Start | Getting-started guide | Recommended framework |
| Vanilla JS | Core functions work directly | @tanstack/ai-client |
Copy link to headingTool calling and approval
Both SDKs run automatic tool execution loops and support human-in-the-loop approval. AI SDK declares approvals at the agent or call level rather than on individual tools. You set toolApproval on ToolLoopAgent, generateText, or streamText, choosing between a plain user-approval flag, a per-tool function that can auto-approve or auto-deny, or a catch-all approval function.
TanStack AI keeps approval on the tool definition with needsApproval, batches pending approvals per iteration, and extends the same mechanism into generic interrupts. Interrupts let you modify tool-call arguments or trigger multiple pauses in one run while staying type-safe end to end.
Copy link to headingWhere AI SDK goes deeper
The sections below cover AI SDK capabilities that go beyond the shared feature set.
Copy link to headingAgent abstractions
AI SDK ships several agent classes that implement one Agent interface, so every agent works with useChat, the terminal UI, and the same streaming primitives.
| Agent | What you get |
|---|---|
ToolLoopAgent | Complete tool execution loop with typed runtimeContext, per-tool toolsContext, prepareStep, and approvals |
WorkflowAgent | Durable, resumable execution on Vercel Workflows that survives restarts, deploys, and delayed approvals |
HarnessAgent | One API for running coding-agent harnesses in a sandbox |
Custom Agent | Build your own abstraction while keeping UI and telemetry compatibility |
AI SDK also provides typed context that stays out of the prompt.
toolsContext scopes data to the tools that need them, and runtimeContext carries shared agent state through prepareStep, approvals, and telemetry.
TanStack AI composes these pieces per chat() call rather than offering agent classes. Its agent workflows and orchestration features are planned for after v1.
Copy link to headingHarnesses and sandboxes
HarnessAgent lets you run a fully configured coding agent through the AI SDK interface. Harnesses own their workspace, built-in tools, session state, and permission model, and every AI SDK harness runs in a sandbox to keep the host safe. You provide instructions, skills, custom tools, and a sandbox, then swap harnesses without changing your integration layer.
AI SDK includes 10 harness adapters:
- Claude Code, Codex, Deep Agents, and OpenCode (sandbox bridge)
- Cursor, fx, GitHub Copilot, and Grok Build (sandbox via Agent Client Protocol)
- Cline and Pi (host process)
Harness sessions can be parked and resumed, and individual turns can be interrupted mid-flight. The SandboxSession abstraction makes tool command execution portable across sandbox providers. Harness packages are experimental, so expect API changes between releases.
Copy link to headingObservability
AI SDK centralizes telemetry around a single registration. You call registerTelemetry() once at startup, and every AI SDK function reports traces without per-call wiring. Traces cover the root generation, each model call and step, tool executions, embeddings, reranking, usage, and selected runtime context.
- OpenTelemetry integration through
@ai-sdk/otel, using current GenAI semantic conventions - Node.js tracing channel events on
ai:telemetryfor supported providers - Lifecycle callbacks such as
onStartandonEndthat fire consistently across model calls, agents, and tools - Per-step performance statistics, including time to first output
Observability integrations include Datadog, Langfuse, Braintrust, Raindrop, Sentry, Laminar, and LangSmith.
TanStack AI ships an otelMiddleware and debug logging, but doesn't have an equivalent to the tracing channel or performance statistics.
Copy link to headingProduction controls
Several AI SDK 7 features target failure modes that show up only in production.
| Capability | What it does |
|---|---|
| Timeouts | totalMs, stepMs, chunkMs, and per-tool limits with TimeoutError propagation |
| Reasoning control | One reasoning option that maps to provider-native reasoning settings |
| Provider file uploads | uploadFile() uploads once and passes a portable reference into later calls |
| Provider skill uploads | uploadSkill() attaches skills to provider-managed agent runs |
| Tool search | toolSearch() with deferLoading: true keeps large tool sets out of the initial context, across any provider |
Copy link to headingProvider breadth and optional platform integration
AI SDK ships around 38 first-party provider packages, each individually typed and maintained. AI Gateway adds 300+ models behind one endpoint with failover, caching, and no markup on provider token costs. When you don't configure a provider, AI SDK routes through AI Gateway by default.
When you deploy your agent on Vercel, AI SDK can take advantage of additional platform capabilities:
| Component | What it provides |
|---|---|
| AI Gateway | Single endpoint for 100+ models with failovers, caching, budgets, and zero-markup pricing |
| Fluid compute | Active CPU pricing so you pay for execution, not for waiting on model responses |
| Vercel Sandbox | Isolated execution for HarnessAgent and agent-generated code |
| Workflows | Durable execution backing WorkflowAgent |
| Observability | Request tracing, token usage, and cost monitoring in the Vercel dashboard |
These are optional. Teams running AI SDK on Express, Hono, Fastify, AWS Lambda, or Cloudflare Workers can use any provider directly and integrate their own observability tools.
AI SDK is also the layer that eve, Vercel's open-source agent framework, is built on.
Copy link to headingAI SDK for Python
The AI SDK for Python is in public beta. It requires Python 3.12 or later, routes through AI Gateway by default, and includes an ai.Agent class with a customizable loop. Teams running TypeScript frontends with Python inference services can share provider configuration and model IDs across both.
Copy link to headingWhere TanStack AI goes deeper
The sections below cover TanStack AI capabilities that go beyond the shared feature set.
Copy link to headingPer-model type safety
TanStack AI narrows TypeScript types to the exact model you select. Each adapter carries a model metadata map covering supported input modalities, context windows, and provider options. When you write openaiText('gpt-5.5'), the type system knows which options that model accepts and rejects an image content part on a text-only model at compile time.
AI SDK provides type safety across providers through a unified interface and per-provider option types. It doesn't narrow options per model.
Copy link to headingTree-shakeable adapters
Every TanStack AI activity is a separate import, and every provider exposes a separate adapter function per activity. If your app only uses chat, no image, speech, or video code enters your bundle.
openaiTextfor chatopenaiImagefor image generationopenaiSpeechfor text-to-speechopenaiTranscriptionfor speech-to-text
AI SDK provider packages such as @ai-sdk/openai are modular at the provider level, but each package covers all of that provider's model types. The core ai package includes all primitives regardless of which ones you use.
Copy link to headingIsomorphic tools
TanStack AI's most distinctive design choice is its isomorphic tool system. toolDefinition() creates a shared contract with a name, description, input schema, and output schema. You then attach .server() for database or API access, .client() for browser execution, or both.
The same schema validates inputs and outputs on both sides, and the type system tracks whether a tool is a ServerTool or ClientTool. AI SDK supports client-side tools through onToolCall in useChat, but server and client implementations are declared independently rather than derived from one definition.
Copy link to headingApp-level middleware
TanStack AI's middleware hooks into every stage of the chat() lifecycle.
Each middleware is a named object whose hooks run in order, and you pass an array of them into chat().
| Hook | Purpose |
|---|---|
onConfig | Transform messages, tools, and system prompts per iteration |
onChunk | Transform, expand, or drop individual stream chunks |
onBeforeToolCall | Intercept tool calls to change arguments, skip execution, or abort the run |
onAfterToolCall | Observe tool results, timing, and errors |
onUsage | Track token usage per iteration |
onFinish, onAbort, onError | Terminal hooks, exactly one fires per run |
Persistence, sandboxes, agent harnesses, memory, and telemetry are all implemented as middleware. Built-ins include toolCacheMiddleware for caching tool results by arguments and contentGuardMiddleware for filtering. AI SDK's wrapLanguageModel() middleware operates at the model level, and lifecycle hooks such as prepareStep, onStart, and onEnd cover parts of this surface. AI SDK doesn't have a unified application-level middleware chain.
Copy link to headingPersistence and resumable streams
TanStack AI treats persistence as a library feature rather than a pattern you implement. withPersistence middleware writes the transcript, run status, and pending approvals to a store you provide. On the client, persistence: true hands ownership to the server, or you pass a browser adapter such as indexedDBPersistence().
Resumable streams work through a durability adapter on the response.
The adapter records each chunk, and on reconnect the client sends its last offset and the server replays the log. memoryStream works for development and durableStream from @tanstack/ai-durable-stream works for production. useChat reconnects on its own.
AI SDK documents message persistence as a pattern where you write saveChat and loadChat and call them from onEnd. Resumable streams use the resume option on useChat plus a consumeSseStream callback, but you supply Redis, the resumable-stream package, an activeStreamId in your database, and the POST and GET routes.
Copy link to headingNative AG-UI protocol
The events TanStack AI streams between server and client are AG-UI events imported from @ag-ui/core, in both directions. Any AG-UI client can call an endpoint built with TanStack AI, and a TanStack AI frontend can sit in front of an AG-UI agent server written in another language. More than 20 agent frameworks support the protocol.
AI SDK streams its own UI Message Stream protocol. AG-UI interop is available through an external translation layer maintained by the AG-UI project.
Copy link to headingProvider-agnostic sandboxes and harnesses
TanStack AI can run a full coding-agent CLI inside a sandbox with a filesystem, shell, and cloned repository, and stream its work back through chat().
The sandboxed run composes a provider, a workspace, and a harness adapter, and each is swappable.
- Harnesses: Grok Build, Claude Code, Codex, and OpenCode ship as first-party packages, and
acpCompatibleturns any Agent Client Protocol agent into a harness by describing how to launch it - Sandbox providers: local process, Docker, Docker Sandboxes, Daytona, Vercel Sandbox, Sprites, and Cloudflare
- Durable runs: with durability enabled, the agent detaches, journals its progress, and a later request can take the run over after the tab closes
AI SDK's HarnessAgent covers the same idea with more first-party adapters (10 versus 4), and several of those adapters also connect over Agent Client Protocol. The documented AI SDK path centers on Vercel Sandbox for execution and Workflows for long runs, while TanStack AI exposes sandbox providers as a swappable contract.
Copy link to headingLazy tool discovery and code mode
TanStack AI marks tools with lazy: true to keep their schemas out of the initial prompt. A synthetic discovery tool lets the model request schemas on demand, and the feature runs inside TanStack AI's own agent loop on every provider. AI SDK's toolSearch() with deferLoading: true works the same way across providers, so the two SDKs are close to parity here.
Code mode lets the model write TypeScript that calls your tools inside an isolate, so one execution can loop, branch, and run tools in parallel. TanStack AI ships five isolate drivers behind one interface, covering Node.js isolated-vm, QuickJS WASM for browsers and edge, QuickJS on Bun, Cloudflare Workers, and Daytona. A companion package gives the model a persistent snippet library it builds over time. AI SDK's @ai-sdk/code-mode is experimental, runs QuickJS only, requires Node.js 22, and doesn't run in browser or edge runtimes.
Copy link to headingNo platform association
TanStack AI is a pure library with no associated platform, service, or billing. It connects directly to the providers you choose. For centralized routing without a platform layer, it offers a first-party OpenRouter adapter and a Vercel AI Gateway adapter. AI SDK is also free and works anywhere, but offers optional deeper integration with the Vercel platform for teams who choose to use it.
Copy link to headingWhen to choose AI SDK or TanStack AI
The right SDK depends on what you're building and what tradeoffs matter:
| If your workload looks like... | Choose | Why |
|---|---|---|
| Production agents with typed context, approvals, and timeouts | AI SDK | ToolLoopAgent with toolsContext, runtimeContext, agent-level toolApproval, and first-class timeouts |
| Agents that must survive restarts, deploys, or delayed approvals | AI SDK | WorkflowAgent on Vercel Workflows |
| Wrapping Claude Code, Codex, or Cursor behind one interface | AI SDK | 10 HarnessAgent adapters with sandbox support |
| Observability across every AI call from one registration | AI SDK | registerTelemetry(), @ai-sdk/otel, tracing channel, lifecycle callbacks |
| A specific provider as a dedicated, maintained package | AI SDK | ~38 first-party provider packages |
| Mixed TypeScript and Python services | AI SDK | AI SDK for Python (beta) shares model IDs and AI Gateway routing |
| Enterprise scale and support | AI SDK | 16 million+ weekly downloads, stable 7.x release |
| Per-model type inference from adapters | TanStack AI | Adapter metadata narrows options and modalities per model |
| Isomorphic tool definitions (server and client) | TanStack AI | Define once with toolDefinition(), implement for each runtime |
| Smallest possible bundle size | TanStack AI | Separate adapter per provider per activity |
| Chat persistence and resumable streams without Redis | TanStack AI | withPersistence and durability adapters built in |
| AG-UI interoperability with non-TypeScript agent servers | TanStack AI | Native AG-UI wire protocol in both directions |
| Swappable sandbox providers or any ACP agent | TanStack AI | Local, Docker, Daytona, Vercel, Sprites, or Cloudflare with acpCompatible |
| Streaming chat with tool calling | Both | Both provide hooks, streaming primitives, and automatic tool loops |
| Deploy on any hosting provider | Both | Both are standalone open-source libraries |
The choice comes down to how much you want the SDK to own. Teams building production agents who want approvals, durability, telemetry, and harness integrations from one stable release will find AI SDK 7 provides the most complete solution. Teams that prioritize per-model type inference, composable middleware, built-in persistence, and a protocol-first architecture with no platform layer may prefer TanStack AI.
Copy link to headingGet started
AI SDK: Start with the AI SDK documentation, read the AI SDK 7 announcement, or explore the Chatbot template.
TanStack AI: Start with the TanStack AI documentation or read the release candidate announcement.