Use Workflows for multi-step application work that must survive waits, retries, and runtime restarts. A Workflow belongs to one Worker project, and Wrangler deploys its class and binding with the rest of that application.
Declare and run a Workflow
Add a Workflow binding to wrangler.jsonc:
{
"name": "approval-api",
"main": "src/index.js",
"compatibility_date": "2026-09-30",
"workflows": [
{
"binding": "APPROVAL",
"name": "document-approval",
"class_name": "DocumentApproval"
}
]
}Export the named class from the Worker module:
import { WorkflowEntrypoint } from "cloudflare:workers";
export class DocumentApproval extends WorkflowEntrypoint {
async run(event, step) {
const request = await step.do("validate", async () => event.payload);
const review = await step.waitForEvent("review", {
type: "decision",
timeout: "7 days",
});
return step.do("finish", async () => ({ ...request, ...review.payload }));
}
}Create an instance from the owning Worker with
env.APPROVAL.create({ params }). A caller can provide a stable instance ID for
idempotent application behavior or let the runtime generate one. Get a known
instance with env.APPROVAL.get(id), inspect status(), and deliver an external
event with sendEvent().
Deploy with the normal wrangler deploy command. Cross-Worker Workflow
bindings are not currently supported; expose an authenticated application API
or use a same-organization service binding when another Worker must initiate
the operation.
Inspect and operate instances
Open Compute → Workflows in the tenant console. The inventory identifies the owning Worker and deployed class. Select a Workflow to see recent instances, filter by lifecycle state, or open a specific instance.
The instance page shows its state, trigger, Worker version, timestamps, result, and error detail. Organization members with write access can pause, resume, terminate, restart, or delete an instance. URLs preserve the selected Workflow, instance, state filter, search, and table page.
Start runs and deliver application events through your Worker bindings or Wrangler’s standard Workflow commands. The console focuses on monitoring runs and managing their lifecycle.
Durability and retry boundary
Named steps persist their result. After recovery, completed steps replay their stored result instead of deliberately repeating the callback. Sleeping and external-event waits are durable and do not keep a process alive.
This does not make external side effects exactly once. A step can call a remote service immediately before a failure prevents its result from being committed. Use idempotency keys and retry-safe operations at that boundary.
The platform journal records instance identity, lifecycle state, Worker version, trigger, and stable terminal timestamps without retaining invocation parameters. The current runtime does not expose structured step logs, so the console does not manufacture them. Use organization-scoped logs and traces for runtime investigation.
Workflow state resides on the native Durable Object substrate. New compatible Workflow Workers use clustered storage by default; existing Workers retain their recorded placement until an operator selects that exact Worker for migration. The controlled migration preserves pending engine state and the Workflow’s exact actor in the shared lifecycle journal before activating the new placement. It does not move unrelated applications or journal actors.
The currently deployed cluster has one member. Workflow state survives Worker and runtime-process restarts, but is not replicated and does not provide automatic failover to another data host. See Durable Objects for the underlying placement boundary and Platform operations for the exact-target migration workflow.
Limits and usage
The platform atomically reserves a retained-instance holding before accepting a new run, then meters each initial execution and restart at the trusted Workflow provider. Listing and cleanup reconcile the retained count from the durable journal. Cleanup remains available if the quota service is temporarily unavailable; new growth fails closed.
Free organizations receive 100 retained instances and 10,000 executions per month. Standard receives 1,000 instances and 250,000 executions; Enterprise receives 5,000 and 2,000,000. Explicit support overrides take precedence. A lower limit never deletes instances—it blocks new runs while the organization remains above its allowance.
Use Management → Usage & limits → Workflows to see current holdings and period usage. Lifecycle operations emit organization-scoped logs and traces; the Workflow and instance identities are safe resource attributes, while input parameters remain application data and are not attached automatically.
Example
The workflow-approval example is an ordinary Wrangler application with a small browser interface. It starts persisted approval requests, leaves them waiting, and completes them through external approval or rejection events. Deploy it through your organization’s public API connection, then inspect the same instances in Compute → Workflows.