shiichan

Agents SDK v0.12.4: your chat survives a dropped connection!

Hey everyone, it's me, Shiichan! Today Cloudflare shipped a quiet but very welcome reliability update to the Agents SDK, so let me walk you through it.

Cloudflare Changelog developers.cloudflare.com

What was announced?

On the Cloudflare Changelog, Agents SDK v0.12.4 is out. Instead of a flashy new feature, this one shores up reliability across chat recovery, routing retries, durable Think submissions, and Voice agent connection control.

The story so far

Until now, if a browser or client stream dropped while the server was still generating an AI response, that turn could get taken down with it. For longer responses where users refresh the page, close a tab, or briefly lose connection, that was a real pain.

There were other rough edges too: duplicate initial state frames during WebSocket setup could overwrite updates the client had already sent, and transient routing failures could trip you up.

What changes

With v0.12.4, server-side turns keep running even when the browser or client stream is interrupted, so a page refresh or a closed tab no longer kills the conversation.

You can still call stop() to cancel the server turn as before, and if you want a browser or client abort to cancel it too, just pass cancelOnClientAbort: true. It's nice to get to choose the behavior.

Dive Deep

Here are the concrete bits we can pull from the notes.

  • Chat recovery: @cloudflare/ai-chat keeps server turns running through a stream interruption. Set cancelOnClientAbort: true to also cancel on a browser or client abort. It also fixes resume races with a closed connection and a bug where recovery left the chat stuck in a streaming state.
  • State and routing: agents@0.12.4 prevents duplicate initial state frames during WebSocket setup, and getAgentByName() gains routingRetry (with options like maxAttempts) to retry transient Durable Object routing failures.
  • Durable Think: @cloudflare/think supports durable programmatic submissions. submitMessages() now offers durable acceptance, idempotent retries, status inspection, cancellation, and cleanup for server-driven turns that outlive the caller.
  • Think pruning change: the old aggressive default pruning is dropped because it could strip client-side tool results from longer multi-turn flows. truncateOlderMessages still runs to keep context cost bounded.
  • Voice control: @cloudflare/voice adds an enabled option to useVoiceAgent, so you can delay creating and connecting until prerequisites like capability tokens are ready.

Want to go deeper? Check out the Agents API reference and the chat agents documentation.

Wrap-up

  • Agents SDK v0.12.4 is a reliability-focused update
  • Chat keeps the server turn alive when connections drop, and cancelOnClientAbort lets you choose the behavior
  • routingRetry on getAgentByName() retries transient routing failures
  • submitMessages() makes Think submissions durable with idempotent retries
  • useVoiceAgent's enabled controls when the connection is created

If you run the Agents SDK in production and don't want to drop conversations on flaky connections, this release is right up your alley.