Durable beside Step Functions
A managed state machine hands each state's work to a service. The code, the idempotency and the compensation stay with you.
The shape: a state machine. 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 Step Functions gives, as its documentation describes#
A state machine in JSON. A workflow is a series of states defined in the Amazon States Language, a JSON-based language, or built in Workflow Studio, the visual designer. A Task state hands its work to another service, to a function or an external API, or to an activity worker you run outside Step Functions. [1][2]
Two workflow types, fixed at creation. A Standard execution runs each state once unless a retry says otherwise. An asynchronous Express execution may run more than once and a synchronous one at most once, and Express keeps no history of its own, only the log you turn on. The type is chosen at creation and cannot change afterwards. [3]
Retry and catch blocks. By default an error fails the whole execution; Retry blocks set the interval, the attempts and the backoff, and a Catch moves the execution to a fallback state you design. [4][5]
A redrive from the failed state. A failed Standard execution can be redriven from the unsuccessful step within a window of days, successful steps keeping their results. [6]
Waits and callbacks. An activity, a job it waits on or a callback task waiting for its token has no default timeout. It can wait until the execution's own limit unless a timeout or a heartbeat interval bounds it. [7]
A history of inputs and outputs. The console shows an execution as a graph, a table with a timeline and a list of events with each state's input and output. The history is kept for a retention period on the Standard type and capped per execution. [8]
The same work under Durable#
Code, not a definition language. A workflow is one TypeScript file in your own app; the engine is a library inside your functions on the Postgres the app already has, with a minute cron the one moving part outside the request path.
One run per intent. key: ["orderId", "requestId"], a field list that never reads the clock; the key and the run commit in one transaction, and a resend joins the run it already has.
The undo on the step itself. Each step declares its undo with its effect or says why it cannot, refused at the door otherwise; when a later step fails the undos run in reverse, each a ledger row with what it found and restored.
Images on a ledger, 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 with its rows and a remedy after bounded redrives of a transient cause; 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 fallback state, no heartbeat, no store for a history of your own; durable-sdk doctor --host runs every rule before a deploy, and the console shows runs, steps with their images, the ledger, limbo, facts and limits.
What you write yourself#
| What you write yourself | Step Functions | Durable |
|---|---|---|
| A state machine in JSON | The function behind a Task when it is yours, and the connection an external API is called through. The worker behind an activity, which polls for the task, sends heartbeats to keep it alive and reports success or failure. | one TypeScript file; the engine a library inside your functions |
| Two workflow types, fixed at creation | Idempotent work under Express, and a retry of your own where a synchronous run stops short. A guard of your own where two starts share a name, and the log you turn on as your record. | one run per intent; a finished step is served from its row |
| Retry and catch blocks | The fallback state, and every compensating step for the states already completed. A Catch only names where to go next, and the vendor's own saga guidance has you write each revert as a further task and the transition that reaches it. | the undo declared on the step, run in reverse, each a ledger row |
| A redrive from the failed state | What a rerun state may repeat, since a redrive schedules and starts the state again with the same input. | a redrive reads the world before it writes; limbo for a person with the rows |
| Waits and callbacks | A timeout or a heartbeat on every task that waits for a worker, a job or a callback; the docs call setting both good practice for a long-running activity. Without one the execution waits for an answer that never comes until its own limit ends it. | waits and signals as rows; the workflow's own timeout bounds them |
| A history of inputs and outputs | The image of your own data before a write, and a split of the work when the history nears its cap. | the ledger: before and after images, never pruned |
When Step Functions wins: work in any language on the services it calls directly, start and transition rates far above one database's, a visual editor and graph, and a fan-out that reads a dataset from object storage by the thousand.
Sources#
- https://docs.aws.amazon.com/step-functions/latest/dg/concepts-statemachines.html
- https://docs.aws.amazon.com/step-functions/latest/dg/concepts-activities.html
- https://docs.aws.amazon.com/step-functions/latest/dg/choosing-workflow-type.html
- https://docs.aws.amazon.com/step-functions/latest/dg/concepts-error-handling.html
- https://docs.aws.amazon.com/prescriptive-guidance/latest/cloud-design-patterns/saga-orchestration.html
- https://docs.aws.amazon.com/step-functions/latest/dg/redrive-executions.html
- https://docs.aws.amazon.com/step-functions/latest/dg/state-task.html
- https://docs.aws.amazon.com/step-functions/latest/dg/concepts-view-execution-details.html