Tool pages / Vercel AI SDK
Vercel AI SDK 7.0.137: latest version, API diff and gotchas
Latest: Vercel AI SDK 7.0.137, released (release notes).
The latest Vercel AI SDK is 7.0.137 (ai), released 2026-10-09 14:53 UTC; upgrade with npm i ai@latest. In 7.0.137, readUIMessageStream discards unrelated message state when reading resumed streams. In 7.0.135, WebSocketChatTransport was introduced alongside top-level embedding dimensions and a default step limit warning in ToolLoopAgent. In 7.0.133, decide added multimodal state parts, requiring raw state arrays to be wrapped in JSON objects or parts. v7 requires Zod 3.25.76+ or 4.1.8+ and Node.js 18+.
How do I install or upgrade to Vercel AI SDK 7.0.137?
Install latest v7 in a project:
npm i ai@latest @ai-sdk/openai@latest zod@^4.1.8
npm ls ai # ai@7.0.137pnpm:
pnpm add ai@latest @ai-sdk/openai@latest zodMigrate from v6 to v7 (run at project root):
npx @ai-sdk/codemod@latest v6-to-v7 .
npx tsc --noEmitStay on v6.x (maintenance line):
npm i ai@^6.0.303Vercel AI SDK key facts
- Monorepo with core library
aiand modular provider packages (@ai-sdk/openai,@ai-sdk/anthropic,@ai-sdk/google,@ai-sdk/gateway). 29,759,300 weekly npm downloads forai(week ending 2026-10-08). - Latest release: 7.0.137 (GitHub release 2026-10-09 14:53 UTC; npm publish 2026-10-09 14:54 UTC). Rapid release cadence with 17 stable versions in October 2026.
- Parallel maintenance lines:
ai-v6(6.0.303published 2026-10-09) andai-v5(5.0.273published 2026-10-09) remain supported on npm dist-tags for backwards compatibility. - 7.0.0 was released on 2026-06-25 12:47 UTC, introducing structured outputs with Standard Schema, tool call repair, durable
WorkflowAgent, and default redaction of server errors in UI message streams. - 7.0.137 fixed
readUIMessageStreamto discard unrelated message state when reading resumed streams (PR #22194). - 7.0.136 stopped
chunkMsandfirstChunkMstimeouts when the model response ends so long-running local tools do not trigger model output timeouts (PR #22341). - 7.0.135 introduced
WebSocketChatTransport(PR #21019), top-leveldimensionsfor embedding functions (PR #22335), and warning logging when the default step limit stops aToolLoopAgent(PR #22329). - 7.0.133 added ordered text, file, and JSON parts to decision state, rejecting raw arrays not formatted as parts (PR #22229).
- Peer dependencies:
zodpeer range is^3.25.76 || ^4.1.8. Requires Node.js 18 or later. 27,200+ GitHub stars (Apache-2.0 licence).
What changed in the last 5 Vercel AI SDK releases?
Vercel AI SDK 7.0.137 (2026-10-09 14:53 UTC)
readUIMessageStreamdiscards unrelated message state when reading resumed streams. (source)
Vercel AI SDK 7.0.136 (2026-10-09 00:38 UTC)
- Clear
chunkMsandfirstChunkMstimeouts when model response ends so long-running local tools do not trigger model output timeouts. (source)
Vercel AI SDK 7.0.135 (2026-10-08 21:40 UTC)
- Add persistent
WebSocketChatTransportwith correlated streaming, backpressure, cancellation, validated protocol frames, and sequence resume. (source) - Add top-level
dimensionssetting for embedding functions. (source) - Log warning when default step limit stops a
ToolLoopAgent. (source) - Prevent duplicate continuation requests for repeated tool approval responses. (source)
- Wait for chat stream cleanup when stopping chat. (source)
Vercel AI SDK 7.0.134 (2026-10-08 16:50 UTC)
Vercel AI SDK 7.0.133 (2026-10-08 00:29 UTC)
- Accept multimodal input and ordered text, file, and JSON parts in
decidestate. (source)
Which Vercel AI SDK commands and flags were added or removed?
Vercel AI SDK 7.0.130 → 7.0.137
13 exports added, 0 removed, 7 exports with public members added or removed; 23 declarations changed in any way.
Method: bin/tool-snapshot installed both versions in a throwaway Linux sandbox and listed every export of every package entry point from the type declarations with the TypeScript compiler API (510 and 523 exported symbols), then bin/tool-diff compared them. In the tables, "command" is an exported symbol and "flags" are its public members (function parameters in parentheses).
Commands added:
ai Experimental_DecisionStateai Experimental_DecisionStatePartai PrepareWebSocketChatTransportReconnectToStreamRequestai PrepareWebSocketChatTransportSendMessagesRequestai SafeValidateWebSocketChatTransportRequestResultai WebSocketChatTransportai WebSocketChatTransportAbortRequestai WebSocketChatTransportInitOptionsai WebSocketChatTransportRequestai WebSocketChatTransportResponseai WebSocketChatTransportResumeRequestai WebSocketChatTransportSendRequestai safeValidateWebSocketChatTransportRequest
| Command | Flags added | Flags removed |
|---|---|---|
ai AbstractChat | dispose | none |
ai ChatTransport | closeresumeStreamIsReplay | none |
ai DirectChatTransportOptions | onStepEndonStepFinish | none |
ai EmbedStartEvent | dimensions | none |
ai EmbeddingModelCallStartEvent | dimensions | none |
ai SerialJobExecutor | waitForIdle | none |
ai UIMessageStreamOptions | onStepEndonStepFinish | none |
- 13 exports added in 7.0.137, including WebSocketChatTransport and safeValidateWebSocketChatTransportRequest for persistent WebSocket chat transports, and Experimental_DecisionState / Experimental_DecisionStatePart for multimodal decision inputs.
- Public members added:
disposeon AbstractChat,closeandresumeStreamIsReplayon ChatTransport,onStepEndandonStepFinishon DirectChatTransportOptions and UIMessageStreamOptions,dimensionson EmbedStartEvent and EmbeddingModelCallStartEvent, andwaitForIdleon SerialJobExecutor.
Vercel AI SDK 7.0.129 → 7.0.130
1 export added, 0 removed; 2 core streaming and agent implementations updated.
Method: From source (not run): compared git tags ai@7.0.129 and ai@7.0.130 via gh api repos/vercel/ai/compare/ai@7.0.129...ai@7.0.130 and inspected export declarations of packages/ai and @ai-sdk/provider.
Commands added:
ai Experimental_DecisionRefusalError
- The last two releases of the previous patch cycle.
Experimental_DecisionRefusalErroradded toai/errorand re-exported from@ai-sdk/provider. streamTextandToolLoopAgentcancel the internal reader on abort signal, ensuring promises reject without waiting for unclosed provider streams.
Vercel AI SDK 6.0.301 → 7.0.130
15 exports added, 1 removed; 5 core APIs updated across the v6 to v7 major boundary.
Method: From source (not run): compared git tags ai@6.0.301 and ai@7.0.130 via gh api repos/vercel/ai/compare/ai@6.0.301...ai@7.0.130 and inspected export declarations of packages/ai across the v6 and v7 major lines.
Commands added:
ai GatewayAsyncJobMetadataai GatewayProviderMetadataai experimental_toolCallerai Experimental_ToolCallerToolai Experimental_SandboxSessionai Experimental_SandboxProcessai ToolSetai batchai decideai toolSearchai translateai upload-fileai upload-skillai realtimeai Experimental_DecisionRefusalError
Commands removed:
ai ToolCallOptions
- Major line comparison:
ai@6.0.301(active maintenance line) toai@7.0.130(current stable). - v7 replaced
ToolCallOptionswithToolExecutionOptions, introduced durableWorkflowAgent, added Standard Schema support, and migrated evaluation helpers todecide.
What breaks when upgrading Vercel AI SDK, and how do I migrate?
| Version | Change | Migration |
|---|---|---|
| 7.0.133 | Arrays passed directly as decision state now contain DecisionStatePart[] (text, file, or json parts). Passing a raw array of items directly as state throws AI_InvalidArgumentError: Invalid argument for parameter state: must be a string, JSON object, or array of text, file, or json parts (PR #22229). | Wrap raw JSON arrays in an object (state: { items: [...] }) or pass as an explicit JSON part: state: [{ type: 'json', value: [...] }]. |
| 7.0.135 | Top-level dimensions parameter added to embed and embedMany (PR #22335). Non-positive (<= 0) or non-integer dimension values throw AI_InvalidArgumentError: Invalid argument for parameter dimensions: dimensions must be a positive integer before calling provider models. | Ensure requested embedding dimensions are positive integers supported by the provider, or omit the parameter to use the model default. |
| 7.0.129 | Portable max reasoning level added (PR #22045). Widens LanguageModelV4CallOptions['reasoning'] and ReasoningLevel. Third-party providers and consumers with exhaustive switch statements or Record<ReasoningLevel, ...> mappings fail TypeScript compilation until max is handled. | Update exhaustive switches or records over ReasoningLevel to handle the new 'max' level. |
| 7.0.128 | experimental_evaluate was renamed to experimental_decide (PR #21935); Experimental_EvaluationUnsupportedQuestionTypeError is deprecated in favor of Experimental_DecisionUnsupportedQuestionTypeError. | Update imports from experimental_evaluate to experimental_decide. |
| 7.0.0 | UI message streams redact server error details by default (commit f18b08f). toUIMessageStream, createUIMessageStream, and toUIMessageChunk default their onError callback to generic 'An error occurred.' instead of serializing raw server error details to clients. | Pass an explicit onError: (error) => ... callback to toUIMessageStream or createUIMessageStream if client applications require custom error strings. |
What Vercel AI SDK errors did we reproduce, and how do I fix them?
Passing raw array directly as decision state throws `InvalidArgumentError` (Vercel AI SDK 7.0.133)
// Passing raw array of items directly as decision state in 7.0.133+
await experimental_decide({ model, state: ['alpha', 'beta'], questions });AI_InvalidArgumentError: Invalid argument for parameter state: must be a string, JSON object, or array of text, file, or json partsFix: In 7.0.133+, raw arrays passed as state are treated as DecisionStatePart[]. Wrap arrays in an object (state: { items: ['alpha', 'beta'] }) or an explicit JSON part (state: [{ type: 'json', value: ['alpha', 'beta'] }]). (source)
Negative or non-integer embedding dimensions throw `InvalidArgumentError` (Vercel AI SDK 7.0.135)
// Calling embed with negative or non-integer dimensions
await embed({ model, value: 'test string', dimensions: -1 });AI_InvalidArgumentError: Invalid argument for parameter dimensions: dimensions must be a positive integerFix: Provide a positive integer for dimensions (e.g., dimensions: 512) supported by the model and provider, or omit dimensions to use the model default. (source)
ToolLoopAgent default step limit logs warning on 20 steps (Vercel AI SDK 7.0.135)
// ToolLoopAgent tool loop reaches default 20-step limit without explicit stopWhen
const agent = new ToolLoopAgent({ model, tools: { ping } });
await agent.generate({ prompt: 'Keep pinging' });(node:62) Warning: AI SDK Warning (mock-provider / mock-model): The tool loop stopped because it reached the default stopWhen condition, isStepCount(20). To allow more steps, set stopWhen to isStepCount(...) with a higher limit or provide a custom stop condition. Learn more: https://ai-sdk.dev/docs/agents/loop-controlFix: Pass an explicit stopWhen: isStepCount(50) (or custom condition) to allow additional steps, or set globalThis.AI_SDK_LOG_WARNINGS = false to suppress warning logging. (source)
Malformed WebSocket chat request frame rejected (Vercel AI SDK 7.0.135)
// Validating malformed incoming WebSocket chat request frame
await safeValidateWebSocketChatTransportRequest({ value: { type: 'unknown_type' } });error: Invalid WebSocket chat request frame.Fix: Ensure client frames conform to WebSocketChatTransportRequest specifications ('send', 'resume', or 'abort' with required requestId and headers). (source)
AbortSignal cancellation rejects pending result promises with AbortError (Vercel AI SDK 7.0.130)
const controller = new AbortController();
const result = streamText({ model, prompt: 'Hello', abortSignal: controller.signal });
controller.abort(new DOMException('User cancelled', 'AbortError'));
await result.text;AbortError: User cancelledFix: In 7.0.130+, result.text, result.steps, result.finishReason, and result.totalUsage reject immediately when abort() is invoked. Wrap calls consuming result promises in try/catch and inspect error.name === 'AbortError'. (source)
Vercel AI SDK release history by month
2026-10: 7.0.127 to 7.0.137; 6.0.300 to 6.0.303; 5.0.272 to 5.0.273 (17 stable releases to 2026-10-10)
- 7.0.137 (2026-10-09): discard unrelated message state when reading resumed streams (PR #22194). (source)
- 7.0.135 (2026-10-08): persistent WebSocket ChatTransport (PR #21019); top-level dimensions for embeddings (PR #22335); tool loop default step limit warning (PR #22329). (source)
- 7.0.133 (2026-10-08): multimodal input and ordered state parts in decide (PR #22229). (source)
- 7.0.130 (2026-10-07): reject result promises immediately on abort signal (PR #22184); report decision refusals as DecisionRefusalError (PR #22203). (source)
2026-09: 7.0.88 to 7.0.126 (83 stable releases)
2026-08: 7.0.48 to 7.0.87 (88 stable releases)
2026-07: 7.0.1 to 7.0.47; 6.0.218 to 6.0.245 (74 stable releases)
2026-06: 6.0.194 to 6.0.217; 7.0.0 (50 stable releases)
2026-05: 6.0.173 to 6.0.193 (27 stable releases)
Sources
- vercel/ai releases (GitHub API) (read 2026-10-10)
- ai on the npm registry (dist-tags, versions, publish timestamps) (read 2026-10-10)
- npm weekly downloads statistics for ai (read 2026-10-10)
- Vercel AI SDK 7.0.137 release notes (read 2026-10-10)
- Vercel AI SDK 7.0.136 release notes (read 2026-10-10)
- Vercel AI SDK 7.0.135 release notes (read 2026-10-10)
- Vercel AI SDK 7.0.134 release notes (read 2026-10-10)
- Vercel AI SDK 7.0.133 release notes (read 2026-10-10)
- Vercel AI SDK 7.0.132 release notes (read 2026-10-10)
- Vercel AI SDK 7.0.131 release notes (read 2026-10-10)
- Vercel AI SDK 7.0.130 release notes (read 2026-10-10)
- Vercel AI SDK 7.0.0 release notes (v7 major release overview) (read 2026-10-10)
- PR #22194: prevent readUIMessageStream from adopting content from an unrelated assistant turn (read 2026-10-10)
- PR #22341: clear chunkMs timeout during tool execution (read 2026-10-10)
- PR #21019: add persistent WebSocket ChatTransport with correlated streaming and validated protocol frames (read 2026-10-10)
- PR #22335: add top level dimensions setting for embedding functions (read 2026-10-10)
- PR #22329: log warning when default step limit stops a tool loop (read 2026-10-10)
- PR #22285: prevent duplicate continuations for repeated tool approval responses (read 2026-10-10)
- PR #21798: wait for chat stream cleanup when stopping (read 2026-10-10)
- PR #22284: surface async sendAutomaticallyWhen failures from tool updates (read 2026-10-10)
- PR #22283: preserve provider-executed tool calls while resuming chat streams (read 2026-10-10)
- PR #22229: accept multimodal input in decide (read 2026-10-10)
- PR #22268: introduce onUIMessageStepEnd callback to persist messages (read 2026-10-10)
- PR #22184: reject pending result promises on abort signal (read 2026-10-10)
- PR #22203: report decision refusals as refusal answers and DecisionRefusalError (read 2026-10-10)
- PR #22045: add portable max reasoning level across supported providers (read 2026-10-10)
- PR #21935: rename experimental_evaluate to experimental_decide (read 2026-10-10)
- PR #21994: use AISDKError InvalidResponseDataError for audio format errors (read 2026-10-10)
- package.json manifest of ai package at tag ai@7.0.137 (read 2026-10-10)
- vercel/ai repository (stars, description, licence) (read 2026-10-10)
- Vercel AI SDK documentation homepage (read 2026-10-10)
Last verified: 2026-10-10.