Cloudflare Codex Harness: Durable Objects, Resume Guide

AI Coding · ax-trend issue #3892 · Announced November 9, 2026

Title card: Codex on Durable Objects, resumable agent loop with Tasks, Sessions, Streams and Workspace

Cloudflare released an experimental Agents SDK example on November 9, 2026 that runs the Codex agent loop inside a Durable Object. The conversation, the files, completed model calls and tool execution results all survive a restart, so an interrupted agent can pick its work back up instead of starting the task again.

The important design choice is what Cloudflare did not build. It did not write a new agent loop. The example ports the existing Codex Rust turn handling code to WebAssembly and runs it in the Durable Object, while the platform takes over state storage and recovery. That split is the point of the release: the harness stays interchangeable, and durable execution becomes a platform feature underneath it. Cloudflare already documents an OpenCode harness running on Durable Objects in the same Agents stack, which supports that reading.

The Four Primitives Behind Resumption

Flow diagram: Tasks replay recorded steps, Sessions compact context, Streams replay events in order, Workspace persists files
The four Agents SDK primitives that carry a Codex run across a restart.

Durable execution in the example is a combination of four Agents SDK features. Tasks record model calls and tool executions. A completed step reuses its recorded result on resume, and only the interrupted step runs again. Sessions store the conversation history and compact the model context. Streams store ordered events and replay them when a client reconnects. Workspace provides the tools that read and write files.

Each primitive covers a different failure. A process can die mid task, a context can grow too large to reload in full, a client can disconnect and miss events, and a working directory can vanish with the machine that held it. Splitting those problems apart is more useful than a single checkpoint feature, because a team building its own agent infrastructure can adopt the same decomposition even outside Cloudflare. The recovery design question stops being whether to save state and becomes which of the four kinds of state a given run actually needs.

Model Connection Through AI Gateway

The model connects through AI Gateway. The example code specifies OpenAI GPT-6.1 Sol with createAI, and the gateway default setting needs Unified Billing or a stored OpenAI API key. Setup, model, tool and recovery details are covered in the Codex harness guide that Cloudflare points to from the announcement.

The gateway dependency is also the main portability limit visible so far. A model that is not available through the gateway, or a self hosted model, may not fit this example as written, and Cloudflare has not confirmed the range of combinations. Teams evaluating the pattern should separate the two layers before drawing conclusions: the resumption design transfers to other stacks, while the specific example is tied to the gateway for its model calls.

Why Resumable Execution Matters Now

Coding agents increasingly run tasks that outlast a single request. When a process dies or a deployment overlaps a long run, restarting from zero wastes the completed model calls and can repeat tool actions that already had side effects. Recording completed steps and replaying their results addresses both costs at once. It cuts repeated spending, and it reduces the duplicate execution risk that makes operators hesitant to hand long jobs to an agent in the first place.

That is why this small example is worth more attention than its experimental label suggests. The competitive axis for agent harnesses is moving from prompts and tool lists toward execution that survives interruption. Cloudflare is arguing, with working code, that this layer belongs in the platform rather than inside each harness. If that argument holds, harness choice becomes easier to reverse, because the state and the recovery guarantees stay with the platform when the harness changes.

Open Questions and Limits

Related Reading

Resumable execution is a recurring theme in recent agent tooling. See the report on agent-autoloop and background CLI agents for a hub that keeps command line agents running in the background, and the report on Google ADK v2.14.0 for another platform level take on agent environments and evaluation.

FAQ

What did Cloudflare release on November 9, 2026?

Cloudflare released an experimental Agents SDK example that runs the Codex agent loop inside a Durable Object. The Codex Rust turn handling code was ported to WebAssembly for the example.

How does the harness resume after an interruption?

Tasks record model calls and tool executions, so completed steps reuse their recorded results and only interrupted steps run again. Sessions store the conversation, Streams replay ordered events and Workspace persists files.

Which model does the example use?

The model connects through AI Gateway. The example code specifies OpenAI GPT-6.1 Sol with createAI, and the gateway default setting needs Unified Billing or a stored OpenAI API key.

Is the Codex harness a finished product?

No. Cloudflare describes it as an experimental example. The announcement gives no performance figures, no concurrency scale and no service level commitment.

Sources

AI CodingAI InfraAX Trend