ReTerm: Recovery Training for Self-Improving Terminal Agents
Wei Xie, Kaituo Feng, Shiming Fu, Yong Liu, Xiangyu Yue, Shuangjia Zheng
Abstract
Terminal agents have shown strong abilities in complex coding tasks. However, they often struggle to recover from errors during long-running execution (e.g., command errors, faulty implementations), eventually leading to task failures. To this end, we present ReTerm, a self-improving terminal agent trained by learning how to recover from its own failed terminal tasks. To support its training, we construct a customized data pipeline and produce ReTerm-10K, a high-quality dataset that provides effective recovery demonstrations for SFT cold start. Furthermore, we propose ReTerm-GRPO, an online RL algorithm that forks from the agent's own failure states to generate multiple independent self-recovery attempts. By learning from whether these attempts successfully complete the task, the agent self-improves through its own recovery experience. Built on Qwen3.5-9B, our ReTerm-9B achieves 34.8% Pass@1 on Terminal-Bench 2.0, improving over the base model by 14.6 points. Further analysis shows that our method achieves consistently higher recovery rates across diverse error categories compared with standard GRPO training. All code, data and model are released at https://github.com/twothsnd/ReTerm.
Create a lesson
Metadata
- Categories
- cs.AI, cs.LG, cs.SE
- Comments
- Project page: https://github.com/twothsnd/ReTerm
Related papers
Fin-RSI: A Unified Library of Financial Skills, Checks, and Self-Improvement for LLM Agents
Shared title terminologycs.AIWanghao Ye, Shwai He, Sihan Chen et al.
Improving the Improver: Semantic PID Control for Medical Agent Self-Improvement
Shared title terminologycs.AIDexia Chen, YiLong Hu, Wenqi Zhong et al.
Evolving Together, Failing Apart: The Skill-Policy Co-evolution Trap in Self-Improving Agents
Shared title terminologycs.AIYujie Feng, Xiaobin Wang, Jinluan Yang et al.
A Self-Improving Agent that Grows its Own DSL: Oracle-Free Operator Induction for Exact Question Answering
Shared title terminologycs.AIYun-Shiuan Chuang, Yirou Ge, Yixi Li et al.
SwarmRSI: Recursive Self-Improvement through Evolving Scientific Agent Swarm
Shared title terminologycs.AIQianru Meng, Xi Zhang, Konstantinos Papakostas et al.
L3M: A Verifiable Harness and Runtime for Self-Extending and Self-Improving Agents
Shared title terminologycs.AICarson Eisenach, Robert Joseph George, Vincent Quenneville-Belair et al.