Durable beside the Workflow SDK
A platform's directives make a function durable. The dedupe, the idempotency and the rollback 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 the Workflow SDK gives, as its documentation describes#
Two directives, an event log. A "use workflow" function compiles into an orchestrating route and each "use step" into its own; every input and output lands in an event log the platform replays after a crash or a deploy. [1][7]
A retry repeats the step. A step that throws is retried a set number of times with no delay by default, and a retry can repeat a payment, an email or an API write. A lost connection to the platform's own backend does not prove its write was rejected, so the step may run again. [2]
A start takes no key. Two concurrent requests can both start a run; run-level deduplication is a hook created under a deterministic token at the top of the body and a conflict check, the loser returning. [3]
Cancellation stops, it does not reverse. A cancel stops the run at its next suspension point and disposes its hooks; no compensation or rollback of a cancelled run is described. [4]
A run pinned to its deployment. A run keeps running on the deployment that started it through sleeps, waits on a hook, step retries and queued messages. A redeploy changes new runs only, and a fix never reaches a run already in flight. [5]
Payloads kept for a while. A finished run's payloads stay readable from a day to a month by plan, then every copy is gone some months later. The payloads are each step's input, return value and error, the run's own, the hook and event payloads and the streams; the run's unencrypted metadata outlives them. [6][8]
The same work under Durable#
A library on your own database. The engine is a library inside your app's functions on the Postgres the app already has; a minute cron is the one moving part outside the request path, and no platform queue sits in the run's path.
The key is derived, not minted. key: ["orderId", "requestId"]: a field list off the input, clock-free, refused at the door otherwise; the key and the run commit in one transaction, so the same intent twice is one run before anything is written.
An undo on every step, or the reason. Each step declares its undo with its effect or says why it cannot; when a later step fails the undos run in reverse, each a ledger row with what it found and what it restored.
Images never aged out, then limbo. Every write leaves a before and after image on an append-only, hash-chained ledger that is never pruned; durable-sdk ledger verify --file <export> walks an export offline. A failed run waits in limbo after bounded redrives of a transient cause, 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 hook token, no conflict check, no rollback step, no copy of a result before it expires, no recovery route after a deploy: a changed body patches a branch and a run in flight finishes the one it started, or bumps its version and every run in flight waits in limbo for a person, and a long run continues as new; durable-sdk doctor --host runs every rule over the tree before a deploy.
What you write yourself#
| What you write yourself | Workflow SDK | Durable |
|---|---|---|
| Two directives, an event log | Plain async code the platform can replay deterministically, with external calls inside steps, since a step is what gets the retries and survives a crash. | a keyed saga of steps in one file; a step the one place a body reads the world |
| A retry repeats the step | The idempotency of every side effect inside a step, and of any rollback step, since it may run more than once. | a provider write reads before it writes; a finished step is served from its row |
| A start takes no key | That token, that check, and the external idempotency key built from the step id. | the intent key, a field list off the input; the key and the run in one transaction |
| Cancellation stops, it does not reverse | The compensation when a later step fails or a run is cancelled. | the undo declared on the step, run in reverse, each a ledger row |
| A run pinned to its deployment | Deploying the fix, then finding the affected runs and cancelling the ones still running. Rerunning each on the latest deployment with the same inputs, from the dashboard or through a recovery route you add. Or splitting long work into bounded pieces that each start the next on the latest deployment and carry their state forward, with names, arguments and return shapes kept compatible. | a change over runs in flight by version, a patch or continue-as-new |
| Payloads kept for a while | The image of your data before a write, and your own copy of a result before it becomes unreadable. | the ledger: before and after images, never pruned |
When the Workflow SDK wins: plain async code on the platform's own functions, queue and trace viewer, with streams and a Python beta, where a step's inputs and outputs are record enough and the compensation can stay in your hands.
Sources#
- https://workflow-sdk.dev/docs/how-it-works/understanding-directives
- https://workflow-sdk.dev/docs/foundations/errors-and-retries
- https://workflow-sdk.dev/docs/foundations/idempotency
- https://workflow-sdk.dev/docs/foundations/cancellation
- https://workflow-sdk.dev/docs/foundations/versioning
- https://workflow-sdk.dev/docs/how-it-works/encryption
- https://vercel.com/docs/workflows/concepts, the platform's own page beside the SDK's for the beat on the two directives, whose sentences it carries; dated 2026-09-10
- https://vercel.com/docs/workflows/retention, the platform's own page beside the SDK's for the beat on payloads; its front matter dated 2018-10-20 though its content names the current line