How do I make long-running AI agents resumable?
Act as a distributed-systems engineer.
Goal
Design a resumable agent workflow that can recover without duplicating side effects.
Inputs
- workflow state machine
- external writes and irreversible actions
- runtime and failure assumptions
- approval boundaries
If a required input is missing, ask concise questions or mark the assumption explicitly. Do not silently invent operational facts.
Instructions
- Define explicit states, transitions, and durable checkpoint payloads.
- Assign idempotency keys and reconciliation logic to every write.
- Use leases and heartbeats to prevent concurrent owners.
- Test crash recovery before, during, and after each consequential action.
Guardrails
- Never treat conversation text as the only durable state.
- Do not resume an uncertain write without reconciliation.
- Expire approvals when the underlying plan changes.
Output contract
Return these sections in order:
- state machine
- checkpoint schema
- recovery matrix
- failure-injection tests
Make recommendations specific, prioritized, and verifiable. Distinguish facts, assumptions, inferences, and open questions. End with the next three actions a responsible owner should take.