unstale

npm / @ai-sdk/react

@ai-sdk/react

What changed in @ai-sdk/react 2 to 4, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-17.

6 breaking3 new APIs and options1 performance3 behavior and defaults18 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli 0.1.0 on npm

@ai-sdk/react 430 changes

Breaking changes 6

  • addToolOutput now rejects continuous sessions.

    4.0.105release notes

  • Removes the deferred managed Responses coordinator and the autoContinueTools option.

    4.0.105release notes

  • Backend usage state is removed from the realtime runtime.

    4.0.105release notes

  • Live tool-result aliases are removed.

    4.0.105release notes

  • Realtime configuration now requires explicitly selecting relay transport mode.

    4.0.105release notes

  • sendTextMessage now rejects continuous sessions.

    4.0.105release notes

New APIs and options 3

  • Applications exchange WebRTC SDP through an application endpoint using api.session.

    4.0.105release notes

  • Experimental client-delegated Live conversations can use browser-direct WebRTC alongside WebSockets.

    4.0.105release notes

  • Adds realtime WebSocket sessions with lifecycle management, transcripts, context append, reversible capture, acknowledgements, and continuous PCM playback.

    4.0.105release notes

Performance 1

  • Unused realtime runtime code can now be tree-shaken, potentially reducing application bundle size.

    4.0.107release notes

Behavior and default changes 3

  • Default chat IDs are generated on first access, allowing useChat() to prerender without reading a random value when the ID is unused during rendering.

    4.0.147release notes

  • Live continuous sessions enforce 128 KiB frame and combined buffered-send budgets using actual encoded wire bytes.

    4.0.105release notes

  • Adds WebSocket relay support with shared session state, capture controls, bounded playback, graceful close, and application-handled Live delegation.

    4.0.105release notes

Fixes and other changes 17

  • Preserves replay semantics when using custom chat transports.

    4.0.141release notes

  • Prevents a second resume request on mount when an already submitted or streaming chat remounts with a shared Chat instance.

    2.0.277, 3.0.307, 4.0.141release notesrelease notesrelease notes

  • Prevents stale object streams from overwriting newer results.

    2.0.277, 3.0.306, 4.0.141release notesrelease notesrelease notes

  • Streamed chat updates no longer starve navigation transitions.

    4.0.130release notes

  • Automatic stream resumption is deduplicated for shared Chat instances, preventing duplicate resumption behavior.

    4.0.126release notes

  • Replacement completion requests remain loading and cancellable when an earlier request settles.

    4.0.112release notes

  • Prevents stale throttled completion updates from overwriting a newer request.

    4.0.112release notes

  • Preserves Headers instances in useCompletion requests.

    4.0.110release notes

  • Handles rejected asynchronous onFinish callbacks.

    4.0.110release notes

  • Preserves active cancellation state during overlapping requests.

    2.0.268, 3.0.293, 4.0.110release notesrelease notesrelease notes

  • Keeps useObject cleared when an initial value is configured.

    4.0.110release notes

  • Realtime session ownership and callbacks publish only after React commits, preserving connected sessions across abandoned renders and unmounting controls safely.

    4.0.105release notes

  • Omitted onToolCall remains undefined, preserving missing-tool-handler diagnostics; defined handlers returning undefined still support manual tool output.

    4.0.105release notes

  • maxPlaybackBufferSeconds is supported only for continuous PCM sessions.

    4.0.105release notes

  • Chats are aborted when their useChat id changes during a stream.

    4.0.101release notes

  • Fallback errors are surfaced for empty HTTP response bodies.

    4.0.95release notes

  • Preserves the generated useObject value when the API URL changes.

    4.0.69release notes

@ai-sdk/react 21 changes

Fixes and other changes 1

  • Nullish useChat IDs are treated like omitted IDs, preventing chat instance recreation on every render.

    2.0.275release notes