NOTES / HARNESSES

State and checkpoints

How a harness saves progress so a run can pause, resume or recover: checkpoints within a run, files across context windows, and what to persist.

UPDATED 18 NOV 2026#harness#state#checkpoints#durable-execution

Agents run for a while and fail in the middle: a model call times out, a process restarts, a person has to approve something tomorrow. If the only copy of the run’s state is in memory, any of these loses everything. This note covers the two kinds of persistence a harness needs.

1. Within one run: checkpoints

Durable execution means a process saves its progress at key points so it can pause and later resume exactly where it left off, even after a long delay1. LangGraph builds this on checkpoints: with a checkpointer attached, it saves a snapshot of the graph state at each step, organised into threads2.

Diagram: a thread of steps start, plan, tool call, review and end, each followed by a numbered checkpoint; a crash after the third checkpoint resumes from it

Diagram: my own, illustrating the checkpoint idea in 2.

What this buys, according to the LangGraph docs2:

  • Fault tolerance: a failed run restarts from the last good checkpoint, and if some parallel steps already finished before a failure, their results are kept so they are not run again.
  • Human-in-the-loop: the run can stop, a person can inspect or edit the state, and it resumes (Human-in-the-loop).
  • Time travel: you can replay or fork from an earlier checkpoint to explore a different path.
  • Conversation continuity: the thread ID is the key to load earlier state.

One caveat: an in-memory checkpointer loses everything when the process restarts, so production needs a persistent store2. Resuming also means steps may be repeated, so side effects (sending an email, charging a card) should be idempotent or wrapped so their results are replayed, not re-run1.

2. Across context windows: files

Checkpoints help one orchestrated run. A different problem is work that spans many context windows, such as a coding agent working for hours. Anthropic frames the core difficulty: such agents work in discrete sessions, and each new session starts with no memory of what came before3. They compare it to engineers working in shifts with no handover.

Their fix is to leave clear artifacts for the next session, mimicking what good engineers do3:

Diagram: an initializer session creates init.sh, a feature list, a progress file and a first git commit; later coding sessions read them, do one feature, then commit and update the progress file

Diagram: my own, after the pattern in 3.

  • An initializer session sets up the environment once, including a script to start the app, a feature list and a progress file, and makes the first commit.
  • Each coding session reads those artifacts, works on one feature, leaves the code in a clean state, commits with a descriptive message and updates the progress file.

Anthropic also notes that compaction alone is not enough: agents tended to try to do too much in one session and ran out of context mid-feature, leaving the next session a half-built, undocumented mess3. A feature list gives an external definition of “done”, so the agent cannot just declare victory.

Short-term versus long-term state

Do not confuse the two stores. Checkpoints are scoped to a thread. Cross-thread facts, such as a user’s preferences, belong in a separate long-term store; LangGraph, for example, separates checkpointers from a store for information that outlives a thread1.

Diagram: thread-scoped checkpoints for one conversation versus a long-term store for facts shared across threads

Diagram: my own, after the distinction in 1.

What goes into the model’s window from these stores is a context engineering question: see Short- and long-term memory.

Persisting in production

Anthropic’s multi-agent research team describes the same need at scale: agents run long and stateful, so errors compound, and they built systems that can resume from where an agent was instead of restarting, along with full tracing of agent decisions to debug non-deterministic behaviour4. In short: save state at step boundaries, keep external artifacts for anything that must outlive a context window, make side effects safe to replay, and trace what happened.

Sources

  1. [1]Durable execution — LangChain, LangGraph documentationPARAPHRASED
  2. [2]Checkpointers (persistence) — LangChain, LangGraph documentationPARAPHRASED
  3. [3]Effective harnesses for long-running agents — Justin Young and others · Anthropic Engineering · 2025PARAPHRASED
  4. [4]How we built our multi-agent research system — Anthropic Engineering · Anthropic · 2025PARAPHRASED

© Ashish Kumar. All rights reserved. Quoted and cited material belongs to its owners. How I attribute sources.

Product, company and framework names are trademarks of their respective owners. Mentioning them does not imply affiliation or endorsement.