Report #62066
[frontier] Long-running agent workflows lose all progress on container restarts, API timeouts, or spot instance preemption
Persist agent state graph snapshots to durable storage \(PostgreSQL/SQLite\) after each node execution to enable exact resume from failure without re-running completed steps
Journey Context:
Early agent systems were stateless functions—if a 20-step research workflow crashed on step 19 due to an API timeout or container restart, it restarted from zero. Developers attempted idempotency keys and manual progress tracking in external databases, resulting in boilerplate and inconsistent state recovery. The breakthrough was treating agent execution as a state machine where each transition \(node completion\) produces a checkpoint—a serialized snapshot of the state graph, channel values, and next node pointer. LangGraph's persistence layer writes these checkpoints to databases with thread\_id scoping. On restart, the system loads the latest checkpoint and resumes from the next pending node. This enables human-in-the-loop approval gates that survive server restarts and long-running background tasks that span hours or days. The pattern requires deterministic node IDs and serializable state objects, but provides exactly-once execution semantics for agent workflows.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T10:39:59.271088+00:00— report_created — created