arXiv(opens in a new tab)cs.AIAug 2026Cited by 6 papers on PaperVantage

Manuscript Offprint

arXiv:2608.14380

AgentRewind: Recoverable Execution for Long-Horizon LLM Agents

Yu Zhuang, Kefei Chen, Yitong Duan, Shuxin Zheng, Jian Li, Xu-Yao Zhang

Abstract

Many real-world tasks require LLM agents to interact with their environments over long execution horizons. Errors that occur early in execution may propagate through both the agent context and environment state, and their effects may be difficult to reverse through subsequent actions. Existing methods mainly seek to reduce such errors through plan refinement and safety checks but provide little support after errors occur. To enable recovery during long-horizon execution, we present AgentRewind, a runtime recovery framework that records aligned checkpoints of the agent context and controlled environment, allowing agents to return to an earlier state and resume execution with information from previous attempts. We also construct MettleBench, a benchmark for evaluating task completion and partial progress on long-horizon engineering assignments containing a series of related requirements. Experiments across tasks, multiple models, execution strategies, and agent harnesses show that AgentRewind improves task success rate and average checklist progress over the compared baselines.

1University of Chinese Academy of Sciences

2IIIS, Tsinghua University

3Zhongguancun Academy, Beijing, China

4Institute of Automation, Chinese Academy of Sciences

zhuangyu24@mails.ucas.ac.cn, ckf25@mails.tsinghua.edu.cn, duanyitong@zgci.ac.cn, xyz@nlpr.ia.ac.cn

Code — https://github.com/Futuresis/replay-agent-recorder

Dataset — https://github.com/Kelvin-Coffee/MettleBench

Introduction

LLM agents solve tasks through tool-mediated interaction with their environments. Unlike non-agentic LLMs, they observe environmental states, invoke tools, and adjust subsequent actions based on feedback (Yao et al. 2023; Liu et al. 2024). They are increasingly applied to long-horizon tasks such as iterative scientific experimentation, cross-application workflows, and repository-level software engineering (Kon et al. 2026; Li et al. 2026; Jimenez et al. 2024). Improving their performance on such tasks is therefore an important research objective.

However, operating over long horizons presents distinct challenges for LLM agents. For example, an agent may formulate an incorrect plan early in execution, causing subsequent actions to proceed in the wrong direction (Valmeekam et al. 2023; Liu et al. 2024; Wang et al. 2026b). During execution, an agent may also delete critical files, corrupt configurations, or contaminate database states, forcing subsequent actions to proceed in a degraded environment and potentially preventing task completion (Ruan et al. 2024; Trivedi et al. 2024). Because long-horizon tasks involve more execution steps, agents are more likely to make such errors along the execution trajectory and therefore face a higher risk of task failure.

Existing approaches primarily seek to improve agent performance on long-horizon tasks through plan refinement and safety checks. One line of work generates and revises plans before execution to identify more effective execution paths (Erdogan et al. 2025; Zhou et al. 2024). Another line of work applies safety checks during execution to detect unsafe behavior (Wang et al. 2026a; Xiang et al. 2025). However, even with a low probability of error at each step, cumulative failure risk grows with trajectory length. These methods do not adequately address recovery after an error has disrupted execution.

We therefore introduce AgentRewind, a runtime recovery framework that allows agents to rewind execution to an earlier state. When the agent determines that it is unlikely to make further progress along the current trajectory, it can select an earlier checkpoint based on the recorded trajectory. AgentRewind then restores the agent context and environment to the states recorded at that checkpoint, allowing the agent to continue execution from there. It also retains a summary of the previous attempt as rewind memory to guide the agent’s subsequent decisions. Through these capabilities, AgentRewind enables agents to recover from errors during task execution, improving their performance on long-horizon tasks. Our main contributions are summarized as follows:

  • We develop AgentRewind, a system that can return both the agent context and the environment state to a selected checkpoint. This allows the agent to continue from an earlier checkpoint and explore a different trajectory when errors prevent further progress.
  • We construct MettleBench, a benchmark derived from real-world engineering resources, to evaluate task completion and checklist progress on assignments containing a series of related requirements.
  • We evaluate AgentRewind across multiple base models, execution strategies, and agent harnesses, and show that it improves task success rate and average checklist progress in long-horizon settings.

References (39)