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.

A state machine: Step Functions

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.

12 / 12

What Step Functions gives, as its documentation describes

  1. 1

    A state machine in JSON

    it gives
    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.
    you write
    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.
  2. 2

    Two workflow types, fixed at creation

    it gives
    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.
    you write
    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.
  3. 3

    Retry and catch blocks

    it gives
    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.
    you write
    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.
  4. 4

    A redrive from the failed state

    it gives
    A failed Standard execution can be redriven from the unsuccessful step within a window of days, successful steps keeping their results.
    you write
    What a rerun state may repeat, since a redrive schedules and starts the state again with the same input.
  5. 5

    Waits and callbacks

    it gives
    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.
    you write
    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.
  6. 6

    A history of inputs and outputs

    it gives
    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.
    you write
    The image of your own data before a write, and a split of the work when the history nears its cap.
things you write6

The same work under Durable

  1. 7

    Code, not a definition language

    it does
    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.
  2. 8

    One run per intent

    it does
    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.
  3. 9

    The undo on the step itself

    it does
    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.
  4. 10

    Images on a ledger, then limbo

    it does
    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.
  5. 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.
  6. 12

    Nothing to write but the steps

    it does
    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.
    you write
    The steps and their undos.
things you write1

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. 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.