Cloudflare AI agents in 2026: Durable Objects, Facets and Dynamic Workflows for production

How to build production AI agents on Cloudflare in 2026, and when a container platform still wins.

Read time
12 min
Word count
1.7K
Sections
10
FAQs
8
Share
Dark edge-network illustration for building AI agents on Cloudflare
Building production AI agents on Cloudflare's edge platform.
On this page · 10 sections
  1. Why the runtime is the hard problem
  2. The Cloudflare primitives that matter
  3. A minimal build
  4. Cloudflare vs AWS Bedrock AgentCore vs Vercel
  5. When Cloudflare is the wrong choice
  6. India-specific considerations
  7. Primitive-to-decision cheat sheet
  8. FAQ
  9. How eCorpIT can help
  10. References

Summary. During Agents Week, which ended on 20 April 2026, Cloudflare shipped roughly 20 agent-focused features across compute, security, and storage. Two months later, on 1 May 2026, it released the Dynamic Workflows library and rearchitected Cloudflare Workflows to run 50,000 concurrent instances, up from 4,500, and 300 new executions per second per account, up from 100. The pitch for engineers is specific: give every agent its own Durable Object, hibernate it when idle at a marginal cost near $0, and pay for a small always-on container only when you actually need one, which on AWS, Azure, or Google Cloud runs roughly $25 to $30 per month per instance. This guide covers the primitives that matter, a minimal build, and an honest decision table against AWS Bedrock AgentCore and Vercel, including the cases where Cloudflare is the wrong platform.

The hard part of a production agent is rarely the model call. It is the runtime around it: where state lives, what happens when a 30-second language-model call crashes halfway, how you isolate one tenant's agent from another, and what it costs to keep a million mostly-idle agents alive. Cloudflare spent 2026 building primitives for exactly those problems, and the design is opinionated enough that you should understand it before you commit.

Why the runtime is the hard problem

Sunil Pai, a Cloudflare engineer who leads the Agents SDK, frames Durable Objects as "the world's first implementation of the actor model in an infrastructure layer." That is the whole thesis. An actor is a single-threaded unit of compute with its own private state and its own address. Map one agent to one actor and several messy problems collapse into one clean model: each agent has an identity, its own storage, and a lifecycle you can reason about.

The economics push you the same way. Cloudflare's own framing is that if a hundred million knowledge workers each run an assistant at modest concurrency, you need capacity for tens of millions of simultaneous sessions, and at current per-container costs "that's unsustainable." Their worked example: 10,000 agents each active 1% of the time is 10,000 always-on containers on a VM platform, versus roughly 100 active Durable Objects at any moment on Cloudflare, because idle objects hibernate. When an object hibernates it consumes zero compute, so the marginal cost of spawning a new agent is, in their words, "effectively zero." For a workload that is bursty and long-lived, which describes most agents, that is the difference between a viable unit economic and a losing one. The trade-off is real work in modelling per-task cost, which we cover in AI agent unit economics and cost per task.

The Cloudflare primitives that matter

Four building blocks carry most of the value. You can adopt them incrementally.

Durable Objects and Hibernation

A Durable Object is a single instance of a class with persistent, transactional SQLite storage attached and a stable name. routeAgentRequest maps an incoming request to a named object, so "agent for user 4821" is one object with one database. Hibernation is the economic unlock: an object with an open WebSocket can evict itself from memory between messages and wake on the next event, which is why Cloudflare can say you pay "$0 until the agent wakes up." State survives the sleep because it is in SQLite, not in RAM.

Durable Object Facets

Facets, announced during Agents Week, let a Dynamic Worker instantiate Durable Objects that each get their own isolated SQLite database. The practical payoff is two-fold. You can build a platform that runs persistent, stateful code generated on the fly, giving each AI-generated app its own database. And in the Agents SDK, sub-agents are child Durable Objects colocated with a parent through Facets, each with its own SQLite and execution context. Storage-level isolation between a parent orchestrator and its workers is a property you would otherwise build by hand.

Cloudflare Workflows and the Dynamic Workflows library

Cloudflare Workflows is a durable execution engine: multi-step code where every step is independently retryable and every sleep hibernates for free. The May 2026 rearchitecture lifted it to 50,000 concurrent instances and 300 creations per second per account. The catch, historically, was that workflow code had to ship with your deployment, one binding and one class per deploy. The Dynamic Workflows library, released MIT-licensed as @cloudflare/dynamic-workflows on 1 May 2026 and built on Dynamic Workers, removes that limit: workflow code can differ per tenant, per agent, or per request at runtime. For agents this is the headline use case. An agent writes a run(event, step) function as its plan, submits it, and gets independent retries, hibernation, and human-approval gates without you deploying anything. If you are weighing this against Postgres-backed durable execution, compare it with durable workflows for AI agents on Postgres.

The Agents SDK and Project Think

The Agents SDK is the developer surface, already powering thousands of production agents. Project Think, previewed on 15 April 2026 as the next edition of the SDK, adds the primitives long-running agents need: durable execution with fibers, where a fiber is a durable function invocation registered in SQLite before it runs, checkpointable with stash() and recoverable on restart; sub-agents with isolated SQLite and typed RPC; persistent sessions stored as message trees that support forking, compaction, and full-text search over history via FTS5; and sandboxed code execution through Dynamic Workers that start with no ambient authority. It ships an "execution ladder" from a workspace filesystem, to a fast isolate, to npm, to a headless browser, to a full Cloudflare Sandbox, so an agent escalates only as far as a task needs.

A minimal build

The smallest useful shape is an agent class plus a request router. This sketch uses the SDK and a model served through Workers AI.


            import { Agent, routeAgentRequest } from "agents";
import { createWorkersAI } from "workers-ai-provider";

export class SupportAgent extends Agent<Env> {
  getModel() {
    return createWorkersAI({ binding: this.env.AI })("@cf/moonshotai/kimi-k2.5");
  }

  // A durable, crash-recoverable unit of work.
  async handle(message: string) {
    return this.runFiber("reply", async (ctx) => {
      ctx.stash({ message });               // checkpoint before the LLM call
      const answer = await this.callLLM(message);
      this.broadcast({ answer });           // push to any connected client
      return answer;
    });
  }
}

export default {
  fetch: (req: Request, env: Env) => routeAgentRequest(req, env),
};
          

Each user maps to one SupportAgent instance with its own SQLite. If the process dies during the language-model call, runFiber replays from the checkpoint rather than losing the turn. A React client can bind to the same agent with useAgent({ agent: "SupportAgent" }), and deployment is a single npx wrangler deploy. This is the pattern that makes state and crash recovery boring, which is what you want in production. For the failure modes that survive this kind of harness, see why AI agents fail silently in CI/CD.

Cloudflare vs AWS Bedrock AgentCore vs Vercel

No platform wins on every axis. The table compares the three on the vectors that decide a build, current as of August 2026.

Decision vector Cloudflare (Agents SDK + Durable Objects) AWS Bedrock AgentCore Vercel (functions + AI SDK)
Isolation model One Durable Object per agent, own SQLite Managed runtime, session isolation Stateless functions, external state
Idle cost Hibernates to near $0 Consumption-based, no idle actor model Pay per invocation, no persistent actor
Built-in durable state SQLite in the object; Workspace on SQLite + R2 Bring your own store or managed memory External DB or KV required
Durable multi-step execution Workflows + Dynamic Workflows (per-tenant code) Managed harness and orchestration AI SDK; durability is your responsibility
Sandboxed code by the agent Dynamic Workers, then Cloudflare Sandboxes AgentCore runtime tools Not a first-class primitive
Ecosystem fit Best if you already run on Workers Best if your data and IAM live in AWS Best for Next.js front ends

AWS Bedrock AgentCore moved fast in 2026: Policy reached general availability on 3 March 2026, Evaluations on 31 March 2026, and June 2026 added optimization that turns production traces into continuous improvement. If your data gravity, identity, and compliance already sit inside AWS, AgentCore is the lower-friction path, and we cover it in building an AI agent on Amazon Bedrock AgentCore. Vercel remains the cleanest place to ship a Next.js front end with the AI SDK, though you supply your own durability and state; the raw compute economics are laid out in Cloudflare Workers versus Vercel Functions on cost.

When Cloudflare is the wrong choice

The honest cases. If your agent needs heavy, sustained CPU or GPU compute for minutes at a time, the isolate model is the wrong tool and a container or GPU instance is cheaper and simpler. If your team's data and IAM already live in AWS or Google Cloud, the integration tax of moving egress and identity to a new provider can exceed the idle-cost savings. If you need a mature ecosystem of orchestration frameworks today, the field is broader elsewhere, as covered in choosing a production AI agent framework. And Project Think is in preview, so treat its API surface as subject to change and pin versions. The general rule holds: the real cost is usually the migration and the operational learning curve, not the code.

India-specific considerations

For Indian teams, two factors matter beyond raw price. First, data residency under the Digital Personal Data Protection Act 2023 (DPDP): Cloudflare runs on a global anycast network, so if you process personal data you must confirm where object state and logs are stored and configure accordingly, rather than assume a region. Second, the idle-cost model changes the math for early-stage products. A pilot agent serving a few thousand users, mostly idle, can run at a fraction of an always-on container bill, which on the major clouds starts around $25 to $30 per month per node before India GST and data-transfer charges. Design for hibernation from day one and the cost curve stays flat until real usage arrives. Governance still applies at scale; see enterprise AI agent governance layers and the broader enterprise AI agents in production pillar.

Primitive-to-decision cheat sheet

Primitive What it gives you Reach for it when
Durable Object + Hibernation Per-agent identity, state, near-$0 idle Every stateful, long-lived agent
Durable Object Facets Isolated SQLite per dynamic app or sub-agent Multi-tenant platforms; sub-agents
Cloudflare Workflows Retryable, hibernating multi-step execution Plans with steps that must not double-run
Dynamic Workflows Per-tenant or per-agent workflow code at runtime Agent-authored plans; CI/CD per tenant
Fibers (Project Think) Checkpointed, crash-recoverable functions Long LLM calls that must survive restarts
Execution ladder Escalating sandbox from isolate to full VM Agents that run untrusted generated code

FAQ

How eCorpIT can help

eCorpIT is a Gurugram-based, ISO 27001:2022 certified engineering organisation that builds and ships production AI agents. Our senior engineering teams design the runtime decisions this article covers: per-agent isolation, durable state, crash recovery, and the platform trade-off between Cloudflare, AWS, and other clouds, with data handling designed aligned with DPDP Act 2023 requirements. If you are moving an agent from prototype to production and want the architecture right before you scale, talk to our team.

References

  1. Building the agentic cloud: everything we launched during Agents Week 2026 — Cloudflare
  1. Project Think: building the next generation of AI agents on Cloudflare — Cloudflare
  1. Introducing Dynamic Workflows: durable execution that follows the tenant — Cloudflare
  1. Cloudflare Ships Dynamic Workflows, Bringing Durable Execution to Per-Tenant and Per-Agent Code — InfoQ
  1. Cloudflare Introduces Workflows V2 with Deterministic Execution and 50K Concurrent Workflows — InfoQ
  1. Run Workflows inside Dynamic Workers with the @cloudflare/dynamic-workflows library — Cloudflare Changelog
  1. Cloudflare Agents SDK documentation
  1. Sunil Pai Says AI Agents Are Waiting for Their React Moment — BigGo Finance
  1. Amazon Bedrock AgentCore adds quality evaluations and policy controls — AWS News Blog
  1. Amazon Bedrock AgentCore new optimization capabilities — AWS What's New
  1. Get to your first working agent in minutes: new features in Amazon Bedrock AgentCore — AWS
  1. AWS vs Azure vs GCP: Cloud Pricing Guide 2026 — Usage.ai

_Last updated: 2 August 2026._

Frequently asked

Quick answers.

01 What is the Cloudflare Agents SDK?
The Agents SDK is Cloudflare's developer library for building AI agents on its network. It maps each agent to a Durable Object with persistent SQLite storage, a stable name, WebSocket handling, and scheduled tasks. Cloudflare says it already powers thousands of production agents, and Project Think extends it with durable execution and sub-agents.
02 What are Durable Object Facets?
Facets, announced during Agents Week 2026, let a Dynamic Worker create Durable Objects that each hold their own isolated SQLite database. They power two patterns: giving every AI-generated app its own database, and creating sub-agents as child objects colocated with a parent, each with separate storage and execution context for clean isolation.
03 How is Dynamic Workflows different from Cloudflare Workflows?
Cloudflare Workflows is the durable execution engine, now running 50,000 concurrent instances. Dynamic Workflows is a library, released 1 May 2026, that lets the workflow code itself differ per tenant, agent, or request at runtime, instead of shipping fixed with your deployment. It suits agent-authored plans that need retries and approval gates.
04 Why do Durable Objects cost so little when idle?
An idle Durable Object hibernates: it evicts itself from memory and consumes zero compute until the next event wakes it. State persists because it lives in SQLite, not RAM. Cloudflare describes the marginal cost of a hibernated agent as effectively zero, which keeps large fleets of mostly-idle agents economically viable.
05 When should I not build agents on Cloudflare?
Avoid it when an agent needs sustained CPU or GPU compute for minutes, where a container or GPU instance is cheaper. Reconsider if your data and identity already live in AWS or Google Cloud, since the integration cost can exceed idle savings. Also note that Project Think is in preview, so its API may change.
06 How does Cloudflare compare with AWS Bedrock AgentCore?
Cloudflare gives one Durable Object per agent with built-in state and near-zero idle cost. AWS Bedrock AgentCore, with Policy and Evaluations generally available since March 2026, is the lower-friction choice when your data, IAM, and compliance already sit inside AWS. The decision usually follows your existing data gravity rather than raw features.
07 Is the Agents SDK production-ready in 2026?
The core Agents SDK is in production and, by Cloudflare's account, powers thousands of live agents. Project Think, the next edition adding fibers, sub-agents, and sandboxed execution, was previewed in April 2026 and remains in preview. A sound approach is to build on the stable SDK now and adopt Project Think primitives behind pinned versions.
08 What models can I run with the Agents SDK?
You can call models through Workers AI or route through AI Gateway, and you can bring your own model. Cloudflare's inference layer exposes models from 14 or more providers, including multimodal options. The code examples in Cloudflare's documentation use a Workers AI model binding, so a hosted open model is the fastest way to start.

About the author

Manu Shukla

Founder & Director

Founder of eCorpIT. Hands-on engineer leading senior-only delivery for AI apps, custom software, and cloud systems for global clients.

Subscribe

One engineering note a week. No fluff, no spam.

Senior-architect playbooks on AI agents, mobile apps, cloud, security, data, and marketing — delivered every Wednesday.

Past the reading

Read enough. Let's build something.

A senior architect responds in 24 working hours with scope, indicative cost, and a timeline. NDA before any technical conversation.