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.
The shape: a platform's durable functions. Why Durable steps this walk beat by beat; this page is the walk in prose, with the page each beat reads under Sources, and Compared is the table of every product.
What Cloudflare Workflows gives, as its documentation describes#
A class on the platform's workers. 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. [1]
Steps may retry, code outside them repeats. 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. [1]
Retries, then an errored instance. 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. [2]
Rollback handlers, where registered. 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. [3]
An instance id in use. 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. [3]
State for a retention window. 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. [4]
The same work under Durable#
A library on your own database. 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.
The key joins, it does not throw. 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.
The undo is required, not optional. 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.
Images never pruned, then limbo. 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.
The agent asks the graph. 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.
Nothing to write but the steps. 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.
What you write yourself#
| What you write yourself | Cloudflare Workflows | Durable |
|---|---|---|
| A class on the platform's workers | Small steps with deterministic names, since a step's name is its cache key. | a keyed saga of steps in one file on your Postgres; a step's input and output on its row |
| Steps may retry, code outside them repeats | The idempotency of each step's work, and state rebuilt only from step results. | a step the one place a body reads the world; a provider write reads before it writes |
| Retries, then an errored instance | The try and catch around a step whose failure the run should survive, and the clean-up steps the catch runs. | bounded redrives of a transient cause, then limbo with the rows and the remedy |
| Rollback handlers, where registered | A handler on every step that needs one, the check that none is missing, and the record of what each restored. | the undo required at the door, run in reverse, each a ledger row with what it restored |
| An instance id in use | The id derived from the intent, and the catch that turns the throw into a join. | the intent key; a second trigger joins the one run |
| State for a retention window | The image of your own data before a write, which no step result holds. | the ledger: before and after images, never pruned |
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.