npm / @ai-sdk/react
@ai-sdk/react
What changed in @ai-sdk/react 1 to 7, from its official release notes, upgrade guides and advisories. Sources checked 2026-12-05.
38 breaking10 deprecations19 new APIs and options1 performance7 behavior and defaults1 tooling23 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli init@ai-sdk/react 722 changes
Breaking changes 10
Top-level content, tool, file, source, and warning properties on generateText and streamText results now aggregate values across every step; use finalStep for final-step-only values.
All packages are ESM-only; consumers using require() must switch to ESM import syntax.
The deprecated option has been removed; replace remaining usages with activeTools.
The deprecated function has been removed; replace usages with isToolUIPart.
The deprecated tool-result content part type has been removed; use the file content part shape for inline file content.
The minimum supported Node.js version is 22; supported versions are 22, 24, and 26.
The codemod updates named imports and direct re-exports while preserving local binding names and application export names as aliases; namespace member access remains unchanged.
Approval policy can be configured on the generation call or agent instead of on individual tools.
The deprecated type has been removed; use ToolExecutionOptions for imports and type references.
generateText and streamText usage now totals tokens across all steps; use finalStep.usage for the former final-step-only value.
Deprecations 7
Tool-result file content uses one canonical variant with tagged data and a required mediaType; legacy image-* and file-* variants are runtime-migrated.
The user-message image content part is deprecated; use a file part with an image mediaType instead.
The tool-level approval property is deprecated; move approval logic to the call or agent’s toolApproval setting so policy can vary by request.
The per-step lifecycle callback is renamed from onStepFinish to onStepEnd for UI message stream helpers; onStepFinish remains a deprecated alias.
Top-level final-step reasoning and metadata properties are deprecated; access them through finalStep instead.
totalUsage is deprecated; use usage, which now contains usage across all steps.
The streamText result method is deprecated; use the stateless top-level helper to compose the transformation over any stream.
New APIs and options 2
Use finalStep to access final-step-only result values; for streamText, await finalStep before reading them.
Models can return files in reasoning as a distinct content type; update exhaustive part handling and account for these files in content or reasoning rather than result.files or step.files.
Behavior and default changes 2
The onEnd callback follows the result changes: usage and listed content properties cover all steps, while final-step-only properties are available on finalStep.
Provider-specific reasoning settings take precedence over the top-level reasoning option when both are present, potentially bypassing that configuration.
Tooling 1
Adds the migration skill to guide an agent through migrating from AI SDK v6 to v7.
@ai-sdk/react 65 changes
Breaking changes 3
Use getStaticToolName to retrieve a tool name from static tool UI parts; getToolName has been renamed.
Use isStaticToolUIPart to check for static tool UI parts; isToolUIPart has been renamed.
The tool UI part state union adds approval-requested, approval-responded, and output-denied; update exhaustive state handling to cover them.
Deprecations 2
getToolName now retrieves the name from either static or dynamic tool UI parts; the former getToolOrDynamicToolName name is deprecated but remains available.
isToolUIPart now checks for either static or dynamic tool UI parts; the former isToolOrDynamicToolUIPart name is deprecated but remains available.
@ai-sdk/react 446 changes
Breaking changes 15
addToolOutput now rejects continuous sessions.
Removes the deferred managed Responses coordinator and the autoContinueTools option.
Backend usage state is removed from the realtime runtime.
Live tool-result aliases are removed.
Realtime configuration now requires explicitly selecting relay transport mode.
sendTextMessage now rejects continuous sessions.
The callback argument no longer includes threadId or messageId; use those variables from the outer scope.
The useChat method has been removed; use addToolResult instead.
MCP App tool calls are rejected when allowedTools is omitted; explicitly list tools in handlers.allowedTools to expose them.
The experimental export has been removed; use the useAssistant hook directly.
The setInput helper has been removed; use submit instead.
The roundtrip options have been removed; use maxSteps instead. Its value is roundtrips + 1.
The options parameter has been removed; set headers and body directly instead.
The streamMode option has been removed; use streamProtocol instead.
The streamMode option has been removed; use streamProtocol instead.
Deprecations 1
keepLastMessageOnError now defaults to true and is deprecated; it will be removed in the next major release.
New APIs and options 8
MCP App CSP metadata now supports baseUriDomains.
Adds experimental_queue to queue messages sent while a response is in progress.
An optional createTransport interface supports provider-owned realtime transports.
A provider connection capability supports provider-owned realtime transports.
Applications exchange WebRTC SDP through an application endpoint using api.session.
Experimental client-delegated Live conversations can use browser-direct WebRTC alongside WebSockets.
Adds realtime WebSocket sessions with lifecycle management, transcripts, context append, reversible capture, acknowledgements, and continuous PCM playback.
Adds a realtime hook returning UIMessage[], with onToolCall and addToolOutput for client-driven tool execution.
Performance 1
Unused realtime runtime code can now be tree-shaken, potentially reducing application bundle size.
Behavior and default changes 4
MCP Apps can load scripts and styles from origins declared in resourceDomains.
Default chat IDs are generated on first access, allowing useChat() to prerender without reading a random value when the ID is unused during rendering.
Live continuous sessions enforce 128 KiB frame and combined buffered-send budgets using actual encoded wire bytes.
Adds WebSocket relay support with shared session state, capture controls, bounded playback, graceful close, and application-handled Live delegation.
Fixes and other changes 17
Preserves replay semantics when using custom chat transports.
Prevents a second resume request on mount when an already submitted or streaming chat remounts with a shared Chat instance.
Prevents stale object streams from overwriting newer results.
Streamed chat updates no longer starve navigation transitions.
Automatic stream resumption is deduplicated for shared Chat instances, preventing duplicate resumption behavior.
Replacement completion requests remain loading and cancellable when an earlier request settles.
Prevents stale throttled completion updates from overwriting a newer request.
Preserves Headers instances in useCompletion requests.
Handles rejected asynchronous onFinish callbacks.
Preserves active cancellation state during overlapping requests.
Keeps useObject cleared when an initial value is configured.
Realtime session ownership and callbacks publish only after React commits, preserving connected sessions across abandoned renders and unmounting controls safely.
Omitted onToolCall remains undefined, preserving missing-tool-handler diagnostics; defined handlers returning undefined still support manual tool output.
maxPlaybackBufferSeconds is supported only for continuous PCM sessions.
Chats are aborted when their useChat id changes during a stream.
Fallback errors are surfaced for empty HTTP response bodies.
Preserves the generated useObject value when the API URL changes.
@ai-sdk/react 35 changes
Breaking changes 2
Use chat.addToolOutput() instead of chat.addToolResult() to add tool output.
React 19 release-candidate support is dropped, and minimum versions are required for RSC to address CVE-2025-55182.
New APIs and options 2
The useChat onFinish callback now includes finishReason.
Tool execution approval is now supported.
Fixes and other changes 1
The subscribeToMessages callback dependency in useChat is fixed.
@ai-sdk/react 215 changes
Breaking changes 2
Removes managed chat inputs, changing how applications provide chat input handling.
Removes the useAssistant hook; this is a breaking change.
New APIs and options 7
Adds a method to clear a chat error.
Introduces ChatStore as part of the new chat architecture.
Introduces ChatTransport as part of the new chat architecture.
UI messages support typed tool parts.
Adds a generic for UI messages.
Adds experimental throttle support back to useChat.
Adds a resume flag to useChat to support resuming an ongoing stream.
Behavior and default changes 1
Stabilizes setMessages in useChat.
Fixes and other changes 5
Nullish useChat IDs are treated like omitted IDs, preventing chat instance recreation on every render.
Uses structuredClone for messages in replaceMessage.
Fixes chat instance recreation in useChat.
Fixes message subscriptions becoming out of sync when the chat id changes after mount.
Integrates addToolResult into the UseChatHelpers type without an intersection.
@ai-sdk/react 16 changes
Breaking changes 6
The experimental_addToolResult API was removed.
Legacy function/tool calling was removed.
The default value of keepLastMessageOnError is now true.
Deprecated roundtrip options were removed from useChat.
The streamMode setting was removed from useChat and useCompletion.
The setInput helper was removed from useObject.