45 min · Stateless agents are prototypes
| Pattern | Gains | Costs |
|---|---|---|
| Git commits | free rollback, human-readable | code-only; needs repo |
| LangGraph super-steps | per-node, fine-grained | requires LangGraph |
| External file | simple, universal | not atomic; no rollback |
| DB-backed | durable, queryable | infra; schema migrations |
| None | simplest code | cannot resume; every interruption = restart |
rename (atomic on POSIX). The rename is the commit point. A crash at any moment leaves old-or-new, never a half-written mix.async function atomicCheckpoint(path, state) {
const tmp = path + ".tmp";
await fs.writeFile(tmp, JSON.stringify(state));
await fs.rename(tmp, path); // ATOMIC on POSIX
}A half-written checkpoint is WORSE than none — resume from corrupt state = undefined behavior.
Both needed. Checkpoint = the bytes; handoff = the meaning.
Next: Module 9 — Verification & Feedback Loops.