Cloudflare Agents: Durable Objects and Dynamic Workers

AI Engineergo watch the original →

Cloudflare is positioning Durable Objects as the primary compute primitive for stateful AI agents, enabling resumable streaming and multi-tab sync, while using 'Dynamic Workers' to securely execute LLM-generated code in sandboxed isolates.

Stateful Compute with Durable Objects

Cloudflare utilizes Durable Objects as the core compute unit for AI agents, moving away from the ephemeral request-response model of traditional serverless functions. By maintaining stateful connections, these objects allow for long-running processes that persist even without active requests. This architecture enables native support for resumable streaming, where a client can reconnect to a stream after a refresh, and multi-tab synchronization, which allows multiple users or devices to interact with the same agent session without requiring complex distributed systems engineering in userland.

Dynamic Workers for Secure Code Execution

Dynamic Workers function as a sandboxed execution environment for LLM-generated code. Unlike traditional virtual machines or containers that start with broad access and require restrictive security layers, Dynamic Workers begin with no ambient access to APIs or the file system. Developers explicitly grant capabilities to the isolate, such as specific outgoing fetch requests or limited environment variables. This approach allows developers to treat LLM-generated code as a first-class primitive, effectively reclaiming the 'eval' pattern by providing a fast, secure, and cheap way to run untrusted code on demand.

Integrated Agent Ecosystem

Cloudflare is building an Agents SDK that abstracts the complexity of state management and tool calling. The platform provides a virtual file system via @cloudflare/shell that layers SQLite storage within Durable Objects and R2 for larger assets. Additionally, the team is developing a coding agent harness built entirely on Workers, designed to handle tasks like generating code, managing extensions, and interacting with Cloudflare's API endpoints using minimal token counts.

  • #ai
  • #dev-tooling
  • #serverless

summary by google/gemini-3.1-flash-lite. probably wrong about something. check the source.