- ENGINEERING
- INSIGHTS
What Is Durable Execution? How It Works, Engines, and Examples
Durable execution is a way of running code in which every completed step is saved, so the work resumes after a crash, restart, or deploy instead of starting over.
An ordinary program keeps its progress in memory. If the process dies between charging a card and creating the shipment, that progress is gone, and so is any record of how far it got. A durably executed program keeps its progress in a store. The process can die at any point, and another one picks up where it stopped.
This guide explains the mechanism, the two ways engines implement it, what it guarantees and what it leaves to you, and what it costs. The code is from Orkes Conductor, because that is what we build. The ideas apply to every engine, and the main ones are compared by name.
(opens the full-size image in a new tab) The problem durable execution solves
Most real work is a chain of steps, and each step talks to something that can fail: a database, a payment provider, a model API, another team’s service. Three things go wrong.
- The process dies partway through. Some steps happened and some did not, and nothing remembers which.
- A step fails for a while. The provider is down for ten minutes. Retrying in a loop holds a thread, and giving up loses the work.
- A step takes a long time. An approval takes two days. A subscription renews in a year. No process stays in memory that long.
Teams usually patch these one at a time, and each patch is a small durable execution engine built by hand.
| What goes wrong | The usual patch | What a durable execution engine provides |
|---|---|---|
| The process dies partway through | A status column, and code that reads it at startup | Every finished step saved, and resume from the next one |
| A dependency is down for ten minutes | A retry loop, or a retry queue | A retry policy for each step, with backoff and a limit |
| A step never answers | A nightly job that looks for stuck records | Timeouts, and redelivery to another worker |
| The work must wait two days | A table of scheduled jobs, and a poller | Timers and waits that are rows in storage |
| A later step fails after earlier ones acted | Cleanup scripts, run by hand | Compensation that runs as part of the workflow |
| Nobody can tell what happened | Logs joined by a correlation ID | One record of the run: every step, input, output, and attempt |
Durable execution replaces the patches with one guarantee about how the code runs.
How durable execution works: the architecture
- The work is split into steps. A step is one unit that either completed or did not: a function call, an HTTP request, a model call, a wait.
- Every completed step is recorded, with its input and its result, in a durable store, before the next step starts. Engines call this record a journal, an event history, or checkpoints.
- A failed step is retried according to a policy: how many times, how far apart, and with what timeout.
- Waits are data. A timer or a pending approval is a record in the store.
- After any failure, the run resumes. A healthy process reads what was recorded and carries on with the first step that has no result.
What gets saved is small and specific. For the run: its input, and the version of the code or definition it started with. For each step: its input, its output, its status, how many attempts it took, and when.
One step, from scheduled to saved
(opens the full-size image in a new tab) Figure 2 follows a single step. The engine saves that the step is scheduled before any worker sees it. A worker takes the task, does the work, and reports the result, and only then does the engine save the result and schedule the next step.
The dangerous moment is between the side effect and the report. If the worker dies there, the engine cannot tell whether the charge happened. It waits for a response timeout, then schedules the task again, and a second worker runs it.
At least once is the default
That sequence is why most durable execution engines deliver each step at least once unless you choose otherwise. A step is not silently dropped, and it can run more than once. Three cases are worth knowing.
- A lost report. The worker acts and dies before reporting, as in Figure 2. The step runs again, later.
- Overlapping attempts. The engine gives up on a slow worker and hands the task to another while the first is still running, so two attempts run at the same time. Jepsen’s analysis of Orkes Conductor recorded one task starting on two workers three milliseconds apart. In that test, a healthy cluster saw an overlap roughly once every six hours. It is rare, and at volume it is certain.
- Never repeated unless you say so. Some engines do not run a step again by themselves. AWS Step Functions Standard workflows follow what AWS calls an exactly-once model: a state is never run more than once unless it declares a
Retry. AWS Lambda durable functions have a step setting under which an interrupted attempt is not run again. The step fails with an error, and its retry policy decides what happens next. In both, the uncertainty moves to you: a step that timed out may have acted, and a retry that you declare runs it a second time.
An engine can do better than at least once only where a step’s effect and the engine’s record commit together. DBOS does this for database transactions, which commit exactly once because they share a database with the checkpoint. A call to someone else’s system never shares a transaction with the engine, so for those calls the gap is closed by the step.
A step is idempotent when running it twice has the same effect as running it once. At-least-once delivery plus an idempotent step is what people mean by “effectively once”. There are two reliable ways to get there:
- Send an idempotency key. Build it from stable identifiers, such as the run ID and the step name, and let the receiving system discard a repeat. Payment providers support this directly.
- Write by a natural key, under a unique constraint. An upsert keyed on the order ID has the same result the second time, and the constraint holds even when two attempts overlap.
A check before the write is not enough by itself, because two overlapping attempts can both pass the check. And never build a key from something that can differ between attempts, such as a timestamp or a random value.
When a product says “exactly once”, check what the phrase covers. An engine can record a step’s result exactly once, and it can schedule a step exactly once. A side effect in someone else’s system is still yours to make safe.
Detecting a dead worker takes time. The engine learns that a worker died only when a timeout passes, so that timeout is the recovery time of the step. A short one recovers quickly and causes more overlapping attempts. A long one does the reverse. A long step can report that it is still alive and keep its claim, instead of taking a long timeout.
Starting a run has the same problem. A caller whose request times out does not know whether the run started. Give the start request an idempotency key, so that a retry returns the first run instead of starting a second.
Two ways to resume: replay and saved state
Durable execution engines differ in how they get back to where a run stopped. There are two main approaches, and each has a rule you have to follow and a cost you have to accept.
(opens the full-size image in a new tab) Replay: run the code again, and answer from the record
Under replay, a workflow is ordinary code, a style often called workflow as code. This one is a Conductor native workflow, where any Java method becomes a workflow with one annotation:
@Workflow(name = "ship_order")public String ship(Order order) { String label = tasks.printLabel(order); // 1 String carrier = tasks.bookCarrier(order); // 2 return tasks.notify(order, label, carrier); // 3}The engine records each call and its result. Each time the run continues, a worker calls the method from the top. Every call the run already made is answered from the record, at once, without scheduling anything. The first call with no record is scheduled, and the method stops there. For the three calls above, the method can run four times: up to line 1, then through line 1 to line 2, and so on. In practice a worker keeps the method in memory where it stopped and skips most of those runs. After a restart, a deploy, or an operator’s retry it runs from the top again, so the code has to be correct under replay even though it is rarely replayed.
The rule is determinism. The code must ask for the same things in the same order every time it runs. Code that depends only on its input and on the results of its steps is deterministic without effort. Code that asks the machine for a random number, the time, or a new ID is not:
@Workflow(name = "random_coupon")public Coupon issue(String customer) { boolean lucky = Math.random() < 0.5; // a new number on every run int percent; if (lucky) { percent = tasks.applyDiscount(customer, 20); } else { percent = tasks.applyDiscount(customer, 10); } String code = UUID.randomUUID().toString(); // a new ID on every run Instant issued = Instant.now(); // a new time on every run return new Coupon(code, percent, issued, tasks.sendCoupon(customer, code));}The first run draws 0.3 and applies 20 percent. Nothing looks wrong, and the run may carry on for a long time, because the method is usually still in memory. Then a deploy or a restart makes the method run again from the top. It draws 0.8 and takes the other branch, which the record does not have, and the run cannot continue. This is why such bugs tend to surface weeks later, on the first deploy. Conductor’s dev mode keeps nothing in memory and replays the method every time the run continues, so half of these runs stop after their first task, on a developer’s machine.
The fix is to take such values from the engine, which records them the first time and returns the same value on every later run:
boolean lucky = random() < 0.5; // drawn onceString code = once("coupon_code", () -> UUID.randomUUID().toString()); // recordedInstant issued = now(); // recordedThe full set of rules is short:
- Take random values, the time, and IDs from the engine.
- Read anything else that can change (a file, a config flag, an environment variable) inside a step.
- Call steps in an order that does not depend on the machine, so iterate a list or a sorted set, not a hash set.
- Wait and run in parallel through the engine, never with your own threads or
Thread.sleep. - Keep side effects out of workflow code. It runs many times for one execution.
Engines help in different ways. Temporal’s Python SDK runs workflow code in a sandbox that blocks known non-deterministic calls. Conductor reads the compiled workflow when its workers start and warns about direct clock and random calls, or refuses to host the workflow when strict checking is on. If a run still leaves the recorded path, Conductor holds the execution, and it continues when a build that agrees with the record is deployed. Replay engines generally also let you replay recorded runs against new code in a test, which catches a breaking change before it ships.
Saved state: the engine advances a definition
Under saved state, a workflow is a definition that the engine holds: a list of tasks, with their inputs and the operators between them. This is the same order as a Conductor definition, trimmed to two of its five tasks:
{ "name": "fulfill_order", "version": 1, "schemaVersion": 2, "failureWorkflow": "undo_order", "tasks": [ { "name": "charge_card", "taskReferenceName": "payment", "type": "SIMPLE", "inputParameters": { "idempotencyKey": "${workflow.workflowId}-charge" } }, { "name": "return_window", "taskReferenceName": "return_window", "type": "WAIT", "inputParameters": { "duration": "14 days" } } ]}The engine also holds the state of every run: which tasks have results, and what they are. To resume, it reads that state and schedules the next task. Nothing runs again, so there are no determinism rules. A worker is an ordinary function that takes an input and returns an output, and it can use the clock, random numbers, and I/O freely.
The rule is that the engine must be able to see the steps. Control flow is written with the engine’s operators (a switch, a loop, a fork, a sub-workflow) instead of the language’s own. In return, the graph is data: it can be drawn before a run starts, generated by a program or a model at run time, and paused, changed, or rerun from any task by an operator.
The price is paid elsewhere. Logic that would be three lines of code becomes operators and expressions, with no compiler to check the wiring between steps. The workflow lives in two places, the definition and the workers, and they have to change together. And a definition can only say what the engine’s operators can express. Anything else has to go into a worker.
How the two compare
| Replay | Saved state | |
|---|---|---|
| You write | Workflow code in your language, plus steps | A definition, in JSON or built with an SDK, plus workers |
| Control flow | Anything the language has | The engine’s operators |
| The rule | Workflow code must be deterministic | Steps must be declared so the engine can see them |
| What it costs you | A rule that is easy to break by accident, and care on every deploy | Logic in the engine’s vocabulary, split between a definition and workers |
| A change with runs in flight | Old runs need the old code, or code that agrees with their record | Each run keeps the definition it started with. Workers are shared |
| The graph before a run | Only if the engine can derive it from the code | Always. The definition is the graph |
| A workflow generated as data | Needs an interpreter that you write | Natural, because a definition is data |
| Best fit | Logic that reads best as code | Processes that people and tools outside the code need to see, change, or generate |
Neither is more durable than the other. They differ in where the workflow logic lives and in what you have to keep in mind while writing it. Some engines offer both. Conductor does: a workflow can be a registered definition, advanced from saved state, or a native workflow written as a Java method and replayed against the record the server keeps.
Waiting without threads: timers, events, and people
A program that waits the ordinary way holds something while it waits: a thread in Thread.sleep, a blocked call, an open connection, or a loop that polls every few seconds. Each of those uses memory for as long as the wait lasts, and all of them vanish when the process restarts. That is fine for a wait of one second. It does not survive a wait of two weeks.
A durable wait holds nothing in your workers. The engine writes a record that says what the run is waiting for, and the worker that was running the workflow goes back to other work. No thread of yours sleeps, no process stays up for the run, and no connection is kept open. The engine keeps one scheduler for all the waiting runs, instead of one thread for each. When a wait ends, it schedules the next step, and any worker can pick it up.
(opens the full-size image in a new tab) Three things follow from that.
- Waiting costs storage, not compute. A million runs waiting on approvals are a million rows. They need no threads, and no memory in your workers.
- A wait survives whatever a row survives. Deploys, restarts, and scaling the workers to zero do not touch it.
- The length of the wait does not matter. Fourteen days and fourteen seconds are the same record with a different time in it.
There are three kinds of wait, and all three are built this way.
A timer waits for a duration or until a date. In a definition it is a WAIT task. In a native workflow it is one line, sleep(Duration.ofDays(14)), which looks like a thread sleeping and is not one: the call records a timer and the method stops there.
An outside event is another system saying that something happened: a webhook from a carrier, a confirmation from a bank. The other system completes the waiting step through the engine’s API, and what it sends becomes the step’s output.
A person is the longest wait most systems have, and it works the same way. The run parks at a human task. Your code does not poll for the answer, and no thread spins while the approver is on holiday. When they answer, through a form or an API call, the task completes and the run continues with their decision.
// a person decides; after three days without an answer, ask their directorOptional<Decision> decision = human("manager_review") .assignee(expense.manager()) .await(Decision.class, Duration.ofDays(3));if (decision.isEmpty()) { decision = human("director_review") .assignee(expense.director()) .await(Decision.class, Duration.ofDays(7));}Under replay there is one more thing to know. The workflow method is not kept for those days either. A Conductor worker parks an idle method on a virtual thread as a shortcut, for an hour by default, and then lets it go. When the answer arrives, the method runs again from the top, and every call before the wait is answered from the record.
Four decisions belong to every wait on something outside the run:
- How long to wait.
- What happens when the time runs out.
- What a duplicate answer does. A durable engine makes this one easy, because a step that is already complete rejects a second completion.
- What happens when the answer arrives before the run is waiting for it. Start the wait before you ask the other system to act, or make sure the other system retries.
Messages, queries, and child workflows
A long run needs three more things, and every engine names them differently.
| Need | What it is | Names you will meet |
|---|---|---|
| Tell a run something | A message delivered to a run, and saved like the result of a step | Signals and Updates in Temporal. In Conductor, completing a waiting task, or an event |
| Ask a run something | A read of the run’s current state that changes nothing | Queries in Temporal. In an engine that keeps the state, a read of the stored run |
| Split a run | A step that is a run of its own, with its own record and retries | Child Workflows in Temporal. A SUB_WORKFLOW task in Conductor |
A child workflow is also how a long run stays small. Each child keeps its own record, so the parent holds one step for it.
When a step fails for good: retries and compensation
Most failures are temporary, and a retry policy absorbs them. Each step gets its own: how many attempts, how long between them, whether the delay grows, and how long a worker may hold the task before it is given to another. This is a Conductor task definition:
{ "name": "charge_card", "retryCount": 3, "retryLogic": "EXPONENTIAL_BACKOFF", "retryDelaySeconds": 2, "responseTimeoutSeconds": 30, "timeoutSeconds": 120, "timeoutPolicy": "RETRY"}Some failures are final. A declined card will be declined again, so the step should say so, and the engine should stop retrying. Then the workflow has to deal with what already happened, because earlier steps acted on the outside world and no transaction can roll them back.
(opens the full-size image in a new tab) The answer is a saga: every step that changes something has an undo step, and when a later step fails for good, the undo steps run, last first. In a definition this is a failureWorkflow, a second workflow that the engine starts when the first one fails, with the failed run’s data as its input. In workflow code it is a stack and a catch, as the worked example shows.
Four points are easy to miss.
- Register the undo before the step runs. A step can act and then fail to report. If its undo is registered only after it succeeds, that case is never undone. This is why Figure 5 undoes the failed step too. So an undo step must be safe to run when its step did nothing.
- Undo steps are durable steps too. They are retried, and they must be idempotent. An undo that still fails must not stop the ones after it. Run the rest, and fail the run with a list of what a person has to finish.
- Not everything can be undone. A sent email cannot be unsent, so its compensation is a second email.
- Decide where compensation stops. Once an order has shipped and its return window has closed, a late failure should not refund it. Steps after that point fail forward: they are retried or fixed, not undone.
A run also needs a limit of its own: a total timeout, and a way to cancel it. Cancelling stops new steps from being scheduled. A step that is already in flight may still finish, so cancelling a run that has acted usually means compensating it.
Changing code while runs are in flight
A run that lasts two weeks will outlive several deploys. What a deploy does to it depends on how the engine resumes.
Under saved state, each run carries the definition it started with. New runs use the new definition, and old runs finish on the old one. The workers are not part of that snapshot. A worker whose input or output changes still serves the old runs, so change a worker’s contract compatibly, or give the changed task a new name.
Under replay, the question is which build continues an old run. Some engines pin a run to the build that started it. Restate keeps each invocation on the deployment it started on, so old code finishes old runs, and you keep the old deployment until they end. Where a new build picks up old runs, the build has to agree with their records:
| Change | Runs in flight |
|---|---|
| A log line, a refactoring, a renamed variable | Unaffected |
| A step added, removed, or reordered after the point a run has reached | Unaffected |
| A step added, removed, or reordered before the point a run has reached | Cannot continue on the new code |
| A condition changed so that a run now takes another branch | Cannot continue on the new code |
| A step renamed | Cannot continue, where the run already called it |
For the last three, give the new code a new version and keep running the old version until its runs end. A replay test, which runs recorded executions against the new build, catches these in CI.
What durable execution costs
Durable execution is not free, and it is not for every piece of code.
- A write for every step. Each step adds a save to storage, and in engines that hand steps to separate workers, a trip to a worker. Managed services often bill by the step: AWS Step Functions bills a Standard workflow for each state transition, and each retry is one more. That is small next to a call to a payment provider and too much for a loop over a million rows. Make steps the size of a unit of work you would not want to repeat.
- Replay has a cost of its own. Running a method again from the top means reading every step before it, so over the life of a run the work grows with the square of the number of steps. Engines avoid most of it by keeping the method in memory between steps.
- Limits on a run. Engines cap how long a run may last, how large a payload may be, or how many events a run may record. AWS Step Functions Standard workflows run for up to a year. Temporal ends a run whose history passes 51,200 events and offers a way to continue it as a new run. Learn your engine’s limits before a loop finds them.
- Everything is stored. Each step’s input and output is kept. Pass references to large objects instead of the objects, keep secrets out of inputs, and treat the record as data at rest.
- A rule to follow. Deterministic workflow code under replay, or declared steps under saved state, and idempotent steps under both.
- An engine to run. A durable execution engine is a service with a database behind it. You operate it, or you use a managed one.
Skip it for work that is short, read-only, and cheap to ask for again: a search query, a page render, a cache lookup. Use it when a run is long, expensive, waits on people, or changes something that must not be changed twice.
Durable execution vs a workflow engine
Vendors draw this line in different places. Temporal’s guide says that “relatively few” of the systems called workflow engines provide durable execution. Restate’s guide draws it at the language: a traditional workflow engine has you describe the process in a DSL, YAML, or a visual graph, and durable execution lets you write it as code.
This guide draws it at the guarantee. “Workflow engine” names what a system does, which is to coordinate steps. “Durable execution” names what it guarantees. Three tests decide whether a system provides it, whatever it is called and however you write the workflow:
- Is the result of each step saved before the next step starts?
- Can another process carry on after the first one dies, without repeating finished steps?
- Is a wait a record, so that it outlives the process?
| Kind of system | Examples | Each step saved first | Another process carries on | A wait is a record |
|---|---|---|---|---|
| Code-first engines that replay | Temporal, Restate, Durable Functions | Yes | Yes | Yes |
| Definition-first engines that keep state | Step Functions Standard, Camunda 8, Conductor | Yes | Yes | Yes |
| Short-lived state machines | Step Functions Express | At least once for the whole execution | The execution can run again | Five minutes at most |
| Batch schedulers | Apache Airflow | Yes: the state of each task is in its database | Yes: a task whose worker died is failed or retried | With a deferrable operator. A standard sensor holds a worker slot |
| A job queue with retries | Any queue that redelivers | One job, not the chain | The job, not the run | No |
| A workflow library inside your process | A state machine held in memory | No | No | No |
By these tests, a state machine service or a process engine that saves each step provides durable execution, by saved state. What the code-first guides describe is one of the two ways to build it. A batch scheduler passes too, one task at a time. What sets it apart is its purpose: Airflow describes itself as a platform for batch-oriented pipelines, started by a schedule or an event, where the engines above start a run for every request. The tests also cut the other way: a product can be called a workflow engine, or have a workflow mode, and not pass them.
Durable execution vs related ideas
| Approach | What it handles | What it leaves out |
|---|---|---|
| Retries in code | A call that fails briefly | A process that dies, and everything already done |
| A message queue | Redelivering one message | State across steps, ordering, and waits |
| Cron or a scheduler | Starting work at a time | What happens after it starts |
| A saga | Undoing finished steps after a failure | Resuming forward, and long waits |
| A state machine service | Saved state and transitions | It is one way to implement durable execution |
| Event sourcing | A log of what happened, from which state is rebuilt | Running the next step. Replay engines build on the same idea |
| The outbox pattern | Publishing an event if and only if a row was written | Everything after that one hop |
| A database transaction | All-or-nothing inside one database | Anything that leaves the database, and anything slow |
| Two-phase commit | All-or-nothing across systems that can each prepare and then commit | Systems with no prepare step, which is most APIs, and anything slow. A saga is the usual alternative |
| Durable execution | Saved progress, retries, waits, resume, and compensation | Making your side effects idempotent |
It is also not a promise that code never fails. A step can still return an error. The promise is that completed work is not lost, and that the run can always continue or be compensated.
Durable execution for AI agents
An AI agent is a loop of model calls and tool calls, and it has every problem above in a sharper form. Model calls are slow, they cost money, and they fail often. A tool call can change something. An approval can take days, and an agent that works on a task for a week has to outlive every deploy in that week.
Run durably, an agent gets four things.
- Every model call and tool call is a saved step. A failed call retries by itself. Calls whose results were saved are not paid for again, and tools whose results were saved do not act again.
- The model does not have to be deterministic. Only workflow code does, and only under replay. A model’s answer is the result of a step: it is recorded once and returned from the record after that.
- Approvals hold nothing. An agent waiting for a person is a row in storage, as in Figure 4.
- There is a record of what the agent did: each prompt, answer, tool call, and decision, in order.
An agent run this way is called a durable agent. The Thoughtworks Technology Radar listed ignoring durability in agent workflows as a practice to avoid in April 2026. Durability is not the whole answer, though. As Kiran Prakash puts it in Long-horizon agents and durable execution, durable is not the same as correct: a run that survives every failure can still make a wrong decision. The checks, limits, and approvals that deal with that are the subject of AI agent orchestration.
Durable execution patterns
The same few patterns appear in every durable workflow. Each has its own section above.
| Pattern | The problem it solves | Where |
|---|---|---|
| Idempotency key | A step that runs twice | At least once is the default |
| Heartbeat | A long step taken for dead | At least once is the default |
| Durable timer | Waiting for days without a thread | Waiting without threads |
| Human approval | Waiting for a person, with a deadline | Waiting without threads |
| Outside event | Another system reporting back | Messages, queries, and child workflows |
| Child workflow | Keeping a long run small | Messages, queries, and child workflows |
| Saga | Undoing finished steps after a failure | Retries and compensation |
| Version pinning | Deploying while runs are in flight | Changing code while runs are in flight |
A worked example: one order, end to end
The order has five steps: reserve the stock, charge the card, create the shipment, wait out a fourteen-day return window, and close the order. Here it is as a Conductor native workflow in Java. The steps are ordinary methods on an ordinary class, marked @WorkerTask, each with its own retry settings and each taking an idempotency key. inventory, payments, and carrier stand for your own clients.
public static class Tasks {
@WorkerTask(value = "reserve_stock", retryCount = 3, retryDelaySeconds = 2) public Reservation reserveStock(Order order, String key) { return inventory.hold(order, key); }
@WorkerTask(value = "charge_card", retryCount = 3, retryDelaySeconds = 2) public Payment chargeCard(Order order, String key) { return payments.charge(order, key); }
@WorkerTask(value = "create_shipment", retryCount = 3, retryDelaySeconds = 2) public Shipment createShipment(Order order, String key) { return carrier.book(order, key); }
// release_stock, refund_card, cancel_shipment, and close_order // are declared the same way}The workflow class takes Tasks in its constructor and calls it. A call such as tasks.chargeCard(...) does not run the method in the workflow’s process. It schedules the task on the server, waits for a worker to run it, and returns its result.
@Workflow(name = "fulfill_order", version = 1)public Receipt fulfill(Order order) { String run = workflowId(); Deque<Runnable> undo = new ArrayDeque<>(); Payment payment; Shipment shipment; try { undo.push(() -> tasks.releaseStock(order, run + "-release")); tasks.reserveStock(order, run + "-reserve"); undo.push(() -> tasks.refundCard(order, run + "-refund")); payment = tasks.chargeCard(order, run + "-charge"); undo.push(() -> tasks.cancelShipment(order, run + "-cancel")); shipment = tasks.createShipment(order, run + "-shipment"); } catch (TaskFailure e) { List<String> stuck = new ArrayList<>(); while (!undo.isEmpty()) { try { undo.pop().run(); } catch (TaskFailure failedUndo) { stuck.add(failedUndo.getReason()); // keep going: the rest still have to run } } throw new WorkflowFailedException( "order not fulfilled: " + e.getReason() + ", undo steps that failed: " + stuck); } // The order is fulfilled. Nothing after this line is undone. sleep(Duration.ofDays(14)); // the return window return tasks.closeOrder(order, payment, shipment, run + "-close");}Four details carry the guarantees.
- Every step that writes gets a key built from the run ID, which is the same on every retry and every replay.
- Each undo is registered before its step runs, so a step that acted and never reported is still undone. That includes the shipment: if
createShipmentfails,cancelShipmentruns first, and it has to be safe when nothing was booked. - The compensated block ends where the order is fulfilled. A failure in
closeOrder, fourteen days later, fails the run and leaves a delivered order alone. - The fourteen-day wait is
sleepfrom the engine, a timer in storage.Thread.sleepwould hold a thread, and would run again on every replay.
(opens the full-size image in a new tab) Three things in the record are worth reading closely.
- The payment provider timed out, and the charge was retried. The second attempt carried the same key, so the provider treated it as the same charge.
- A worker died after booking the shipment. The engine could not know the booking had happened, so it scheduled the task again and a second worker ran it. The carrier saw the same key and returned the same label.
- The run waited fourteen days. The server was deployed twice and restarted once in that time. The run was a row in storage, and it continued when the timer fired.
Durable execution engines
Engines group by how they resume. This table describes each one in the terms of its own documentation. Most resume by replay or by saved state, and a few combine checkpoints with replay.
| Engine | You write | It resumes by |
|---|---|---|
| Temporal | Workflow code, with Activities for side effects | Replaying the workflow against its Event History |
| Restate | Handlers in code, using a context object | Replaying the handler against its journal |
| Cadence | Workflow code, with activities for side effects | Rebuilding state from the events of the run, which needs deterministic workflow code |
| Dapr Workflow | Workflows and activities in code | Replaying the workflow against an append-only history |
| Hatchet | Durable tasks in code | Replaying a task from the checkpoints in its event log |
| Microsoft Durable Task, including Durable Functions | Orchestrations and activities in code | Replaying the orchestrator against its execution history |
| AWS Lambda durable functions | Functions whose steps are checkpointed | Replaying the function, skipping checkpointed steps |
| Inngest | Functions made of steps | Running the function again with finished steps memoized |
| Cloudflare Workflows | A class whose steps are persisted | Running the workflow again with the results of finished steps kept |
| DBOS | Annotated workflow and step functions | Running the workflow again from step results checkpointed in Postgres |
| LangGraph | A graph of nodes, in code | Restoring the graph’s state from its last checkpoint. An interrupted node runs again from its start |
| AWS Step Functions | A state machine in Amazon States Language | Advancing the saved state of the state machine |
| Camunda 8 | A BPMN model | Advancing the saved state of the process instance |
| Conductor | A definition, or a native workflow in Java | Advancing saved state for a definition, and replay for a native workflow |
Most of the engines in this list resume by replay, which is why most explanations of durable execution describe replay alone.
Where durable execution came from
Both approaches are older than the name.
| When | What appeared | How it resumes |
|---|---|---|
| February 2012 | Amazon Simple Workflow, whose Flow Framework replays workflow code against a history the service keeps | Replay |
| From 2015 | Cadence at Uber, started by engineers who had worked on Simple Workflow and on Microsoft’s Durable Task Framework, and then Temporal, which they founded | Replay |
| December 2016 | AWS Step Functions, a state machine service | Saved state |
| December 2016 | Conductor, published by Netflix after a year in production there, in which a server advances a JSON definition | Saved state |
For a side-by-side comparison with sources, see Conductor next to Temporal.
How Orkes Conductor provides durable execution
Orkes Conductor is a durable execution platform built on Conductor OSS, the open-source engine created at Netflix.
- What is saved. For every run: the definition it started with, its state, and every task with its input, output, status, attempts, and timestamps. Each change is written to the store before the next action is taken. In Conductor OSS the store can be Redis, PostgreSQL, MySQL, or Cassandra.
- Delivery is at least once. A task that a worker took and never reported is scheduled again when its response timeout passes. Conductor’s durable execution semantics list what happens in each failure case.
- Each task has its own retry and timeout settings, so one unreliable dependency does not fail the run.
- Waits and human tasks hold no worker. A run can wait for a timer, an event, or an approval, and continue when it arrives.
- Two ways to write a workflow. A definition that the server advances from saved state, with workers in Python, Java, JavaScript, Go, C#, Ruby, or Rust. Or a native workflow, a plain Java method that is replayed against the server’s record.
- Low-latency orchestration, when a caller is waiting. A workflow can run synchronously: one request starts it and returns its result. Each request chooses how durable that run is.
DURABLE, the default, stores the request before the run starts.SYNCHRONOUSruns from memory for the lowest latency, and does not survive a server failure. - Operators can act on any run. Retry continues from the failed task. Rerun starts again from a chosen task and keeps the results before it. Restart runs the whole workflow again.
Jepsen tested Orkes Conductor versions 5.3.2 through 5.5.0-rc2 under crashes and network partitions and published its analysis in October 2026. The fixes shipped in versions 5.5.0 and 5.5.6. Jepsen notes that a lock reduces overlapping task attempts and cannot rule them out, which is the at-least-once behavior this guide describes. We wrote about the experience in We asked Jepsen to break Orkes Conductor.
How Conductor differs from Temporal, Restate, and LangGraph
| Compared with | How it resumes | How Conductor differs |
|---|---|---|
| Temporal | Replays Workflow code on Workers that you deploy | A definition is advanced from saved state, with no replay and no determinism rules. It can arrive with the start request, so a workflow built a second ago runs with no deploy. API calls, events, and waits run on the server, and an operator can rerun a run from any task with a corrected input. |
| Restate | Replays handler code against a journal | The whole graph is visible before and during a run, including the steps that have not run yet. Model, MCP, HTTP, and human tasks run on the server, so workers hold only your business logic. |
| LangGraph | Restores a graph’s state from a checkpoint, and runs the interrupted node again | Each task is saved by itself, and a human approval is its own task whose decision becomes output, so resuming does not run earlier code again. One run can hold services, people, and agents from several frameworks. |
Conductor also runs workflows as code, as native workflows, so the choice between a definition and code is made for each workflow and not once for the platform. The comparison pages go through each trade-off with its source.
A checklist for durable workflows
- Is each step the size of a unit of work you would not want to repeat?
- Does every step that writes carry an idempotency key built from stable identifiers?
- Is every step safe when two attempts overlap?
- Does every step have a retry policy, and does it know which errors are final?
- Does every wait have a timeout, and a decision about what happens when it passes?
- Does every step that changes something have an undo step, registered before the step runs, and is it clear where compensation stops?
- Under replay: does workflow code take the time, random values, and IDs from the engine?
- What happens to runs in flight when you deploy a change?
- Are large payloads passed by reference, and are secrets kept out of inputs?
- Can you open one run and see every step, input, output, and attempt?
Frequently asked questions
What is a durable execution engine?
The service that provides durable execution, also called a durable execution platform or framework. It records each step of a run in a store, schedules steps to workers, retries the ones that fail, keeps timers, and resumes runs after a failure. Temporal, Restate, AWS Step Functions, and Conductor are examples.
What are durable workflows?
Workflows that run on durable execution. A durable workflow saves the result of every completed step, so it survives crashes, deploys, and waits of days or years, and continues from where it stopped. A durable workflow engine is another name for a durable execution engine.
Is there an open-source durable execution engine?
Yes, several. Temporal and DBOS Transact are open source under the MIT license, and Conductor, Dapr, and Cadence under Apache 2.0. Others are source-available or offered only as a service, so check the license before you depend on one.
Which languages can I use for durable execution?
It depends on the engine. An engine that replays needs an SDK in the language the workflow is written in. An engine that keeps the state takes a definition that belongs to no language, and runs steps in workers. Conductor has worker SDKs for Python, Java, JavaScript and TypeScript, Go, C#, Ruby, and Rust, and native workflows in Java.
Is durable execution the same as durable functions?
They name the same idea. “Durable functions” is what Microsoft, AWS, and Inngest call functions that run this way. “Durable workflows” are workflows built on it.
What is the difference between durable execution and a workflow engine?
“Workflow engine” names what a system does: it coordinates steps. “Durable execution” names a guarantee: each step is saved before the next one starts, another process can carry on after a failure, and a wait is a record. Engines that keep the state of a definition, such as AWS Step Functions Standard and Conductor, pass those tests. So do code-first engines that replay, such as Temporal and Restate. A job queue or a workflow library inside your process does not.
Does durable execution mean my code never fails?
No. Steps still fail. Durable execution means that completed steps are not lost, and that the run can resume, retry, or be compensated from where it stopped.
Do my steps need to be idempotent?
The ones that change something outside the workflow do. An idempotency key, or a write by a natural key under a unique constraint, makes a second run harmless, including when two attempts overlap.
What is replay in durable execution?
Replay is one way to resume a run. The engine runs the workflow code again from the top and answers every call the run already made from its record, so no finished step runs twice. It requires the workflow code to be deterministic.
Why does workflow code have to be deterministic?
Only under replay. The code runs many times for one execution and is matched against a record of what it did before. If it asks for something different on a later run, because of a random number, the clock, or changed code, it no longer matches the record and the run cannot continue.
Does a long wait hold a thread or a process?
Not in your workers. A durable wait is a record in storage with a time or a condition attached. No worker thread sleeps and no connection is kept open, whether the run is waiting for a timer, a webhook, or a person’s approval. When the wait ends, the engine schedules the next step and any worker can run it.
How is durable execution different from a message queue?
A queue redelivers one message until a consumer acknowledges it. It does not know what came before that message or what should come after. Durable execution keeps the state of the whole run: which steps finished, what they returned, what is waiting, and what runs next.
What is the overhead of durable execution?
One write to storage for each step, and in many engines a trip to a worker. That is small next to a network call to another service and large next to a line of arithmetic, so steps should be units of work you would not want to repeat.
How do I change code while executions are running?
It depends on how the engine resumes. Under saved state, each run keeps the definition it started with. Under replay, either the engine keeps old runs on the old build, or a change that alters steps a run has already passed needs a new version, kept running beside the old one until its runs end.
How long can a durable execution run?
As long as the engine allows. Runs that wait on people or dates commonly last days or months. Some engines set a ceiling, such as one year for an AWS Step Functions Standard workflow, or cap the number of events a run may record.
Is durable execution the same as the saga pattern?
No. A saga is a way to undo finished steps when a later step fails. Durable execution is what makes a saga reliable, because the undo steps are saved and retried like any other step.
When should I not use durable execution?
For work that is short, read-only, and cheap to repeat, such as a search or a page render. Every durable step adds a write, so the benefit has to be worth it: a run that is long, expensive, waits on people, or must not change something twice.
What is durable execution for AI agents?
Running an agent so that each model call and tool call is a saved step. A failed call retries by itself, an approval can take days, and no call whose result was saved is paid for or made again.
Where to go next
- See the durable execution platform page for how Orkes Conductor does it, and follow the durable execution quickstart in the docs.
- Go deeper on the parts of this guide: idempotency and retry safety, the saga pattern, and workflow versioning for long-running executions.
- Read What is workflow orchestration? for the patterns a workflow is built from, and What is AI agent orchestration? for durable agents.


