A publication on the open design questions in agentic systems — rigorous analysis of the tradeoffs that don't yet have consensus answers.

Checkpointing Strategies for Long-Horizon Agent Tasks

Saving agent state at semantic moments prevents compounding errors in multi-step tasks.

· 11 min read
Cover illustration for “Checkpointing Strategies for Long-Horizon Agent Tasks”
State and Persistence · October 3, 2026 · 11 min read · 2,563 words

Most developers meet this problem the same way: a job that was supposed to run for hours dies most of the way through, and the only option the framework gives them is to start over from step one. That failure isn't a bug in one particular agent: most agent architectures were built for tasks that finish in seconds, and long-horizon work exposes assumptions those architectures never had to defend.

LongHorizon-Harness research names three problems that define long-horizon execution. Compounding errors and goal drift happen when an early mistake quietly distorts every choice that follows it. Context rot sets in as the information an agent actually needs gets buried or degraded inside a growing context window. Task-state loss is the simplest to describe and the hardest to fix: the agent loses an accurate picture of what it has already done and what still remains.

None of these problems stay in their lane. A missed state update causes the agent to take the wrong next action. That wrong action gets reasoned about inside a context window that's already degrading, which produces a trajectory that drifts further from the original goal with each step. A small error rate at any single step might look harmless in isolation, but strung across a trajectory of thousands of steps, even a low per-step hazard rate compounds into near-certain failure. That's the mathematical reason long-horizon reliability is a different problem than short-task reliability, not a bigger version of the same one. A longer horizon doesn't make execution more reliable on its own. It sharpens the need for disciplined state management, and checkpointing is the mechanism that provides it.

The two operating regimes that determine what kind of checkpointing a task needs

Before anyone can design a checkpoint strategy, they need to know which kind of long-horizon work they're actually doing. Addy Osmani's framing splits the space into three types, and conflating them is how teams end up with architectures that are wrong for everything they're trying to build.

Long-horizon reasoning covers multi-step, dependent planning, where the binding constraint is model quality. What has to survive here is context coherence across reasoning steps. Long-running execution covers processes that run for hours and invoke a model thousands of times, where the binding constraint shifts to the architecture itself. What has to survive there is durable progress and the ability to recover from failure. Persistent agency is the third regime: agent identity that outlives any single task and accumulates memory across sessions. What has to survive is cross-session state.

Each regime loses something different when it fails. A reasoning task that fails loses coherent context. An execution task that fails loses completed work. A persistent agent that fails loses accumulated identity and preference state built up over time. That difference in what's lost is also a difference in what must be checkpointed, and getting it backward is costly. Checkpointing raw conversation history is the right move for reasoning continuity, where the whole point is preserving how the agent got to its current belief state. Applying that same strategy to long-running execution makes the checkpoint grow too fast to be useful. The rest of this piece builds checkpoint strategy around this regime map, because placement and content decisions that are correct in one regime are actively wrong in another.

What a checkpoint must capture to make recovery possible

A checkpoint has one job: make recovery possible. AgentRewind research makes a precise case for why that job requires more than saving the agent's internal state. Errors in long-horizon execution corrupt two things at once: the agent's context, its beliefs about what has happened, and the environment state, the actual filesystem, configs, and databases it has touched. Restore only the context and the agent is reasoning correctly about an environment that no longer matches its beliefs. Restore only the environment and the agent is sitting in a clean state with a confused picture of how it got there. Either way, recovery fails.

For execution tasks, the minimum viable checkpoint record needs to include which items have already been processed, the intermediate results accumulated so far, the current position in a task list or pipeline stage, and the accumulated context the agent needs to make its next decision. What a checkpoint should leave out matters just as much: the entire model context or raw conversation history. That data grows too fast, and pulling all of it back in on recovery slows the whole process down. Teams that checkpoint full conversation history for execution tasks run into this as a known anti-pattern in production, not a theoretical risk.

Memory layers carry their own, separate checkpoint requirements. Long-term memory, stored in a vector database, holds summarized past interactions, learned preferences, resolved issues, and discovered patterns. It's built for semantic search and kept indefinitely, and it doesn't need transactional checkpoint semantics the way execution state does. The durable record, kept in SQL or object storage, holds audit logs, complete run history, and compliance records. That layer stays immutable and slower by design, kept for legal and governance reasons rather than for agent speed. State can extend further still, down to the operating system or virtual machine level: filesystem, process memory, running services. AgentRewind records aligned checkpoints of the controlled environment specifically to make restoration at that level possible. An append-only event log complements all of this well: treating agent history as something only ever added to, never rewritten, pairs naturally with checkpoints built for rollback and satisfies audit requirements in regulated settings. Where these checkpoints belong in a trajectory is the harder question, and answering it requires context granularity and environment granularity to be built to match each other from the start.

Where to place checkpoints along a long-horizon trajectory

Diagram: The Three Triggers for a Semantic Checkpoint. Visualizes: Visualize the three placement rules for checkpoints along a long-horizon agent trajectory: (1) after every meaningful unit of work — finishing a document, completing a pipeline…

Where a checkpoint gets placed is a decision about the shape of the task itself. The right trigger for a checkpoint is semantic. It fires because something meaningful just happened, not because a clock ran out.

Three principles, drawn from both production practice and research, describe where that semantic trigger should sit. The first: checkpoint after every meaningful unit of work, whether that's finishing a document, completing a pipeline stage, or resolving a sub-problem. That document-or-stage heuristic works as the default for execution tasks because it maps a checkpoint directly onto a unit of completed, verifiable progress. The second: checkpoint at decision branch points, right before the agent commits to a path that would be expensive or hard to reverse. Those branch points are exactly where a rollback target carries the most value, because reversing a decision after it's been acted on costs far more than reversing it before. The third: checkpoint before irreversible environment actions, like deleting files, committing to a database, or calling an external API with side effects. AgentRewind's design captures environment state at precisely these moments, because they're the points where a degraded environment actually originates. If a checkpoint is skipped here, the agent has no clean state to fall back to once the irreversible action has already happened.

There's a real tradeoff in all three principles. Checkpoint too often, and the overhead of writing state starts to outrun the actual work getting done. Checkpoint too rarely, and the amount of progress lost on recovery becomes unacceptable. The right interval depends on the shape of the task, not on some universal number that works across every pipeline.

LongHorizon-Harness gives a concrete answer to how these three principles work together, through its Manage-Execute-Audit loop. A manager maintains the task state. A fresh-context executor performs the next subtask without inheriting the clutter of everything that came before. A read-only auditor checks what actually changed in the environment before the next round begins. Audit reports become the only memory that carries across rounds, functioning as verified checkpoint transitions rather than the agent's own self-reported sense of progress. That distinction matters: a self-report can be wrong in exactly the way that compounds errors, while an audited transition can't drift from what actually happened in the environment. By externalizing task state and auditing it rather than letting it accumulate inside a growing context, LongHorizon-Harness stops incorrect self-assessments from propagating into later decisions, which research identifies as the core failure mode behind single-session long-horizon execution. A systematic evaluation of seven frontier models across 36 long-horizon tasks found that harness choice materially affects performance stability. Placement is also a reliability mechanism for keeping things from going wrong in the first place.

Wiring checkpointing into the agent runtime

Everything described so far is a design question: what to capture, where to place it. Durable execution platforms make checkpointing a property of the runtime itself rather than something a developer has to hand-roll inside application code.

Temporal is one well-known example, built around a determinism model where workflow code gets replayed from an event history to reconstruct state after a failure. Sherlocks AI picked Temporal specifically for infrastructure scans that run over an hour: a full scan of a customer's cloud environment can take 30 minutes to two hours because of API rate limits and quotas, which makes retries and checkpointing essential rather than optional.

Restate takes a different architectural path. Built by the creators of Apache Flink and written in Rust, it deploys as a single binary. Its key differentiator is that it logs the results of steps rather than replaying deterministic code to reconstruct them. That difference carries real consequences: fewer determinism constraints on the code being run, and the ability to call external APIs directly inside a durable function, without the strict activities-only split that Temporal's model requires.

Whichever platform a team picks, the runtime gives agent state identity, isolation, durability, and recovery. That's distinct from the framework that defines the agent's logic, and distinct again from the model that powers its reasoning. Separating these layers is what makes checkpoint logic composable across different tasks, instead of something rebuilt from scratch for every new workflow.

The versioning hazard: how code changes silently corrupt running checkpoints

Putting checkpointing in place solves one problem and quietly opens another. Once a runtime can checkpoint and replay state, deploying new agent code turns into a correctness risk for every workflow still in flight.

Temporal's determinism model shows how this plays out. When new agent code gets deployed, workflows that are already running keep following the code paths they started on. Sherlocks AI ran into this directly: an investigation that's already underway keeps executing the version of the logic it began with. A bug fix or a logic change doesn't take effect for that in-progress task unless the team has built explicit version branching to handle it.

Temporal does offer versioning primitives to manage this, but they need to be planned for from the start of a project, not bolted on once workflows are already running. The system doesn't handle versioning automatically by default. Newer Worker Versioning features do offer opt-in auto-upgrade behavior, but retrofitting versioning logic onto an architecture that wasn't built with it in mind is difficult in practice. The practical fix is to treat a version identifier as a first-class field in every checkpoint, not an afterthought added once something breaks. If that step is skipped, a checkpoint restored after a deploy may get replayed against logic it was never tested against. This connects directly back to the append-only event log described earlier: recording which code version executed each step is what makes root-cause analysis tractable after a failure, particularly in regulated environments where the audit trail has to hold up legally.

Recovery logic

A checkpoint by itself is just a snapshot sitting on disk. It only becomes useful once the runtime knows when to trigger a rewind, how far back to go, and what to carry forward from the attempt that failed.

AgentRewind's design answers all three questions directly. The trigger isn't a crash signal; it's a progress-estimate signal: the system rewinds when the agent determines it's unlikely to make further progress along its current trajectory. Recovery can start proactively, before the agent runs itself into a dead end. Target selection works by having the agent choose an earlier checkpoint from the recorded trajectory, informed by the full history of what's already been tried. Context carry-forward works through what AgentRewind calls "rewind memory": a retained summary of the previous attempt, so the agent resumes already knowing what failed and why, instead of walking straight back into the same mistake.

AgentRewind's own ablation studies point to the sharpest finding in this whole framework. Rolling back without restoring both environment and context makes recovery worse, not better. Remove context rewind and discarded actions along with failed-attempt history stay lodged in the agent's context, interfering with whatever decision comes next. Removing environment rewind instead makes the degradation even larger. Environment state and agent context have to be restored together, as aligned checkpoints, or the recovery attempt leaves the agent in worse shape than the failure did. That requirement reframes the whole discipline: the goal was never just to save state. It's to save aligned state, where the environment and the agent's understanding of it stay in sync at the exact moment the checkpoint was taken.

Three human-in-the-loop patterns can serve as recovery triggers of their own, layered on top of this automated logic. Pre-execution approval pauses the agent before a potentially consequential or irreversible action, functioning as a mandatory checkpoint gate. Post-execution review lets the agent act, but surfaces the results for inspection before they get committed or the agent moves on, which allows a rollback before the checkpoint is sealed. Escalation triggers let the agent run autonomously under normal conditions, but halt and request human input when specific risk signals fire, such as actions involving sensitive data, irreversible operations, or confidence that drops below a set threshold. None of this comes free. Engineering teams building human-in-the-loop recovery have to build systems that securely pause and persist active workflow state for potentially long durations, manage asynchronous waiting without burning through resources, and handle the notification and response logic that resumes the loop once a human approves. That infrastructure has to be designed in from the start, not added on after the fact once a team discovers it's missing.

Memory governance as a checkpoint for state mutations

Memory writes carry the same corruption risk as any other environment action, because they're state mutations in exactly the same sense. An agent writing a new preference or fact into long-term memory is doing the same kind of thing as an agent committing to a database: making a change that's hard to undo once it propagates into later decisions. That means memory writes deserve the same checkpoint-and-review discipline already built for execution state.

The memorywire governance pattern applies this directly, through human-in-the-loop diff-and-approve review for memory writes. When an agent proposes writing a new memory, the system computes a structured diff between the proposed write and the memory's current state, then presents that diff to a human reviewer before the write takes effect. A checkpoint that only covers filesystem and database state while leaving memory writes ungoverned has a gap in exactly the place where an agent's long-term identity and accumulated preferences live. Aligned checkpoints, built earlier in this piece around environment and context, extend naturally to memory: the same principle that keeps an agent from rewinding into a worse state applies when the state in question is what the agent believes about itself and the people it's working for.

Sources

  1. Beyond Final Scores: A Systematic Evaluation of Agents for Long-Horizon AI Research and Development
  2. LongHorizon-Harness: Advancing Long-Horizon Agents for Real-World Tasks
  3. AgentRewind: Recoverable Execution for Long-Horizon LLM Agents
  4. The Horizon Gap: Planning, Memory, Execution, Training, and Evaluation for Long-Horizon LLM Agents

More in State and Persistence