Preserve business progress across process crashes, long waits, retries, and human approvals without duplicating external effects.
Concept overview
Durable execution records enough workflow history to continue a logical process after workers disappear. It separates durable coordination from activities that call models, tools, or external systems. A restarted worker reconstructs the workflow's recorded decisions instead of treating the entire request as a new task.
Durability is not universal exactly-once execution. An activity can perform a remote effect and fail before its result is recorded. External operations therefore need stable identities, idempotency, status reconciliation, and explicit handling of ambiguous outcomes. Model calls belong in recorded activities so replay does not silently generate a different plan.
Why it matters in production
Proof of concept
A proof of concept can checkpoint a short task, but must identify which waits and side effects survive process termination.
Production
Production adds persisted history, bounded activity retries, durable timers, approval signals, cancellation rules, and operation reconciliation for uncertain external results.
Enterprise scale
Enterprise scale requires workflow versioning, history retention limits, worker isolation, queue capacity planning, and migrations for long-running processes already in flight.
Architecture components
Workflow coordinator
Advances deterministic business state using persisted events, timers, and activity results.
History store
Retains workflow decisions and completion records needed for reconstruction and audit.
Activity workers
Run model and tool calls outside deterministic coordination and return structured results.
Signal and approval endpoint
Authenticates external decisions and binds them to the pending workflow revision.
Effect ledger
Tracks stable operation keys, submission status, receipts, and reconciliation obligations.
The architecture, mapped
Crash recovery without blind resubmission — Recorded activity results drive replay; an external effect with an unknown receipt goes through reconciliation.
sequenceDiagram
participant W as "Workflow history"
participant A as "Activity worker"
participant S as "Business service"
W->>A: Schedule operation with stable key
A->>S: Submit approved effect
S--xA: Receipt lost after commit
A--xW: Worker stops before result recorded
W->>A: Resume pending activity
A->>S: Query original operation key
S-->>A: Existing effect receipt
A->>W: Record reconciled completion
Runtime flow
1
Start logical workflow
Assign a business-level workflow identifier and deduplicate repeated start requests for the same operation.
2
Schedule bounded activity
Record the intended activity, timeout, retry policy, and stable operation identity before dispatch.
3
Persist observed result
Store structured tool or model output, including partial or uncertain status, before advancing dependent work.
4
Wait durably
Suspend on a timer or authenticated approval signal without keeping a worker process occupied.
5
Reconstruct after interruption
Replay recorded coordination decisions while reusing completed activity results and respecting the workflow's compatible code version.
6
Reconcile and finish
Resolve ambiguous effects through status queries, then complete or compensate according to the approved business policy.
Multi-day carrier exception recovery
Logistics · Illustrative enterprise scenario, not a reported customer outcome.
Business situation
Illustrative architecture: A shipment recovery process waits overnight for carrier acceptance and then requires dispatcher approval of a revised appointment.
The problem
Keeping the process in memory loses progress on deployment, while restarting it can duplicate reservations.
Agent requirement
Preserve pending ownership, approvals, and reservation receipts across worker restarts and long external waits.
Architecture
A durable coordinator stores carrier responses and appointment operation keys; workers perform calls and the dispatcher sends a version-bound approval signal.
Runtime
Start load workflow
reserve candidate slot
persist receipt
wait for carrier signal
request dispatcher approval
reconcile final booking
Failure scenario
A worker crashes after reserving a slot; recovery queries the original reservation key before another booking is attempted.
Operational impact
Measure completed workflows, age of pending states, duplicate external effects, recovery time, and unreconciled operations rather than assuming retries imply reliability.
Architecture tradeoffs
Decision
Benefit
Cost
Persisted workflow history
Allows progress to survive process loss.
Adds storage, operational complexity, and retention decisions.
Deterministic coordination
Makes reconstruction predictable.
Requires discipline around time, randomness, model calls, and code evolution.
Long-lived approval waits
Avoids keeping workers active while humans decide.
Requires expiry, reassignment, and stale-approval policies.
Failure scenarios & recovery
A code deployment changes replay behavior for an in-flight workflow.