Durable and Asynchronous Agent Work

Michael BrenndoerferDecember 1, 20262 min read
Language AI HandbookAll chapters
Part 49 of 67Long-Horizon Agents and Interoperability
Chapter 376Durable and Asynchronous Agent Work
Reading section 1 of 15 · Durable and Asynchronous Agent Work · 2 minSection 1 of 15 · 2 min

Section 1 of 15 · 2 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

Checkpoints, resumability, queues, idempotency, retries, deadlines, and state across long-running workflows.

You can finish three tool calls and crash before writing the fourth result. The next worker needs to know which steps are safe to run again and which external operations still have an unknown outcome. We will build a small runner that keeps those questions separate.

We will use a local SQLite runner to model recovery across crashes, expired claims, and retries. It replays a committed trace and rejects stale workers’ updates to task events and task state. The result cache is stored separately from that guarded transition. A worker can cache a result even if its subsequent task update is rejected.

  • The checkpointer: how the agent's memory of "where I am" is persisted.
  • The queue/lease layer: how work is dispatched to workers and reclaimed when a worker disappears.
  • The external side-effect boundary handles operations outside the local task-state transaction. An external service may have its own transaction or idempotency contract.

An agent loop can stop between any two steps. Use an event record to resume work from the last committed step and account for any operation that may have run outside that record. Agent Architectures: Control Loops, State & Planning describes the underlying loop.

The plan:

  1. Motivate why long-running agent work needs explicit durability primitives.
  2. Build the concepts: the event log, checkpoints, leases, idempotency keys, retries with backoff, deadlines, and compensation.
  3. Walk a concrete worked example of a crash and a duplicate.
  4. Implement a local SQLite fixture for replay, lease expiry, retry budgets, idempotency, and reconciliation while the store remains open.
  5. Explain when retries can repeat an effect and which guarantees require cooperation from the service performing it.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy