Developer Platform

What can you build with Workers?

For modern internet-facing apps, Cloudflare gives developers a focused, integrated set of primitives that compose globally by default — full-stack apps, AI agents, APIs, and real-time systems, all on the same network that already handles your security and delivery.

AI agentsStateful agents with tools, memory, scheduling, and Workers AI
Full-stack appsFrameworks, APIs, storage, auth, and deploys on one platform
Real-time systemsDurable Objects, WebSockets, coordination, and live shared state
Focused builder community Fast feedback loop Builders inform the roadmap
Start the story
Why this matters now

AI is changing how many apps get built.

Code is cheaper. App count goes up. The bottleneck moves from writing software to running it safely, globally, and without infrastructure glue.

The platform job changed

More apps More agents More integrations More bursty work

Absorb the spike. Give every app platform services. Scale to zero when the work disappears.

Code costDownmore prototypes and internal tools
App countUpmore routes, APIs, workers, agents
Runtime shapeBurstyshort-lived task-specific runs
Platform jobAbsorb itcompute + bindings + observability

Built for AI coding agents

Docs available as Markdown, llms.txt per product, and copy-paste setup prompts for Claude Code, Codex, Cursor, OpenCode, and more.

Agent setup ↗

More apps only helps if the runtime keeps up. Which parts of your stack are paying a global tax because they were built for a single region?

Runtime evolution · workerd · Node.js · Deno · V8

One runtime. Thousands of isolated apps.

Workers runs as V8 isolates across Cloudflare's global network. workerd — the open-source runtime behind Workers — lets one process host thousands of isolated apps with no per-app container to boot.

Why it matters

  • One process, many apps: workerd runs each Worker in its own V8 isolate inside a shared process. You get strong separation without starting a container for every app.
  • Global by default: code runs across 330+ Cloudflare PoPs, close to users — no region to pin.
  • Pay for what runs: no idle-instance cost. Billed on requests and CPU time consumed.
  • Security at the perimeter: auth, validation, and policy enforcement run where Cloudflare already processes traffic.

How a Worker runs

Your codeone fetch() handler: a request in, a response out
Web standard APIsfetch, Request / Response, Streams, Web Crypto
V8 isolateone per Worker · starts in milliseconds · no container
workerdthe open-source runtime (Apache 2.0), the same one wrangler dev runs on your laptop
Cloudflare networkdeploy once, it runs in 330+ cities
export default {
  async fetch(request, env, ctx) {
    // env = your bindings: KV, R2, D1, Durable Objects…
    return new Response("Hola from Barcelona");
  },
};

npx wrangler dev runs it locally on workerd · npx wrangler deploy sends it everywhere

Servers

One box, one app, operational ownership of OS, runtime, packages, and capacity.

↻
↻
↻
↻

VMs

Better isolation and scheduling, but each unit still carries a lot of runtime surface.

↻
↻
↻
↻
↻
↻
↻
↻
↻

Containers

Process-level isolation. Slow cold starts (500ms-10s). Heavy context switching overhead between customer workloads.

{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
{}
↻

Workers isolates

Lightweight execution contexts inside a shared V8 runtime. One process can run thousands of isolates with minimal per-request overhead.

Lightweight compute is the start, not the whole platform. The real leverage appears when storage, AI, media, and orchestration are native bindings.

One Worker, many bindings

Bindings are your platform building blocks.

Most clouds wire services together with SDKs, roles, networks, gateways, and secrets. Workers use bindings instead: pre-authorized capability handles injected into env before your code runs.

Cloudflare Worker Worker env.* injected
D1 · R2 · KV · Artifacts data, files, and repos
Durable Objects · Service Bindings state and internal calls
Workers AI · Vectorize · AI Gateway models and context
Images · Stream media pipelines
Queues · Workflows · Email background work
Analytics Engine metrics and telemetry
No auth plumbing No tokens to store, rotate, or leak.
No internet hop Calls resolve inside Cloudflare's network.
Runtime injection No SDK import just to access the resource.

Once the platform is available inside the Worker, the same model can host websites, APIs, tenant code, agents, storage-backed apps, and media workflows.

Full-stack web apps

Use the framework your team already knows.

Workers becomes the deployment target for modern web applications: server-rendered routes, APIs, static assets, and edge logic all living close to users.

Production web frameworks

Next.js Astro SvelteKit Nuxt React Router TanStack Start Angular Solid Start Vite Vue Hono vinext Static sites + And more View all ↗

Use the language that fits

All paths share the same V8 isolate model and Bindings API
JS / TS Native V8 Request handlers run directly in the Workers runtime — no separate server process, no translation layer.
JavaScript TypeScript
Python Pyodide on V8 CPython inside a V8 isolate via Pyodide. Deploy-time snapshotting cuts startup cost — no separate precompile step.
Pyodide V8 isolates Snapshotting
Adapters + Wasm Bring your stack Languages that compile to Wasm run inside the isolate. Framework adapters map onto the Workers Request/Response model.
Go C / C++ Next.js SvelteKit Nuxt
Rust Rust Workersbeta Write Workers in Rust with workers-rs, compiled to Wasm. Fuller Rust support is in beta.

Need a full server environment?

Cloudflare Containers · full Linux beside your Worker.
DockerLinuxFilesystemCustom runtimeContainers pricing ↗
Worker: the front door. Durable Object: the controller. Container: full Linux.
Cloudflare Containers: request flow Internet → Worker → Durable Object via getByName() → Container, proxied to your port. Inbound: only through your Worker. Outbound: internet on by default; block with enableInternet: false. CPU-heavy work, no GPU. Need a GPU? Use Workers AI. INTERNET INBOUND VIA WORKER · OUTBOUND INTERNET ON BY DEFAULT HTTP · fetch() WebSocket MCP · Scheduled stream · upload Worker JS app · isolate fast path: handles most requests directly ↩ .getByName(jobId) Durable Object lifecycle controller start · track · proxy one per job / session proxy → your port Container $ full Linux · Docker image custom runtime · any language native binaries filesystem access ffmpeg · pandoc · python CPU-heavy work · no GPU Need a GPU? → Workers AI
  1. Internet
  2. Worker↓ getByName(jobId)
  3. Durable ObjectLifecycle controller↓ proxy → your port
  4. Container · full LinuxCPU-heavy work · no GPU
Worker — Request Path
  • All traffic enters here first
  • Auth · routing · bindings · fast JS
  • Most requests never touch a container
Durable Object — Controller
  • Named, stateful Worker
  • Choose its name via getByName()
  • One DO · zero or one container at a time
  • Also powers Agents — see below ↓
Container — Linux Sidecar
  • Inbound: only through your Worker
  • Outbound: internet on by default
  • Block with enableInternet: false
  • Need a GPU? → Workers AI
One microVM per container
Security / isolation
Docker on one hostshared kernel
app Aapp Bapp C
ONE shared Linux kernel
  • ┆ software walls
  • namespaces · what it sees
  • cgroups · how much it uses
  • seccomp / capabilities · what it may do
One kernel bug → every container on the host is exposed
Cloudflare Containerskernel per container
microVMyour appYOUR kernel
microVMstranger's appTHEIR kernel
hypervisor: hardware wall
Your image: a Linux container inside the microVM.
Both layers.
A kernel bug stays inside that one VM
Docker container
  • shared kernel
  • ms start
  • weaker isolation
microVM
  • own kernel
  • minimal virtual hardware
  • fast boot
  • strong isolation
Classic VM
  • own kernel
  • full virtual PC
  • slow boot
  • strong isolation
Why it matters:safe for agent-written or user-uploaded code.
From stopped to serving
Lifecycle
  1. STOPPED$0
  2. STARTINGcold start ~1–3 s
  3. RUNNING,
    NOT READY
    wait on a health check
  4. READYserving
  5. idle past timeoutSTOPPED
Disk wiped on stopEach start: a fresh copy of the image.
Keep state inDurable Object storagesnapshots (beta)an R2 mount
What stops itidle timeout · signal()/destroy()new deploy · app exitsmaintenance (SIGTERM first)
LocationMay not run next to its Durable Object or the user.Stays put while running → can move on restart.
Choose a name. Choose a copy.
Scaling & identity
Per user / job
getByName("user-42")DOuser-42
getByName("user-43")DOuser-43
Same image · each gets its own copy
Pool
getByName(`pool-${random}`)
DO → DO → DO →
One of N identical containers
No built-in autoscaling yet (planned).You scale by choosing names.
Names come from a verified login.Never from raw user input.
Three names / where they live
MY_CONTAINERbinding→ wrangler.jsonc
"user-42"instance→ Worker code · chosen per request
images.baseimage→ wrangler.jsonc
Picked by the Durable Object at start()
Size the work
vCPU / memory / disk
SizevCPUMemoryDisk
litedefault1/16256 MiB2 GB
basic1/41 GiB4 GB
standard-11/24 GiB8 GB
standard-216 GiB12 GB
standard-328 GiB16 GB
standard-4412 GiB20 GB
  • Custom sizes allowed
  • Chosen in code at start()
  • Default limits: account team can raise them
More vCPU only helps if your app runs in parallel.Node worker_threads · Python multiprocessing
What you pay for
Containers pricing ↗

Billed every 10ms while awake. CPU only when used; memory and disk by instance size.

Handling a request
  • CPU pay for use
  • Memory + disk pay
Awake, no requests
  • CPU ~$0 if nothing runs
  • Memory + disk pay
until the sleep timeout
Asleep
  • CPU $0
  • Memory + disk $0
scales to zero
  • CPU 375 vCPU-min/mo
  • Memory 25 GiB-h/mo
  • Disk 200 GB-h/mo
  • Egress 1 TB/mo NA & EU

Also billed: the Worker in front and each container's Durable Object. Tip: instance size sets the idle cost; the sleep timeout sets how long you pay it.

Images
  • Dockerfile built by wrangler deploy
  • Or push an existing image to the Cloudflare registry first
Bindings & ops
  • Access KV, D1, R2, Queues via hostname
  • Data residency: set jurisdiction on the Durable Object namespace (EU / US / FedRAMP).
  • SSH via Wrangler (needs ssh + authorized_keys in config)
  • Workers Paid plan
  • linux/amd64 images
  • Docker running locally to deploy
  • Durable-Object-controlled setup is public beta
  • First deploy: a few minutes to provision

Ship the same way you build

Deployment lifecycle — local workerd, branch Previews, production. Workers Builds or your own CI.

Where things run

Tooling
Your laptop / CI runner · Node.js
C3WranglerVite
wrangler dev / wrangler preview / wrangler deploy
Your code
workerd · the Workers runtime
Miniflare (local)Cloudflare network (production)

Node.js runs the tools. Your Worker always runs on workerd.

Node.js + npm (Current, Active, or Maintenance releases) · macOS 13.5+, Windows 11, Linux glibc 2.35+

Scaffold, bind, and iterate locally. Then ship a branch Preview or production deploy.

Install the tooling

Wrangler and C3 are Node.js CLIs. Install Wrangler in your project and check its version.

Install + check
npm i -D wrangler@latest
npx wrangler --version

Where config lives

wrangler.jsoncPer Worker: entrypoint, bindings, routes, variables, and the previews block.
Cloudflare Terraform providerAccount resources as code: Workers, KV, D1, R2, routes, and secrets — declarative and version-controlled.

Shipping is half the job. Once it's live, you need to see what it's doing.

Run it in production

See every request. Find what broke.

Workers Observability collects logs, traces and metrics for your Workers automatically — turn it on once, and every request, binding call and error shows up in the dashboard. No agents to install, no SDK to wire up.

Logs
Workers Logs

Best for: troubleshooting

Collected, stored logs you can filter and query. Query Builder adds filters, aggregations and group-bys to find the request that went wrong.

Request journey
Traces

Best for: “why is this slow?”

An end-to-end request view. Automatic instrumentation covers fetch calls, binding calls (KV, R2, Durable Objects), RPC and handlers — no code changes or SDK.

Recurring failures
Issues

Best for: on-call

Detects and groups recurring failures. Automations can send an issue to a coding agent, webhook, chat service or incident-management tool.

OpenTelemetry
Bring your stack

Best for: teams with existing tools

Export logs and traces through OpenTelemetry to supported destinations. Use Logpush or Tail Workers for custom pipelines.

Turn it on in wrangler.jsonc
{
  "observability": {
    "enabled": true,
    "head_sampling_rate": 1 // 1 = 100% of requests
  }
}
Built-in Worker metrics
requestserrorsCPU timewall timeduration
Metrics and analytics docs ↗

Sampling is a dial, not a failure mode — see how Analytics Engine uses it ↓

Observability is a platform feature, not a binding. Logs and traces have separate settings; enable traces in the dashboard when you need the request journey. The live demo below has logs enabled, not traces.

Now you can see what your code is doing. The data it reads and writes still needs a home: keys, rows, files, vectors, metrics, or the database you already run.

Storage

Pick the storage shape that fits the workload.

Each storage primitive is a Worker binding: declare it once, use it from env — no API keys, no connection plumbing. Pick the shape that matches your data.

Key/value
KV

Best for: config, flags, sessions, cached data

Globally replicated reads close to users. Eventually consistent — great for reads, not for counters or carts.

env.KV.get(key)
SQLEU · US
D1

Best for: relational app data

Serverless SQLite with transactions, migrations, backups, and read replicas — no database server to run.

env.DB.prepare(sql)
ObjectsEU · US
R2

Best for: media, backups, datasets

S3-compatible object storage with no R2 egress charges.

env.BUCKET.put(key, body)
Versioned filesEU · US
Artifacts OPEN BETA

Best for: code, agent sessions, versioned file trees

Git-compatible repos at scale — fork, diff, and hand off to any Git tool.

env.ARTIFACTS.create("agent-007")
Vector DB
Vectorize

Best for: semantic search, RAG context

Vector indexes for embeddings, retrieval, and recommendations.

env.VECTOR_INDEX.query(embedding)
Bring your DB
Hyperdrive

Best for: your existing Postgres/MySQL

Keep your database, gain edge speed — warm pooled connections and query caching, no migration.

env.HYPERDRIVE.connectionString
Per-key stateEU · US
Durable Objects

Best for: live shared state per user, room, or tenant

One named object per key, with its own code, storage, and connections.

env.ROOMS.get(id)
Not sure which?

What are you storing?

Click again or press Esc to reset.

Pin data to a jurisdiction — D1, R2, Durable Objects, and Artifacts support EU and US. Data localization docs ↗

Analytics Engine: write an event, read with SQL

Your own usage metrics, not Worker logs or AI Gateway analytics.

Why it's different

Sampling by design, not as a last resort.

Per-user or per-tenant metrics make most time-series databases slow or expensive. Analytics Engine samples by design: unbounded cardinality at a low, predictable price.

Tenant usage: sampling comparison Illustrative relative usage for 20 tenants, scaled for comparison. All events shows the full distribution. Random 1% loses the small tenants. Equitable sampling keeps a very similar picture, not exact accuracy; the docs example stores less than 10% of the data.
100% storedBig tenants fine. Small tenants vanish.Very similar picture, <10% of the data stored.
How it works
  1. Write time

    Sampling is per index value: busy ones are sampled harder, rare ones may keep every point. Pick the index you'll query by (tenant ID, hostname).

  2. Read time

    Data is kept at several resolutions (e.g. 100% / 10% / 1%). Longer time ranges read a coarser one, so every query fits a fixed query budget. That's why you weight by _sample_interval ↓

Great for
  • Per-tenant usage & cost attribution
  • Feature adoption by segment
  • High-cardinality performance metrics
Not for
  • Exact counts or billing (use D1 / Durable Objects)
  • Exact event sequences or single-record lookups
  • JOINs, or retention beyond 3 months
  • A UUID as the index (slows aggregations)

Keep the signal, not every byte. Same idea as Observability's head_sampling_rate ↑

Write from your Worker
// Write: one data point per request
env.METRICS.writeDataPoint({
  indexes: [tenantId],              // 1 index, used for sampling
  blobs:   [route, country, model], // up to 20 text dimensions
  doubles: [latencyMs, tokens],     // up to 20 numbers
});
Read with SQL
SELECT blob1 AS route,
       SUM(_sample_interval) AS requests,
       SUM(_sample_interval * double1) / SUM(_sample_interval) AS avg_ms
FROM metrics
WHERE timestamp > NOW() - INTERVAL '1' HOUR
GROUP BY route ORDER BY requests DESC

Read with SQL: the SQL API, Grafana, or the Analytics SQL binding (beta). The query weights sampled data with _sample_interval.

Binding in wrangler.jsonc
"analytics_engine_datasets": [{ "binding": "METRICS", "dataset": "metrics" }]

Data is retained for 3 months. Workers Paid includes 10M points written and 1M read queries per month. Usage is currently not billed ↗.

Your code runs in 330+ cities. Your database lives in one. So what happens when users around the world need to read and write the same state — the same room, cart, or document?

Stateful compute

Stateless by design. Stateful by name.

A Worker runs everywhere — thousands of copies, no shared memory — so two requests can't reliably coordinate through it. A Durable Object is the shared place they meet: an instance of a JavaScript class you write, reached by name, with at most one live instance worldwide, single-threaded, and its own private SQLite.

But there's a catch…

Stateless Workers in 330+ cities · your database in one region

✗ = no database next to each Worker: you can't run one (and keep it in sync) in 330+ cities

Stateless Workers and a database in one region Phones reach Workers in São Paulo, London, Barcelona, Dubai, and Singapore. A crossed-out database beside each Worker shows that there is no database next to each one. Dashed lines and animated dots travel from every Worker to one database in one region, with illustrative latency of 40 to 150 milliseconds each way. Every request opens a connection, performs TLS and login, and runs the query. An illustrative 180 millisecond timeline shows 10 milliseconds from phone to Worker, 120 milliseconds reconnecting, 40 milliseconds querying, and 10 milliseconds back to the phone. The database trip takes about 90 percent of the total. Worker ✗ São Paulo London Barcelona Dubai Singapore ~40–150 ms each way Stateless: no connection is kept,so each request reconnects,far away. Database one region EVERY REQUEST, FROM SCRATCH: ① open a connection② TLS + log in③ run the query ONE REQUEST · ILLUSTRATIVE TIMELINE the trip to the database ~160 ms phone → Worker~10 ms reconnect: TCP + TLS + log in · ~120 ms query · ~40 ms Worker → phone~10 ms ~180 ms in total: the edge saved milliseconds, the database trip took ~90% of it.

Hyperdrive keeps those connections warm for an existing database (see Storage). For state that belongs to one room, user, or document, a Durable Object puts the database inside.

All traffic for one name → one Durable Object

All traffic for one name reaches one Durable Object Workers in Barcelona, Madrid, Paris, and London send msg and join requests through getByName into one queue for the vip-lounge Durable Object. It has one V8 isolate in one location. Its JavaScript event loop handles one request at a time, with input gates stopping concurrent requests from racing. SQLite lives inside the object on the same thread, with no network hop, and stores messages and settings. WebSockets and Alarms are also built in. REQUESTS FROM ANY WORKER WorkerBarcelona WorkerMadrid WorkerParis WorkerLondon getByName() queue join vip-lounge · DURABLE OBJECT ONE V8 ISOLATE · ONE LOCATION 2 JS event loop one at a time same thread no network 3 SQLite messages · settings ④ WebSockets ⑤ Alarms also built in · more below msg join msg join 1
① One nameevery Worker reaches the same object via getByName()
② JS event loopsingle-threaded; input gates stop concurrent requests from racing
③ SQLitelives inside the object — storage calls skip the network
④ WebSockets · ⑤ Alarmsalso built in, below

Scale by adding objects, not by growing one — one per room, user, or tenant. Need one shared relational database instead? That's D1.

What named state unlocks
WebSockets + Hibernation The connection stays open while your code hibernates Three phones have green connections to a WebSocket TCP connection held by Cloudflare. A dotted divider separates the held connection from a faded, sleeping code box that wakes per message. Code is billed only while handling a message. WebSocket (TCP) held by Cloudflare your codeZz · wakes per message billed only whilehandling a message Cloudflare holds the connection; your code hibernates between messages. Create as many objects as you want — idle, hibernated objects accrue no duration charges. Up to 32,768 connections per object.

Incoming messages bill as requests at 20:1; storage is billed separately.

acceptWebSocket() Hibernation API auto ping/pong unlimited objects
Durable Object Storage Private SQLite: SQL, KV, transactions, PITR. Each object is created on first access, has a soft limit of ~1,000 req/s, and gets up to 10 GB on Workers Paid (1 GB on Free) — about 20M chat messages at ~500 bytes each.
SQL KV transactions PITR
Alarms

Alarms wake a room later without keeping it alive: expire sessions, flush batches, run cleanup, or schedule the next task.

Retention alarms delete/archive old messages.

scheduled wake cleanup retention alarm

Asleep isn't free

ACTIVEcompute + storage
HIBERNATINGstorage only
deleteAll()$0
  • Idle objects that can hibernate aren't billed for compute time. Stored data still is: $0.20/GB-month beyond the 5 GB-month included on Workers Paid.
  • Storage bills until you delete it. deleteAll() is the only way to bring an object to zero, including the small internal metadata every write leaves.
  • Tip: when an event or session ends, archive to R2 (about 13× cheaper per GB-month), then call deleteAll().
await env.ARCHIVE.put(`events/${id}.json`, JSON.stringify(data)); // R2
await this.ctx.storage.deleteAll();

With state and storage available as bindings, code can become more than a request handler. Agents add memory, tools, and safe boundaries on top.

Agents that scale

Build, Govern & Secure Agents

Every agent is a Durable Object: a unique name, one request at a time, storage that survives hibernation. Agents SDK wraps that into a typed agent class. Sandbox (Linux container) and Browser Run extend the tool surface without widening your Worker's trust boundary.

A Worker handles the event. A Durable Object gives the agent identity. Capabilities stay behind explicit boundaries.

Agent runtime architecture Events on the left — fetch HTTP, WebSocket, MCP, Scheduled — animate as packets into a central Worker isolate circle. The Worker looks up a named Durable Object via env.NS.getByName(name). The object contains the Agents SDK with SQLite state. Five capability spokes fan right: AI Gateway and Workers AI, Sandbox SDK, Browser Run, Dynamic Workers for agent-written code, and Workflows. EVENTS CAPABILITIES fetch() · HTTP WebSocket MCP Scheduled Worker isolate getByName(name) Durable Object Agents SDK SQLite state WebSocket · Alarms AI Gateway · Workers AI env.AI.run() Sandbox SDK sandbox.exec() Dynamic Workers agent-written code Browser Run env.BROWSER.quickAction() Workflows durable steps
Runtime

Events execute in V8 isolates. Events arrive via fetch(), WebSocket, MCP, or schedule. Services injected as env.* — no shared state.

Identity + State

One Durable Object per session. Same address, same memory, every call.

Capabilities

AI Gateway · Workers AI · Sandbox SDK · Browser Run · Dynamic Workers — each behind an explicit dispatch boundary. Tool code runs outside the agent’s own execution boundary.

Workspace per session

Give each agent session its own Artifacts repo or branch — fork from a shared baseline, explore in parallel, compare or merge the results.

ANATOMY OF AN AGENT

From pull to push: agents don't wait to be asked.

Every agent on Cloudflare is a Durable Object with a durable identity, its own SQL storage, real-time connections, scheduled work and recoverable execution. Here's what's inside. Agents SDK docs →

Anatomy of an agent Follow one request: Channels deliver an event; Runtime wakes the Durable Object; the Harness runs Think, Act, Observe clockwise; Tools choose an action; Safety constrains access, approves consequences and records outcomes; Payments handles a paid API's 402 challenge; the result returns. Each region opens its details. The six buttons below provide the same controls. events in result returns

Follow one request: event → wake → think → act. Click any part to open it.

Flue · open-source agent framework

Prefer a framework? Write one function, get a durable agent.

Flue is an open-source TypeScript framework from the Astro team, now at Cloudflare: you write one function, it provides the Pi agent loop and a durable runtime.

Your agent function

'use agent';
import { useModel, useTool } from '@flue/runtime';

export function SupportAgent() {
  useModel('anthropic/claude-sonnet-4-6');
  useTool(searchDocs);
  return 'Answer customers using the docs.';
}

vite build && wrangler deploy
Or use Workers AI models with no API keys.

Mount explicitly in app.ts:createAgentRouter(SupportAgent)at /agents/support, then call
POST /agents/support/:id

Where it lives · on Cloudflare
Your function inside Flue, inside the Cloudflare runtime Nested boundaries, from outside in: Worker handles routing and bindings. Each agent is a Durable Object with SQLite and alarms; the use agent directive produces the Durable Object class. Agents SDK provides fibers, scheduling and state. Highlighted Flue provides the Pi agent loop, sessions, recovery and channels. Your function sits inside Flue and uses hooks such as useModel and useTool. These are layers, not a traffic flow. Worker Durable Object Agents SDK Flue routing · bindings one per agent · SQLite · alarms fibers · scheduling · state 'use agent' agent loop (Pi) · sessionsrecovery · channels Your function useModel · useTool
Agent Hooks · Flue 2.0 · 8 of 16
useModeluseTooluseSkilluseSubagentuseSandboxuseMcpConnectionusePersistentStateuseAgentStart

Agents SDK directly

Your agent logic

You build

  • Loop
  • Sessions
  • Recovery
  • Channels

Full control: custom or non-standard designs

With Flue

One function

Flue provides

  • Loop
  • Sessions
  • Recovery
  • Channels

Standard agent, fast: typed hooks, portable, ready-made channels

  • Durable by defaultSQLite · safe recovery on fibers
  • SandboxIn-memory default / Linux container
  • TracingWorkers Traces spans · open beta
  • ConnectMCP · Slack, Teams, WhatsApp, GitHub…

Linux option: Cloudflare Sandbox — outbound Workers inject secrets. Recovery replays work only when provably safe.

Runs on
Cloudflare · each agent = a Durable ObjectNode.jsAWS · containersmore
Apache-2.0 · open source

Agents run your code. Workers for Platforms turns the runtime into a product — your customers deploy their own isolated Workers through your API.

Workers for Platforms

Built for Platforms

"When your product is other people's apps." Workers for Platforms lets you expose the Workers runtime as a programmable execution layer — your customers deploy isolated Workers through your API, you control the boundaries.

Builder App & vibe-coding builders Ship customer Workers from an AI-powered IDE — no infra for the builder to manage
Sites Website builders Every site gets its own isolated Worker for edge logic, redirects, and content transforms
Commerce E-commerce extensibility Merchant-written checkout hooks, discount rules, and custom storefront Workers
Plugins Plugin & automation platforms Customer automation scripts, webhook handlers, and integration Workers

In production: Shopify Oxygen (storefront hosting) runs on Workers for Platforms dynamic dispatch. Shopify Engineering ↗

Two kinds of developers

The platform developer owns the Dispatch Worker, uploads customer code through the Cloudflare API, and chooses the bindings, limits, and outbound rules. The end customer writes Worker code and can use only the bindings attached by the platform.

Full control

Platform developer

A website builder company, for example.

  • Owns the Dispatch Worker and upload API
  • Chooses each customer's bindings
  • Sets limits and outbound rules
Gets what's granted

End customer

Writes their Worker code on your platform.

env.DB
env.USER_KV
Only if attached by the platform.
Your customers write the code. You decide what it can touch.

Three primitives, one dispatch model: your Dispatch Worker receives requests → calls env.DISPATCHER.get(workerName) to resolve a User Worker by name → proxies into an isolated V8 isolate containing only the code and bindings you granted.

Workers for Platforms dispatch namespace architecture An HTTP request flows left to right into the Dispatch Worker labelled Your Platform. The Dispatch Worker calls env.DISPATCHER.get(workerName) then userWorker.fetch(request) to route to one of three User Workers inside a Dispatch Namespace named production: client-a-worker, client-b-worker, and client-c-worker. Each User Worker has a green left bar and runs customer code in an isolated V8 isolate with only explicitly granted bindings. Orange packet dots animate along three bezier paths from the Dispatch Worker into each User Worker. REQUEST YOUR PLATFORM DISPATCH NAMESPACE: production HTTP request any route DISPATCH WORKER Your Platform env.DISPATCHER .get(workerName) .fetch(request) client-a-worker isolated V8 isolate · customer code · only granted bindings client-b-worker isolated V8 isolate · customer code · only granted bindings client-c-worker isolated V8 isolate · customer code · only granted bindings

Isolation by default

Three User Workers, client-a, client-b, and client-c, each connect only to their own D1 and KV resources. Crossed-out dashed lines deny cross-tenant access. Outbound fetch calls pass through the platform's Outbound Worker to allow, block, log, or add authentication headers.

User Worker

client-a

Own D1 · own KV
User Worker

client-b

Own D1 · own KV
User Worker

client-c

Own D1 · own KV

✕ No cross-tenant access

All User Workers

Outbound Worker

Outbound fetch()

Allow · block · log · add auth headers

Only explicitly attached bindings are visible

Untrusted mode (default): no shared cache, even on the same zone

For full isolation: one resource per customerBest practice: all customers in one dispatch namespace

Every tenant sees only what you granted.
Under the hood

See how it actually works — bindings, routing, controls, dispatch steps

How bindings reach customer code

Attach at upload. Pass data and capabilities per request.

Bindings attached at upload

Customer code in worker.js goes to the platform backend. The platform calls the Upload User Worker API with metadata.bindings containing a KV namespace and D1 database. The deployed User Worker in the production dispatch namespace receives USER_KV and DB across every request. keep_bindings preserves existing binding types when more are added.

Customer code
worker.js
Platform backend

Upload User Worker API

"bindings": [
  { "type": "kv_namespace",
    "name": "USER_KV",
    "namespace_id": "…" },
  { "type": "d1", "name": "DB",
    "database_id": "…" }
]
dispatch namespace: production

User Worker

USER_KVDB
env.USER_KV.get("key")

Bindings persist across every request

Add more later — keep_bindings keeps existing binding types"keep_bindings": ["kv_namespace"]

Via the API, bindings go in metadata.bindings — not a Wrangler config file

KVR2D1Durable ObjectsQueuesContainers (as a Durable Object)HyperdriveVPCAnalytics Engine
Attach bindings when you deploy each customer's Worker.

Per-request data and capabilities

A request reaches the platform Dispatch Worker, which authenticates and passes props in the second argument to env.DISPATCHER.get. Readable user data and a sealed CONNECTOR capability reach the User Worker. Customer code reads this.ctx.props.userId and calls this.ctx.props.CONNECTOR.invoke, a method defined by the platform. The call goes back to the Dispatch Worker, where credentials remain, and a result returns. The capability is valid only for this request.

Request arrives
Platform

Dispatch Worker

Authenticates the request

env.DISPATCHER.get("customer-a", {
  props: { ... }
})

Real credentials stay here

Data userId: user-123,
permissions: [read, write]
Data — customer code can read it
CONNECTOR Capability — customer code can call methods, can't see the secrets
customer-a

User Worker

this.ctx.props.userId
await this.ctx.props.CONNECTOR.invoke()
invoke() · your method
Capability call returns to the Dispatch Worker The upper dashed arrow points left from the User Worker to the Dispatch Worker, where the platform's invoke method uses the real credentials. The lower arrow points right, returning the result to the User Worker. Capability call · credentials stay in Dispatch Worker Result returns to User Worker

↑ CONNECTOR.invoke() calls back to the Dispatch Worker. Credentials stay there.

↓ Result returns to the User Worker.

Valid only for this request — can't be stored and reused later.

Change what a customer can do per request — no redeploy.

What 'Add a database' looks like in practice

example flow

Four steps: the customer clicks Add database in the platform UI; the platform creates a D1 database through the Cloudflare API; the platform re-uploads the customer's Worker with a DB binding and uses keep_bindings for existing binding types; customer code can then call env.DB.prepare. This is an illustrative product flow, not an end-to-end documentation example.

  1. 1

    Customer clicks “Add database”

    In your platform's UI

  2. 2

    Platform creates a D1 database

    Via the Cloudflare API

  3. 3

    Platform re-uploads the customer's Worker

    Attach DB; preserve existing binding types with keep_bindings

  4. 4

    Customer code can use DB

    env.DB.prepare("SELECT ...")
End customers 'configure' bindings through your product — you stay in control.
Dispatch routing

How requests find the right User Worker — path · subdomain · KV lookup · custom metadata

  • Path: extract a tenant key from the URL — /api/:name → DISPATCHER.get(name)
  • Subdomain: parse the Host header — client-a.yourplatform.com → client-a-worker
  • KV lookup: resolve worker name dynamically — await KV.get(tenantId) → workerName
  • Custom metadata: attach plan, tier, or flags at deploy time — worker.userMetadata.plan === "pro"
Platform controls

Limits and observability for every User Worker

  • Custom limits: cap CPU time and subrequests per User Worker — one noisy tenant cannot degrade others in the Dispatch Namespace
  • Observability: executions tagged to your Dispatch Worker — route traces and logs through your own pipeline
How it works

How dispatch works in three steps

  1. 1
    Bind the Dispatch Namespace Declare it in wrangler.jsonc — the runtime injects it as env.DISPATCHER, a typed handle to every User Worker in your namespace. { "dispatch_namespaces": [ { "binding": "DISPATCHER", "namespace": "my-platform" } ] }
  2. 2
    Choose the User Worker name Derive workerName from the request — URL path, hostname, a KV lookup, or metadata attached to the worker at deploy time.
  3. 3
    Forward the request Resolve the named User Worker and proxy the request into its isolated V8 isolate. It receives only the bindings your platform granted it. const userWorker = env.DISPATCHER.get(workerName); return userWorker.fetch(request);

User Workers are deployed programmatically via the Cloudflare API — no Wrangler required on the customer side.

Pairs well with
Artifacts

Store customer code in Artifacts and build/deploy it as User Workers on push.

Dynamic Workers ↑

The lowest-level primitive for running user or AI code — load it into an isolate at runtime.

Dynamic Workflows

Regular Workflows can't be deployed to dispatch namespaces. Run per-tenant or AI-generated workflow code durably via Dynamic Workers.

Not every workload starts as a full-stack app. Many start as an API — new, or one you already run.

APIs and backends

Start with one route. Let the momentum build.

Write a new API, or put a Worker in front of the one you already have — then grow from there. Either way it runs behind Cloudflare's security, connects to your data and private networks, and is observable from day one. Pick your starting point below.

Protect

Before your code runs

Client

Cloudflare network

WAFBot managementDDoS

Already in the request path.

Build

Worker

Start with one fetch(). Add Hono when routes multiply. Use Python where your team or libraries live.

export default {
  async fetch(request, env) {
    return Response.json({ ok: true });
  },
};

Webhooks, auth checks, redirects, small APIs.

Connect

Your data and services

Cloudflare storage

env.DB / env.KV / env.BUCKET
Bindings

Other Workers

Service bindings — typed RPC, no public URL

Existing databases

Hyperdrive (Postgres/MySQL)

Private APIs

BETA

Workers VPC — AWS, Azure, GCP, on-prem via Cloudflare Tunnel.

Observe
Workers Logs

Collect, filter, query in the dashboard.

Real-time logs

npx wrangler tail

Traces ↗EARLY BETA

Automatic, no SDK — enable it in wrangler config; OpenTelemetry export (Honeycomb, Grafana Cloud, Axiom)

Logpush

Export to supported destinations (Workers Paid).

Rate Limiting binding: approximate and per Cloudflare location — for one strict global limit, use a Durable Object.

Workers VPC is in beta and free on all Workers plans during beta.

Put it together — compute, AI, storage, media, network, orchestration. This is what changes when "serverless" becomes "platform".

The bigger picture

Workers is not just a serverless function. It is the platform.

Compute is the start, not the product. The product is what you can compose around it — inference next to data, retrieval next to context, state next to coordination, the CDN and WAF already in the request path. That is the platform Workers ships.

And there's more

  • Stream: Upload once; Cloudflare handles encoding, storage, and global delivery for live and on-demand video.
  • Images: Transform images at request time — resize, crop, optimize, and serve the right format from the edge.
  • Pipelines: ETL for raw event streams — turn them into clean analytics data in R2, without running Kafka, Flink, or custom ingestion workers.
  • AI Search: Add search that understands meaning, not just keywords, with embeddings, vector similarity, and hybrid ranking.
  • Queues: Absorb traffic spikes, decouple slow work, and process background jobs reliably behind your Worker.
The foundation

Cloudflare global network sits in front of every Worker

CDN · DDoS · WAF · Bot management · Smart Routing · Tiered Cache · Zero Trust · Access & more

Request path through Cloudflare global network to Worker An incoming request enters Cloudflare's global network, which applies CDN across 330-plus cities, DDoS protection, WAF with OWASP rules, Bot management, Smart Routing via Argo, Tiered Cache, and Zero Trust Access controls — and more — before the request reaches the Worker. Incoming request CLOUDFLARE GLOBAL NETWORK CDN · 330+ cities DDoS protection WAF · OWASP rules Bot management Smart Routing · Argo Tiered Cache Zero Trust · Access + more Worker isolate

Every request reaches your Worker through Cloudflare's network first — global delivery, security, routing, caching, and access controls already in the path.

10+ million developers building on the Cloudflare Developer Platform
Developer platform adoption growth Exponential growth chart from Workers launch in 2017 to over 10 million developers by 2026. Milestones: 1M by 2020, 3M by 2022, 5.5M by 2023, 10M plus by 2026. 0 2M 5M 10M+ Launch 1M+ 3M+ 5.5M 10M+ 2017 2020 2022 2023 2026
330+cities worldwide
500K+companies on the platform
2017when Workers first shipped

Focused builder community · Close product feedback loop · Faster collaborative adoption

Where Cloudflare fits

Broad general-purpose clouds cover every workload. Cloudflare is a focused platform, global by default.

Broad general-purpose cloud
Security and runtime as separate services
Full AI range, from training to inference
Region-first deployment
Per-service SDKs and IAM
Broad ecosystem across every workload
Cloudflare — focused, global by default
Security + runtime, one layer
Production AI path — global, provider-flexible
Global by default — 330+ cities
Primitives via bindings, not SDKs
Builder feedback → roadmap
Cost & scalability

Scale up and down to zero.

Pay nothing when idle. No provisioned VMs or containers — billing starts when requests arrive, stops when they don't. Billed on CPU time, not wall-clock — no charge while a Worker waits on I/O.

Performance

Deploy from region: Earth.

Deploy once, run in 330+ cities. Within 50 ms of ~95% of internet users. Smart Placement keeps compute next to data.

Developer experience

All the products you need.

Inference, state, storage, queues, observability — all as bindings. No infrastructure to provision. Just develop.

Inference, state, storage, media, queues, deployment, observability —

all the products you need·without provisioning any infrastructure.

So developers can focus on what they enjoy most: develop!

See it live

The build patterns become real demos.

Note: these demos need to be run at together and on RNobre Cloudflare account.

The categories above explain what you can build. These demos show the same platform primitives in motion: media, agents, real-time state, retrieval, queues, AI, and multi-cloud ingress.

Cloudflare OS · Primitive Explorer

An open-source AI-native workspace, decomposed into the Developer Platform primitives underneath: model choice, agents, durable state, governed tools, isolated execution, and AI observability.

Cloudflare OSWorkers AIAgents SDKDynamic WorkersAI Gateway

Stream · Access Control

Three videos, three postures: public, origin-restricted, signed-URL gated. Signed video uses the Stream binding to mint short-lived JWTs server-side.

StreamWorkers bindingJWT

AI Agents · Zero Trust

One Agent, one MCP Server Portal, three MCP servers behind Access. Tools discovered at runtime; every call crosses a real Zero-Trust boundary. Workers AI generates images; D1 / R2 / KV store results.

Agents SDKMCP PortalAccessAI Gateway

Agent Council · Durable debate

Four persistent Agents challenge a decision from distinct perspectives, then a rotating proposer synthesizes the trade-offs for a vote. Durable Objects coordinate each council while AI Gateway routes model calls and D1 preserves the transcript.

Agents SDKDurable ObjectsAI GatewayD1

Agent Guardrails · governed execution

An Orchestrator delegates to Worker agents with separate Workspaces, read-only R2 policy data, fetch-tool allowlists, and Workers AI through AI Gateway. The Audit trail shows what the agent can touch — and where the Guardrail stops it.

Durable ObjectsWorkspacesR2AI Gateway
View slides

RAG on the edge

Docs into R2 → Queue → Workflow → Workers AI embeds → vectors in Vectorize. At chat time, query vector + top matches stitched into the LLM prompt. Six bindings, one Worker.

Workers AIVectorizeR2QueuesWorkflows
View slides

Edge ingress · multi-cloud

Cloudflare edge validates and normalises events, pushes clean payloads into a Queue. A GCP Cloud Run backend pulls via HTTP and acks. Bot mitigation, queueing, and AI visibility in one path via AI Gateway.

QueuesAI GatewayWorkersMulti-cloud

Workflows · durable execution

A 9-step space mission: SWAPI fetch → AI analysis → AI risk assessment → human-in-the-loop pause → AI report → KV archive. Arm a mid-flight "bomb" to fail a step — previous outputs stay preserved, retry recovers without re-running the AI calls.

WorkflowsWorkers AIKVstep.waitForEvent

Containers · custom runtimes

Interactive tutorial showing how Containers extend Workers with custom runtimes. Live ISS tracker with 3D globe, lifecycle management, and scaling models (singleton vs load-balanced). Built on Durable Objects — each container is a DO with location affinity and state.

ContainersDurable ObjectsNode.jsLifecycle

Live Rooms · real-time event chat

Scan a QR code and chat live at a fictional MWC: one Durable Object per Room, a General room sharded across 4 DOs with one message order, a VIP Lounge that refuses non-VIP badges itself, and an @assistant Agent that reads live room state through AI Gateway.

Durable ObjectsWebSocketsAgents SDKAI GatewayWorkers AI