shiichan

Cloudflare's Agents SDK levels up: browser automation and code execution that survive crashes!

Hi, it's me, I'm so excited! Today's news is about a big upgrade to Cloudflare's Agents SDK. Agents can now safely reach out and touch real systems, and keep working even when things get interrupted. Let me walk you through it!

Cloudflare Changelog developers.cloudflare.com

What was announced?

According to Cloudflare's Changelog, the latest Agents SDK release, v0.16.1, brings together a set of features aimed at letting agents "safely interact with real systems and keep working through interruptions." There are four big highlights.

  • Browser Run — agents can now browse and operate real websites
  • Code Mode — agents can write code against external tools
  • Improved Think sub-agents — delegated sub-agents can now use client-provided tools
  • Better recovery — agents recover more reliably from deploys, Durable Object evictions, and connection churn

Alongside these four, the release also ships a new output device selection feature for voice agents.

The story so far

Up until now, if you wanted an agent to control a browser, write code against external tools, or give a sub-agent flexible access to tools, you had to hand-roll your own pause/resume logic for approval steps and your own recovery logic for when things went wrong. In particular, what happens to an agent's state the moment a Durable Object gets evicted during a deploy or scheduling event, or the moment a WebSocket connection drops, was a subtle but nagging problem.

What changes

With this update, agent developers can lean on the SDK itself for two things: safely interacting with the outside world, and recovering when something breaks. Both browser automation and code execution now pause properly before any action that needs approval, letting a human weigh in before continuing. And even if a deploy happens or a connection drops, the agent's execution doesn't get thrown away — it can pick back up where it left off. That's great news for teams that were previously building their own resilience layer on top.

Dive Deep

Let's look at each piece in more detail.

Browser Run

A durable browser_execute tool has been added, letting agents write code against the Chrome DevTools Protocol (CDP). This lets agents inspect pages, capture screenshots, read rendered content, and debug frontend behavior. Sessions support three modes.

  • One-time sessions
  • Reused sessions
  • Sessions that get dynamically promoted to persistent when human intervention is needed, such as for login, MFA, or approvals

There are also quick-action tools for markdown extraction, link detection, and scraping.

Code Mode

createCodemodeRuntime lets you build a code execution runtime combined with connectors and a durable execution log. When execution reaches an approval-gated action, it pauses and returns the pending approvals; once approved, it replays the already-completed calls from the durable log before continuing. In other words, you no longer need to write custom pause/resume logic for actions with side effects.

Improved Think sub-agents

Sub-agents can now access client-defined tools over the RPC chat() path, configured via the clientTools and onClientToolCall parameters. The step.prompt() method can now run a full agentic turn before returning structured output, which makes it easier to build durable triage, research, and approval flows.

Voice output device selection

The useVoiceAgent hook now accepts an outputDeviceId parameter for routing audio to a specific speaker, with a graceful fallback to the default output device when that isn't supported.

Reliability improvements

A number of reliability fixes landed too.

  • WebSocket reconnection handling
  • Resilient chat stream replay
  • Multi-pass fiber recovery with backoff
  • Teardown continuing even when a request is canceled
  • Byte-budgeted reads of session history

You can install the update via npm, yarn, pnpm, or bun. Alongside the core agents package, @cloudflare/think, @cloudflare/codemode, @cloudflare/ai-chat, and @cloudflare/voice were all updated as well.

Wrap-up

Here's a recap of Agents SDK v0.16.1.

  • Browser Run adds CDP-based page operations, screenshots, and debugging
  • Code Mode lets you run code safely while pausing for approvals
  • Think sub-agents can now use client-provided tools
  • Recovery from deploys, Durable Object evictions, and dropped connections is much stronger
  • Voice agents also gained output device selection

If you're building agents on Cloudflare, this is one of those quiet-but-appreciated updates that's all about not breaking and not stopping!