Durable beside Cloudflare Workflows
A platform's class persists each step and hibernates through waits. The idempotency and the rollback's coverage stay with you.
A platform's durable functions: Cloudflare Workflows
What it gives by its own documentation, what that leaves you to write, and the same work under Durable. Each product compared has a page like this one.
What Cloudflare Workflows gives, as its documentation describes
- 1
A class on the platform's workers
- it gives
- A Workflow's run method is a series of steps, each a self-contained part retried on its own. A step may emit state that is persisted, so the Workflow continues from that step after a failure, and a completed step's cached state keeps it from running again.
- you write
- Small steps with deterministic names, since a step's name is its cache key.
- 2
Steps may retry, code outside them repeats
- it gives
- Steps may retry, so the docs ask that they be idempotent and that a charge be checked before it is made; code outside a step can run more than once, and in-memory state is lost when the instance hibernates.
- you write
- The idempotency of each step's work, and state rebuilt only from step results.
- 3
Retries, then an errored instance
- it gives
- A step retries under a limit, a delay and a backoff, each attempt with its own timeout; a non-retryable error fails the instance at once, and exhausted retries leave it errored.
- you write
- The try and catch around a step whose failure the run should survive, and the clean-up steps the catch runs.
- 4
Rollback handlers, where registered
- it gives
- A step may register a rollback handler with its own retries and timeout; if the instance fails, registered handlers run in reverse step-start order, and a termination with rollback skips a step without one.
- you write
- A handler on every step that needs one, the check that none is missing, and the record of what each restored.
- 5
An instance id in use
- it gives
- Creating an instance with an id already in use throws until that instance's retention has passed; the second call does not return the existing instance.
- you write
- The id derived from the intent, and the catch that turns the throw into a join.
- 6
State for a retention window
- it gives
- A finished instance's state and logs are kept for days by plan, or less where you set a retention on the binding or the instance; the persisted record is what each step returns, capped in size.
- you write
- The image of your own data before a write, which no step result holds.
The same work under Durable
- 7
A library on your own database
- it does
- The engine runs inside your app's functions on the Postgres the app already has, with a minute cron as the one moving part outside the request path; the record is in your database, not the platform's.
- 8
The key joins, it does not throw
- it does
- key: ["orderId", "requestId"], a field list off the input that never reads the clock; a second trigger with the same intent joins the one run for the row's life.
- 9
The undo is required, not optional
- it does
- Every step that changes the world declares its undo with its effect or says why it cannot, and the door refuses one that says neither; when a later step fails the undos run in reverse, each a ledger row with what it found and what it restored.
- 10
Images never pruned, then limbo
- it does
- Every write leaves a before and after image on an append-only, hash-chained ledger; durable-sdk ledger verify --file <export> walks an export offline. After bounded redrives of a transient cause a failed run waits in limbo with its rows and the remedy; a redrive reads the world before it writes.
- 11
The agent asks the graph
- it does
- durable-sdk explain <workflow> prints what the door admits, every step with its undo and its writes, the facts and who listens; durable-sdk graph walk <subject> prints the closure from any node; durable-sdk graph impact --changed prints what a change reaches before it is made. Offline, over a committed index: an AI coding agent asks before it edits, never guesses.
- 12
Nothing to write but the steps
- it does
- No idempotency check inside a step, no catch around a duplicate id, no rollback coverage to audit; durable-sdk doctor --host runs every rule over the tree before a deploy.
- you write
- The steps and their undos.
When Cloudflare Workflows wins: steps on the platform's own workers next to its storage with nothing to install, instances by the thousand at the platform's rates, a rollback handler where you want one, and a Python entrypoint beside TypeScript. The walk in prose, with its sources.
The whole table, with every source, in Compared.
One charge, and a row that says so.
Two commands to an app with a ledger, and one that asks the graph what happens before you edit.