← Knowledge

Durable Agent Execution

How long-running agent work survives retries, interruption, duplicate delivery, and partial failure.

Durable agent execution is the design of agent workflows that can survive interruption, retries, duplicate messages, and partial failure without losing track of what happened. It applies durable-execution principles from distributed systems to agents that may run for minutes, days, or across several scheduled invocations.

Persisted progress

A durable workflow records its state at boundaries where work can fail or external effects can occur. Before sending a message, charging an account, changing a repository, or starting a remote job, the workflow should persist enough intent to recognize a retry. After the effect completes, it should store a receipt that identifies the observed result.

The difficult case is an effect that succeeds before its receipt is stored. Recovery code must be able to query the external system, deduplicate the operation, or reconcile the missing receipt rather than blindly repeat the action.

Idempotency and timeouts

An operation is idempotent when repeating it produces the same intended state rather than duplicating the effect. Retry logic alone does not make an operation idempotent. Stable operation identifiers, compare-and-swap conditions, content digests, or external idempotency keys are common mechanisms.

A timeout is also a state transition, not proof that nothing happened. Once a timeout becomes authoritative, late success must be reconciled explicitly. Otherwise the workflow can report failure while the outside world records success.

Receipts and resumption

Receipts distinguish planned work from completed work. Useful receipts include message identifiers, transaction versions, commit hashes, deployment releases, test results, and timestamps from the system that performed the effect.

Agent-specific execution adds another variable: the model, code, tools, or memory may change before resumption. A durable workflow should record the workflow version and relevant context assumptions used at each step. Spec-driven development provides the intent and verification layer; durable execution preserves the progress state that connects those artifacts over time.

Persistent runtimes such as Letta Code can schedule and resume work, but durability still depends on explicit state transitions and external receipts rather than the mere existence of a long-lived agent.

Sources

  1. Temporal workflow execution
  2. DBOS durable execution

Connections

Related

Linked here

Suggest a correction ↗