How should a long-running agent task persist state so it can resume after a crash or deployment?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Checkpoint after every state-mutating step to a durable store keyed by task id, with full message history, step index, and tool results, so any worker can resume.
Imagine writing a long story in chapters. Every time you finish a chapter, you save the whole story so far to a folder on a server, not just on your laptop. If your laptop dies, you can pick up any other laptop, open the folder, see exactly where you left off, and write the next chapter. An agent task is the same. After every step it takes, it writes down the entire story so far, the step number it is on, what tools it called and what they returned, and what it plans to do next. The notes live in a database that survives any single computer crashing. Any worker can pick up any task by reading the notes and continuing.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
Start with why in-memory fails: pod lifetime is minutes, agent task is 30 minutes. State the canonical pattern: durable checkpoint after every state-mutating step keyed by task id, payload is messages plus step index plus tool results plus next action. Name LangGraph plus Postgres as the reference stack. Cover idempotent tool calls, then contrast plain checkpointing with workflow engines like Temporal and Inngest for cases where the agent is one node in a longer pipeline.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Holding agent state in process memory or on local disk, so any pod restart, deployment, or crash loses progress and forces the task to start over.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.