AgentRewind: A Recoverable Execution Framework for Long-Horizon LLM AgentsAgentRewind: Recoverable Execution for Long-Horizon LLM Agents
AgentRewind rolls back to aligned checkpoints; GPT-5.4 success rate on MettleBench rises from 62.2% to 87.8%.
- Early errors in long-horizon agents enter the context and environment, making subsequent actions difficult to reverse. Plan correction and safety checks mainly reduce errors and provide insufficient support for recovery after errors.
- AgentRewind records aligned context and workspace checkpoints at LLM decision boundaries. After the agent selects an earlier checkpoint, the system restores both sides' states and injects accumulated rollback memory, then generates a new execution suffix.
- On MettleBench, GPT-5.4 has an AgentRewind success rate of 87.8% and progress of 94.3%. Continue with the same setting is 62.2% and 81.4%. Removing environment rollback drops it to 43.9%; the recovery rate at 50 failed endpoints is 30.0%, while Continue is 8.0%.
- The authors note that currently only controlled states are restored, and they rely on external validation to identify stagnation; future directions are cross-system recovery and models with internal progress evaluation. The four-strategy comparison uses GPT-5.4 and GPT-5.4 mini.
- Evaluated models
- GPT-5.4GPT-5.4 miniQwen3.7-MaxQwen3.5-27BKimi K2.5DeepSeek-V4-FlashGLM-5.1
- Benchmarks
- MettleBenchTerminal-Bench 2.0
- Metrics
- task success rateaverage checklist progressaverage trace lengthrecovery ratechecklist progress change
The researchers propose AgentRewind, a runtime recovery framework that, by recording checkpoints aligned with the agent context and controlled environment, allows the agent to return to an earlier state and continue execution using information from previous attempts, to address the problem that in long-horizon tasks early errors propagate through the context and environment state, making subsequent actions difficult to reverse. The authors also build MettleBench to evaluate task completion and partial progress on long-horizon engineering tasks containing a series of related requirements. Experiments across multiple tasks, models, execution strategies, and agent harnesses show that AgentRewind improves task success rate and average checklist progress compared to baseline methods. The paper is 19 pages with 5 figures, posted on arXiv (2608.14380).
Paper analysis
What problem does this paper attempt to solve?
Early errors in long-horizon execution contaminate both the context and the environment, and existing methods lack recovery after errors.
In long-horizon execution, early errors enter both the agent's context and the controlled environment, and subsequent actions often cannot pull the trajectory back to a completable state.
- Scenario: The authors believe real tasks often require long-horizon tool interaction, such as iterative scientific experiments, cross-application workflows, and repository-level software engineering. Early erroneous plans, deletion of key files, or contamination of configuration and databases cause later steps to continue in a degraded environment.
- Existing Gaps: The authors state that existing methods mainly reduce errors through pre-execution plan correction and in-execution safety checks. Even if the per-step error probability is low, cumulative failure risk grows with trajectory length, and recovery support after errors is insufficient.
- Observation: Standard execution can only extend the trajectory forward. Erroneous prefixes enter subsequent context and environment states; even if the agent later recognizes the error, it can only append corrective actions, which may not fully reverse already-occurred state changes.
- Proposed System: The authors propose a runtime framework, AgentRewind, that records aligned context and controlled-environment checkpoints, allowing the agent to return to an earlier state and continue with a summary of previous attempts. They also build MettleBench to evaluate completion and partial progress on long-horizon engineering tasks with a series of related requirements.
What related research exists?
Related work is divided into long-horizon evaluation, execution-time reliability, and agent- or system-level rollback.
Long-horizon interaction evaluation
- Embodied, science, and web: ALFWorld, ScienceWorld, WebShop evaluate long-horizon interaction in their respective environments (Shridhar et al. 2021; Wang et al. 2022; Yao et al. 2022).
- Programming and databases: InterCode and SWE-bench study interactive programming and repository-level software engineering (Yang et al. 2023; Jimenez et al. 2024; Yang et al. 2024). Spider 2.0, CoSQL, BIRD-INTERACT focus on multi-turn database tasks (Lei et al. 2025; Yu et al. 2019; Huo et al. 2026).
- Computer use: TheAgentCompany and Odysseys extend evaluation to realistic computer use tasks. The authors state that even strong models often fail to complete long-horizon tasks (Xu et al. 2025; Jang et al. 2026).
Execution-time reliability
- Action generation: The paper names ReAct, SayCan, LATS, stating that they use reasoning, planning, search, and environment models to guide behavior; the same paragraph also cites Erdogan et al. 2025, Zhou et al. 2024, Koh et al. 2025, Chae et al. 2025.
- Risk monitoring: Wang, Poskitt and Sun (2026), Xiang et al. (2025), Liu et al. (2026) identify risky behavior during execution. The introduction places plan correction and safety checks side by side, stating that they provide insufficient recovery after errors disrupt execution.
- Previous attempts: Self-Refine, Reflexion, ExpeL use feedback from previous attempts to modify subsequent decisions (Madaan et al. 2023; Shinn et al. 2023; Zhao et al. 2024). Zhu et al. (2025) and Barke et al. (2026) diagnose failure causes from completed trajectories. The authors state that these methods provide little support for recovery after errors occur mid-execution.
Rollback
- Agent rollback: GA-Rollback performs stepwise recovery in replayable environments (Li et al. 2025); WebRollback specifically handles browser navigation (Zhang et al. 2026). The authors state that DART selects semantically valid recovery points for structured tool agents but relies on explicit control flow and recovery boundaries, limiting applicability to open-ended trajectories (Yang et al. 2026b).
- System-level checkpointing: DMTCP and CRIU restore process state (Ansel, Arya and Cooperman 2009; CRIU Project 2026). DeltaBox extends such mechanisms to agent sandboxes to roll back file system and process state (Dong et al. 2026). The authors state that these systems mainly provide low-level rollback rather than agent-level recovery processes for long-horizon execution.
Baselines and benchmarks
- Baseline methods: Continue, Restart with Experiences, Safety Review (reviewing each proposed tool action with AgentDoG), and AgentRewind.
- Benchmarks: The main evaluation is MettleBench, with 82 tasks, artifacts sourced from Terminal-Bench 2.0, ProgramBench, SWE-bench, ProjectEval, GitTaskBench. Three strategies are also compared on all 89 tasks of the full Terminal-Bench 2.0.
The authors place the distinction in simultaneously recovering context and the controlled environment, and preserving rollback memory of previous attempts, enabling the agent to return to an earlier checkpoint and take a different suffix when the current trajectory cannot continue.
How does the paper address this problem?
AgentRewind records alignment checkpoints, rolls back context and workspace, and injects cumulative rollback memory.
AgentRewind sits between the agent and the controlled external environment: during normal execution it transparently records the trajectory, and during rollback it restores both sides to the same checkpoint and injects accumulated rollback memory.
Forward Execution and Checkpoints
- Loop: Given instruction x, the agent changes the controlled environment through tools. At step t, decision u_t is produced from context c_t, the environment transitions to the next state and observation, and the context incorporates that decision and observation.
- Checkpoints: Each LLM decision boundary records a recoverable checkpoint. dt=(ct,st) denotes the aligned context and environment state at that time. Metadata η_t describes the segment between d_t and the next checkpoint and is used to show the agent selectable locations.
- Cannot Just Remediate Forward: Trajectories only grow under standard execution. Errors introduced by early decisions enter subsequent context and states, and later actions are appended after the erroneous prefix.
Rollback Action
- Selection: When the agent judges that the current trajectory cannot advance further, it selects d_k based on context and metadata, where k does not exceed the current step, and generates rollback memory m from the current trajectory.
- Memory: m is incorporated into the history set M. The authors give the example that memory can summarize hypotheses already rejected and alternative strategies.
- Continue After Recovery: The environment returns to s_k, and the context is changed to the result of injecting all of M into c_k, then a new suffix is generated from there. The preserved prefix is restored from execution logs, not regenerated or re-executed, so prefix side effects are not triggered again.
- Two Tools: backtrack_candidates lists LLM records that can serve as targets; backtrack_commit commits the target with a memory note. Tool results are not returned to the current loop but are intercepted by the runner outside the session, which then restarts. Appendix Figure 8 gives the tool definitions.
What Is Recorded and Recovery Boundaries
- Recording: Task instruction, LLM inputs and outputs, tool calls and results, and controlled-environment changes caused by tools. Recording itself does not alter normal interaction.
- Workspace: The recoverable controlled environment is the workspace directory tree, whether run locally or in an isolated container. Checkpoints record file-level changes; rollback undoes subsequent modifications, restores deleted files, and deletes newly created files.
- Boundaries: Effects outside the workspace filesystem cannot be undone; the authors list network requests, external service calls, and external runtime state. Appendix C.5 states that .git inside the workspace is not snapshotted by default; .git in subdirectories has separate copies, and the workspace root .git remains unchanged after rollback. Among the 82 tasks, 4 place the repository in a subdirectory and are therefore fully recoverable, including all tasks involving history rewriting; 2 tasks are themselves repositories; 76 contain no repository. Empty directories and permission bits other than the executable bit are also not restored.
How MettleBench Defines Tasks
- Composition: 82 tasks retain engineering artifacts and executable environments from five sources, and instructions are rewritten into tasks with a series of related requirements. Tasks are written as instruction, initial state, decision space, and ordered acceptance criteria. There are 640 criteria, 5 to 12 per task, with mean 7.80 and median 7 (Appendix Table 7).
- Success: The final state is successful only if it satisfies all criteria.
Succ(s_T)=\bigwedge_{i=1}^{n}(g_i(s_T)=1)expresses this condition. Partial progress is the length of the longest satisfied prefix divided by the total number of criteria, used to distinguish how far incomplete tasks got. - Submission Protocol: The checklist is hidden from the agent. Each submission returns only natural-language feedback on the first unsatisfied item, without naming the command, script, or checklist internals that caused the failure. Items share the environment; satisfying one may help or hinder later items, and later actions may invalidate earlier items. The benchmark does not require any recovery mechanism.
- Admission: Criteria are drafted by LLM agents under the authors' specified protocol and included after passing deterministic checks. Reference solutions must satisfy all criteria in one pass; runs violating dependency order must fail on the item whose prerequisite was removed; the delivered workspace must fail. Appendix A.6 also requires at least four ordered stages, at least five criteria, at least two references in later deliverables to runtime values from earlier stages, and either a continuously exposed defect or at least 30 records to be rebuilt. The authors perform task-level review, not item-by-item manual annotation; adversarial LLM review dimension scores range from 3.65 to 5.00, and every reviewed task is accepted (Appendix A.2).
What experiments did the paper conduct?
On GPT-5.4, AgentRewind's MettleBench success rate rises from 62.2% to 87.8%.
Experimental Setup
- Models: The Continue baseline covers GPT-5.4, GPT-5.4 mini, Qwen3.7-Max, Qwen3.5-27B, Kimi K2.5, DeepSeek-V4-Flash, and GLM-5.1. The four-strategy comparison uses only the first two. Unless otherwise noted, experiments use GPT-5.4 and mini-SWE-agent.
- Data and Evaluation: MettleBench has 82 tasks and 640 criteria; success is determined by the task's own Python checker, not LLM review. Appendix A.5 states that among the 82 checkers, only one that waits for a local gRPC startup may be affected by timing. Terminal-Bench 2.0 has 89 tasks, and its criteria have no semantic order.
- Strategies: Continue continues in the current context and environment. Restart with Experiences resets the environment to the initial state, and the new attempt carries only failure experiences. Safety Review, in addition to Continue, uses AgentDoG1.5-Qwen3.5-4B to review each proposed tool action before execution; if judged unsafe, it is not executed; monitor errors or unparseable output also block as unsafe. AgentRewind uses recoverable execution.
- Metrics: Task success rate is the proportion of tasks satisfying all criteria before termination. Average checklist progress is the mean of per-task prefix progress. Trajectory length is the number of recorded LLM and tool events. Terminal-Bench partial completion is the average proportion of satisfied criteria per task. Recovery experiments additionally report recovery rate and checklist progress change relative to the shared endpoint, in percentage points.
- Termination and Decoding: No wall-clock time, step, or token limits are preset. If the same first unsatisfied criterion appears in five consecutive submissions, the run terminates and is recorded as a failure. Model request timeout is 600 seconds. Temperature is 0.0; only Kimi K2.5's Continue baseline uses 0.6 as specified by its no-thinking mode.
- Replication: The main comparison of four strategies times two models runs each configuration independently 3 times (Appendix Table 10). The seven-model Continue comparison in Table 1 does not state replication counts. Rollback experiments show 80 candidates per rollback, with no limit on rollback count.
Main Results
The table below shows mean ± sample standard deviation after two runs terminate, n=3 (Table 13). SR is task success rate, and progress is average checklist progress.
| Strategy | GPT-5.4 SR | GPT-5.4 Progress | mini SR | mini Progress | | Continue | 62.2%±2.1 | 81.4%±1.0 | 33.7%±0.7 | 64.6%±1.1 | | Restart with Experiences | 78.0%±2.4 | 88.8%±1.2 | 43.1%±1.4 | 64.5%±1.3 | | Safety Review | 34.1%±1.2 | 54.4%±2.1 | 36.2%±1.9 | 64.5%±0.8 | | AgentRewind | 87.8%±1.2 | 94.3%±0.5 | 51.2%±4.2 | 73.5%±3.0 |
- Continue Model Range: In Table 1, success rates across seven models range from Kimi K2.5's 28.0% to Qwen3.7-Max's 73.2%, checklist progress from 61.3% to 84.8%, and average trajectory length from GPT-5.4's 50.5 to DeepSeek-V4-Flash's 337.2. The authors state that no model completes the benchmark, and longer trajectories do not guarantee better progress or completion. The text states that GPT-5.4 and GLM-5.1 have similar success rates, but their checklist progress on unsuccessful runs is 50.8% and 38.1%, respectively; the paper does not state the replication counts for these two numbers.
- Authors' Interpretation of Strategy Curves: The authors state that all strategies rise early in execution and diverge after persistent failures; Continue enters a plateau earliest, Restart's final success rate is higher than Continue's, but checklist progress gains are inconsistent and more variable. The authors state that Safety Review is clearly worse on GPT-5.4 and comparable to Continue on mini. The authors state that AgentRewind continues to rise after baselines plateau, with less progress rollback than Restart. The x-axis of Figure 3 is truncated at 1000 records in Appendix B.6, and the gain annotations in the figure may differ slightly from Table 13 after termination.
- Paired Tests: Appendix D pairs by task (n=82), aggregates replicate runs, then performs two-sided Wilcoxon signed-rank tests. All 12 comparisons favor AgentRewind in direction, with effect sizes r from 0.34 to 1.00; after Holm correction, 11 reach α=0.05. The exception is task success rate on GPT-5.4 mini relative to Restart with Experiences, pHolm=0.102; the checklist progress comparison for the same pair reaches the threshold.
Cross-Harness and Terminal-Bench 2.0
- Three Harnesses: The base model is fixed to GPT-5.4. On mini-SWE-agent, AgentRewind is 87.8% (+25.6 percentage points) and 94.3% (+12.9 percentage points); FnCallAgent goes from 58.5%, 77.9% to 81.7% (+23.2), 91.4% (+13.5); CodeAgent goes from 67.1%, 83.0% to 82.9% (+15.8), 89.7% (+6.7) (Table 3). The authors believe the gains come from added runtime recovery, not any single harness.
- Terminal-Bench 2.0: In Table 2, Continue is 78.7% and 88.7%, Restart with Experiences is 70.8% and 79.2%, and AgentRewind is 83.1% and 90.2%. Restart is lower than Continue on both. The text states that GPT-5.4 is used unless otherwise noted; Appendix B.2 states that this experiment uses the base model settings from Table 10, and Table 10 lists two models. Table 2 has only one row per strategy, and the paper does not state which model that row corresponds to, or whether it is combined.
- Trajectory Grouping: Figure 4 groups by tertiles of the median Continue trajectory length across three runs for each model. The authors state that the advantage over the strongest baseline is smaller in the short-trajectory group and larger in the medium and long groups; the text does not give gain numbers for each group.
Failed-Endpoint Recovery, Ablations, and Case Study
- Same Failed Endpoints: Context and workspace are copied from 50 Continue trajectories terminated due to repeated failures; both sides receive the same recovery prompt, and failure counts reset independently; only the AgentRewind side can use rollback (Appendix Table 11, GPT-5.4, mini-SWE-agent). Recovery rate goes from 8.0% to 30.0%, and checklist progress change from 5.1 to 12.2 percentage points (Table 4). The authors state this is recovery from the same repeated-failure states.
- Removing One Component: The full system is 87.8% and 94.3%. Removing environment rollback is 43.9% and 63.5%, removing context rollback is 65.9% and 77.9%, and removing rollback memory is 51.2% and 69.4% (Table 5; Appendix Table 12 specifies GPT-5.4, mini-SWE-agent, 82 tasks). The authors state that removing environment rollback causes the largest drop and that aligned two-sided recovery and rollback memory serve complementary functions.
- Astropy FITS Case: The subject is GPT-5.4 mini. Continue fixes the library but then generates directories with an incorrect pattern, ending with checklist progress of 9/10. Restart with Experiences performs 26 restarts, each restoring the original fixture but also discarding the completed library fix, ending at 8/10. AgentRewind first reaches 8/10, then returns to a checkpoint before directory generation, preserving the verified library fix and restoring the original fixture, then passes all 34 tests, reaching 10/10 (Figure 5).
Other Ablations and Analyses
- Sensitivity: When paired by individual run, Appendix D states that all items reach α=0.05 without correction, with the maximum p being 8.6×10 to the -3. After combining runs, the McNemar test reaches the threshold on all six items, with the maximum p being 1.3×10 to the -2; relative to Continue, on GPT-5.4, the counts of one side succeeding while the other fails are 69 versus 6.
- Run Consistency: Among 656 task–strategy–model combinations in the main comparison, 490 (74.7%) have identical success or failure across three runs. Cell-level values range from Safety Review plus GPT-5.4's 48.8% (40/82) to Restart with Experiences plus GPT-5.4's 90.2% (74/82). The authors state this is an upper bound on run-to-run variability, not an estimate of checker noise.
- Solvability Without Rollback: Some model solves at least 70/82 under Continue; some execution strategy solves at least 79/82. The authors state that tasks no run solves are difficult, not unsolvable, because reference solutions satisfy all criteria (Appendix A.4).
- Reference Solution Form: All 82 reference solutions are linear scripts without rollback or retry, with non-empty line mean 79.3, median 71, range 16 to 220, and they pass all criteria on the first attempt in a fresh workspace.
What are some points that can be further explored?
The authors point out that currently only controlled state is restored, and external validation is relied upon to determine whether execution has stalled.
Limitations and Future Directions Noted by the Authors
- Only Controlled States Are Restored: The Conclusion states that AgentRewind currently restores only controlled states. The recovery boundaries in the text list network requests, external service calls, and external runtime state outside the workspace filesystem as effects that cannot be undone.
- Reliance on External Validation: The Conclusion states that it relies on external validation to identify stagnant execution.
- Cross-System Recovery: The Conclusion proposes that future work may extend recovery across systems.
- Internal Progress Evaluation: The Conclusion proposes that future work may develop rewind-aware models with internal progress evaluation.
Experimental Coverage
- Continue Baseline: Table 1 reports success rate, average checklist progress, and average trajectory length for seven base models on MettleBench's 82 tasks; the table does not state replication counts.
- Strategy Comparison: The comparison of Continue, Restart with Experiences, Safety Review, and AgentRewind uses GPT-5.4 and GPT-5.4 mini, with 3 runs per configuration, on the same 82 tasks (Appendix Table 10, Table 13). Safety Review's monitor model is stated as AgentDoG1.5-Qwen3.5-4B.
- Harnesses: Table 3 compares mini-SWE-agent, FnCallAgent, and CodeAgent, with the base fixed to GPT-5.4, comparing only Continue and AgentRewind per harness.
- Another Benchmark and Recovery: Table 2 compares three strategies on Terminal-Bench 2.0's 89 tasks; the base model correspondence is not stated in a single row. Paired recovery uses 50 failed endpoints, and component ablations use GPT-5.4 plus mini-SWE-agent on 82 tasks (Appendix Table 11, Table 12).
- Reported and Unreported Quantities: The termination condition is uniformly five identical first failures, with no preset step, wall-clock, or token limits. Appendix D reports task-paired Wilcoxon tests, Holm correction, and McNemar sensitivity analyses. The paper does not report token usage per strategy.
Summarize the main content of the paper
Aligned rollback improves success rate and checklist progress on long-horizon tasks; removing environment rollback causes the largest drop.
AgentRewind is a runtime recovery layer for long-horizon LLM agents, and MettleBench measures engineering tasks with a series of related requirements.
- Difficulty Addressed: Early errors are written into the context and controlled environment. The authors believe plan correction and safety checks mainly reduce errors but lack recovery means for already-disrupted execution.
- Approach: Aligned checkpoints are saved at each LLM decision boundary. After the agent selects a historical checkpoint, the system restores the prefix from logs, rolls the workspace directory tree back to that point, and injects accumulated rollback memory, then generates a new suffix. Network requests, external services, and external runtime state outside the workspace are not undone. Task success requires the final state to satisfy all ordered criteria, and partial progress is computed as the longest satisfied prefix.
- Main Comparison: MettleBench has 82 tasks. On GPT-5.4, AgentRewind's success rate and checklist progress are 87.8% and 94.3%, while Continue is 62.2% and 81.4%; on GPT-5.4 mini, the success rate is 51.2% versus 33.7% (Table 13, means of three runs). The authors state that on both models it is higher than the strongest baseline in that cell. Safety Review is lower than Continue on GPT-5.4.
- Other Evidence: Both metrics improve across three harnesses (Table 3, GPT-5.4). At 50 identical failed endpoints, recovery rate goes from 8.0% to 30.0% (Table 4). Removing environment rollback, context rollback, or rollback memory gives success rates of 43.9%, 65.9%, and 51.2%, respectively (Table 5). The authors state that environment rollback causes the largest drop and that the three components are complementary.
- Authors' Conclusion: The authors state that the framework improves task success rate and checklist progress in long-horizon settings. They also note that it currently only restores controlled states and relies on external validation to identify stagnant execution.