# Agent-Reflex: Teaching Language Agents to Act Reflectively

Agent-Reflex trains language agents to recover from noisy tool feedback

Guanting Dong, Xinyu Yang, Jiajie Jin, Yuyang Hu, Xiaoshuai Song, Yifei Chen and 6 more · arXiv · 2026-10-13

- **Problem** Agents are trained in stable, noise-free environments with little user input. So they get little practice detecting tool failures and recovering from them.
- **Method** Agent-Reflex mines reflection skills from matched success and failure rollouts, then trains the policy on them with fine-tuning and reinforcement learning.
- **Results** On five long-horizon tool-use benchmarks, Agent-Reflex-8B scores 58.6 overall, compared with 53.6 for Agent-World-8B.

## Why clean training environments leave agents exposed

Training paradigms still assume that agents operate in stable settings with little user involvement. Training environments usually assume stable, noise-free feedback, so agents get little practice with failure detection and recovery.

Simulated users add a second gap, since existing user simulators often rely on standardized templates. Their coverage of corrective instructions and interaction styles during execution is limited. Real users, by contrast, step in when an agent drifts from their intent and correct its reasoning and actions. Together these two gaps mean agents still lack proactive reflection under noisy external feedback.

Most of these methods were trained in stateless or simplified environments. The authors therefore ask how agents can learn proactive reflection from execution failures in real-world environments. To address this gap, Agent-Reflex is proposed as a general training framework that treats reflection as a learnable meta-skill. Transferable meta-skills are mined from execution failures and then internalized into the policy through verifiable reflection learning.

The RSD stage anchors 557 real-world environment themes and injects diverse tool-return failures to emulate noisy conditions. Matched success and failure pairs are then mined into 1,170 reflection meta-skills across those 557 environments. The failure families were grounded in 24,510 error returns out of 177,700 tool returns logged during replay.

## Reflection as a learnable skill

Agent-Reflex treats reflection as a meta-skill, a rule specific to one environment that maps a recurring bad pattern to a corrective action. The paper says such meta-skills are transferable and are explicitly mined from execution failures rather than written by hand. Instead of being looked up at test time, the skills are progressively internalized into the policy through verifiable reflection learning.

Inference-time methods such as Reflexion and Self-Refine leave parameters untouched and append a verbal self-critique.

Training-time repair methods such as Agent-R and NoisyAgent keep the signal inside a per-trajectory repair. Nothing accumulates into an environment-level statement that a later episode can reuse, which is the gap Agent-Reflex targets. For each environment m, the library stores the description, tools, observed bad patterns and extracted reflection skills.

Each sample in the pair set is then associated with one skill drawn from that environment's skill set.

Reflective supervised fine-tuning turns each skill into training data through three sampling strategies. Self-Reflection sampling restores the environment to the state before the first erroneous turn and appends the corrective skill. Skill Recovery sampling resets the environment to its initial state for failures that come from an incorrect initial plan.

Supervised fine-tuning then internalizes these explicit skills into the agent policy.

## Building noisy environments and mining skills

Stage 1 starts from 557 high-usage MCP server specifications taken from Smithery, each defining one environment topic. For each topic a research agent builds and enriches a database, and a coding agent writes candidate tools with unit tests. Only tools that compile, pass every test, respect state-transition constraints and support executable verification are kept.

Each environment thus gets a database, a validated tool set and verifiers, with 60 verifier-backed tasks per topic.

The authors ground the noise in observed failures rather than invented ones. They replayed agents on nine public agentic benchmarks and logged 177,700 tool returns, of which 24,510 were error returns. These errors fall into eight actionable failure families, and injection is balanced across them so that rare families still get enough examples.

During training each tool return is replaced by a rendered failure with probability \\(p^{\\text{inj}}\\), and otherwise passes through unchanged. The rendering function J picks a failure that fits the tool f\_t that was called, which gives the rule below. \\\[ o^{\\text{train}}\_{t+1}=\\begin{cases} J(o\_{t+1}), & b^{\\text{inj}}\_{t+1}=1 \\\\ o\_{t+1}, & b^{\\text{inj}}\_{t+1}=0 \\end{cases},\\qquad b^{\\text{inj}}\_{t+1}\\sim\\mathrm{Bernoulli}(p^{\\text{inj}}) \\\]

Next the authors sample trajectories from a pool of nine models spanning five families, with sizes from 4B to 284B parameters. They do this because repeated sampling from one model concentrates trajectories around that model's reasoning habits. Rule-based metrics can't judge long trajectories reliably, so an analyzer model and the environment verifier label each rollout together.

Correct and erroneous rollouts from the same task are paired, and each erroneous one records the diagnosed error, the first erroneous turn and the state snapshot at that turn. An analyzer reads the paired trajectories, finds recurring failure patterns and turns them into executable recovery rules. Each environment stores its description, tools, observed bad patterns and extracted skills, and the process yields 1,170 reflection meta-skills across 557 environments.

## Three ways to sample reflection data

ReSFT starts from a frozen behavior policy π0 and builds three kinds of reflective continuation from each matched failure. Self-Reflection (SR) restores the environment to the state just before the first erroneous turn, appends the matched skill and samples a continuation. Only continuations that complete the task from that restored state are kept.

\\\[ y^{\\text{SR}}\\sim\\pi\_0(\\cdot\\mid h\_{t^\\star}\\oplus\\kappa),\\qquad \\mathcal{D}\_{SR}=\\{(h\_{t^\\star},y^{SR}) : \\mathrm{Ver}\_{s\_{t^\\star}}(h\_{t^\\star},y^{SR})=1\\} \\\] The skill guides diagnosis while the continuation is generated, but the stored input leaves it out, so the training teaches recovery from the policy's own error state.

Skill Recovery (KR) targets failures that begin with a bad initial plan rather than one local tool error. It resets the environment to its initial state s\_0, restarts the original task with the matched skill and keeps the verified continuations. \\\[ y^{\\text{KR}}\\sim\\pi\_0(\\cdot\\mid q\\oplus\\kappa),\\qquad \\mathcal{D}\_{KR}=\\{(q,y^{KR}) : \\mathrm{Ver}\_{s\_0}(q,y^{KR})=1\\} \\\] As in SR, the skill is removed before storage.

User-Centric Reflection (UR) models a user who corrects the agent after it drifts from their intent. A user simulator U turns the matched skill into a natural-language correction, computed from the skill, the history and the state, and that correction goes in after the erroneous turn. \\\[ u\_\\kappa=U(\\kappa,h\_{t^\\star},s\_{t^\\star}) \\\] The correction stays in the stored input because a user can see it, while the privileged skill is removed.

The verified rollouts from the target policy are merged with the three reflective sets. \\\[ \\mathcal{D}\_{ReSFT}=\\mathcal{D}^{\\pi\_0}\_{correct}\\cup\\mathcal{D}\_{SR}\\cup\\mathcal{D}\_{KR}\\cup\\mathcal{D}\_{UR},\\qquad \\mathcal{L}\_{ReSFT}=-\\sum\_{(x,y)\\in\\mathcal{D}\_{ReSFT}}\\log\\pi\_\\theta(y\\mid x) \\\] The minus sign makes this a loss to minimize, so training raises the likelihood of the verified continuations.

## Dense token-level distillation on noisy rollouts

ORPO scores the same sampled action tokens twice, once in ordinary context and once with the matched skill prepended. The skill-augmented score acts as a teacher, while the ordinary score is the student that receives gradients. Only one rollout stream is needed, because the teacher branch just re-scores tokens the policy has already produced.

The RL side draws a task from the EnvScaler RL pool rather than from the RSD tasks, and rolls out a group in which a fraction ν runs in noisy environments and the rest in clean ones. Each trajectory receives a verifier return, and returns are normalized inside the whole mixed group to give the advantage \\\[ Ab\_{q,i}=\\frac{R\_{q,i}-\\mu\_q}{\\sigma\_q+\\epsilon} \\\] Normalizing over the mixed group, rather than inside the clean and perturbed strata, keeps failures in the on-policy distribution without turning them into a separate contrast.

For each action token the current policy's log-probability is compared with the behavior policy's, giving a ratio that feeds a clipped objective. The mask χ removes tool returns and simulated user messages, so only agent-generated tokens are trained. This RL term carries only the verifier's outcome signal, and a KL penalty to the reference policy keeps it close to the start.

The detached shift Δ is the skill-branch log-probability minus the ordinary one, and the weight γ is a sigmoid of that shift scaled by β\_opd. \\\[ \\Delta\_{q,i,t,k}=\\mathrm{sg}\\big\[\\ell^{\\text{skill}}\_{q,i,t,k}-\\ell^{\\theta}\_{q,i,t,k}\\big\],\\qquad \\gamma\_{q,i,t,k}=\\mathrm{sigmoid}\\big(\\beta\_{opd}\\Delta\_{q,i,t,k}\\big) \\\] The sg operator blocks gradients through the teacher branch, so the OPD loss is minimized as \\\[ \\mathcal{L}\_{OPD}(\\theta)=\\mathbb{E}\\big\[\\chi\_{q,i,t,k}\\,\\gamma\_{q,i,t,k}\\,(\\mathrm{sg}\[\\ell^{\\text{skill}}\_{q,i,t,k}\]-\\ell^{\\theta}\_{q,i,t,k})\\big\] \\\] Minimizing it raises the student's score on tokens that the skill-conditioned teacher endorses.

The authors treat γ as a soft weight rather than a hard filter. Tokens with a positive skill-induced shift are emphasized, while tokens with weak or negative shifts are down-weighted. The authors attribute the stable training curves to this confidence weighting, so skill-neutral tokens don't dominate the update.

The full objective adds the two terms with a weight λ\_opd: \\\[ \\mathcal{L}\_{ORPO}=\\mathcal{L}\_{RL}+\\lambda\_{opd}\\mathcal{L}\_{OPD} \\\] The RL term rewards whole trajectories, and the OPD term adds per-token pressure on reflective decisions.

## Long-horizon tool-use results against 7B–8B baselines

Agent-Reflex-8B reaches 58.6 Overall on the five long-horizon tool-use benchmarks in Table 1, the highest Overall among the 7B–8B methods. The next best 7B–8B method, Agent-World-8B, scores 53.6 Overall, which puts Agent-Reflex-8B about five points ahead. Every trained method starts from the same Qwen3-8B backbone, so the gap reflects the training recipe rather than the base model.

On VitaBench, Agent-Reflex-8B averages 17.5, compared to 6.8 for Reflexion-8B, which relies on self-generated critiques at inference time. The authors attribute the gain to training directly on verified recovery behavior instead of interpreting textual advice during execution. On ACEBench, Agent-Reflex-8B reaches 78.0, compared to 52.0 for NoisyAgent-8B.

NoisyAgent-8B is the authors' own reproduction, since its checkpoint isn't open-sourced. The authors take this result to mean that environment-level meta-skills supply recovery guidance beyond single correction trajectories or episode rewards.

Agent-Reflex-8B also scores above EnvScaler-8B and Agent-World-8B on all five benchmark averages. For example, it reaches 62.1 on τ2-Bench, compared to 54.6 for Agent-World-8B and 47.1 for EnvScaler-8B on the same benchmark. On ACEBench, the margin comes mainly from multi-turn interaction, with a turn-level score of 73.3. The step-level score of 85.0 matches the baselines, so the gain isn't in single-step accuracy.

The authors read this as reflective supervision complementing broader tool and task coverage.

## Robustness under noise and training stability

AgentNoiseBench instantiates tool noise and user noise on the τ 2-Bench and VitaBench settings. Every foundation model degrades markedly under these perturbations, so the benchmark tests whether training transfers to noise. Agent-Reflex-8B reaches an Overall score of 29.1, compared to 25.9 for NoisyAgent-8B. On the VitaBench setting, Agent-Reflex-8B scores 17.5 clean, 9.4 under tool noise and 15.2 under user noise.

The optimization comparison starts every method from Qwen3-8B and runs 100 RL steps on one task pool. Figure 4(a) places ORPO beside GRPO, DAPO, REINFORCE++, noisy Agent RL and SEED. In Figure 4(a), ORPO keeps a stable lead over GRPO, DAPO and REINFORCE++ on BFCL V4, τ 2-Bench and real interaction noise. ORPO also beats SEED, although SEED already uses an OPD signal.

The authors read this as reflection meta-skills from real failures transferring better than experience estimated from rollouts alone.

Figure 4(b) tracks mean training reward over the same 100 steps. Early in training, ORPO pulls away from GRPO and SEED, and it keeps climbing after their curves level off. The authors attribute this stability to confidence weighting, which favors tokens with a positive skill-induced shift. Tokens with weak or negative shifts get down-weighted, so skill-neutral tokens don't dominate the update.

All comparisons stop at 100 RL steps, so the paper doesn't show how these curves continue beyond that window.

## Which components carry the gain

Table 3 isolates each training component by removing it from the full Agent-Reflex model on the two AgentNoiseBench settings. Each variant keeps the other training and evaluation conditions fixed, so the complete-model scores match those in Table 2. The full model scores 45.9 on the τ2 setting and 12.3 on VitaBench. Removing SR drops these to 41.3 and 8.9, the largest fall among the supervision types.

Removing KR gives 42.4 on τ2 and 10.2 on VitaBench. Removing UR gives 43.0 and 10.9 on the same two settings. The authors order the supervision types as SR, KR and UR, so they read failure awareness and local repair as the base of reflective behavior. Removing any single component lowers both settings, which the authors take as evidence that the components are complementary.

Removing the OPD term gives 43.7 on τ2 and 9.5 on VitaBench. Keeping the skill library but dropping only the confidence weight gives 44.5 and 10.4 on the two settings. With the library kept, removing OPD still hurts performance more than removing the weight does. The authors conclude that the gains come from the token-level reflection signal rather than from skill exposure alone.

## Limits of the evidence

Every trained method in the paper starts from the same Qwen3-8B backbone, and the authors don't test another base model. The component ablation runs only on the two AgentNoiseBench settings, τ2 and VitaBench. The authors didn't run the component ablation on the five tool-use benchmarks in Table 1. The ORPO comparison in Figure 4 covers 100 RL steps, so the training-stability claim only holds over that window.

The authors rebuilt Agent-R-8B, NoisyAgent-8B and EnvACE-8B themselves, because those checkpoints aren't open-sourced. The paper doesn't report how closely these reproductions match the original reported behaviour. The training environments are agent-built: a research agent enriches each database, and a coding agent writes the tools. Each tool must compile and pass its unit tests before it joins the environment, which is a check on the code rather than on live services.

The authors didn't measure how closely these environments track live services, so their fidelity stays untested.

The injection probability pinj stays a symbol in Equation 1, so the clean-to-perturbed mix used in training isn't stated. The fraction ν of noisy rollouts in each ORPO group is also left unspecified. Agent-Reflex scores 29.1 overall on AgentNoiseBench, compared with 25.9 for NoisyAgent-8B. The tables report one score per cell, with no spread across runs, so the size of that gap is uncertain.

## Paper info

- **Authors**: Guanting Dong, Xinyu Yang, Jiajie Jin, Yuyang Hu, Xiaoshuai Song, Yifei Chen, Xiaoxi Li, Jiejun Tan, Yutao Zhu, Tat-Seng Chua, Ji-Rong Wen, Zhicheng Dou
- **Venue**: arXiv · Preprint
- **First published**: 2026-10-13
- **Added**: 2026-10-20
- **Updated**: 2026-10-13
- **Version**: v1
- **arXiv**: 2610.17953
- **Category**: cs.CL
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/2610.17953v1) · [PDF ↗](https://arxiv.org/pdf/2610.17953v1)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Guanting Dong, Xinyu Yang, Jiajie Jin, Yuyang Hu, Xiaoshuai Song, Yifei Chen, Xiaoxi Li, Jiejun Tan, Yutao Zhu, Tat-Seng Chua, Ji-Rong Wen, Zhicheng Dou (2026). Agent-Reflex: Teaching Language Agents to Act Reflectively. arXiv:2610.17953v1. https://arxiv.org/abs/2610.17953v1

**BibTeX**

```
@misc{dong2026agent,
  title = {{Agent-Reflex: Teaching Language Agents to Act Reflectively}},
  author = {Guanting Dong and Xinyu Yang and Jiajie Jin and Yuyang Hu and Xiaoshuai Song and Yifei Chen and Xiaoxi Li and Jiejun Tan and Yutao Zhu and Tat-Seng Chua and Ji-Rong Wen and Zhicheng Dou},
  year = {2026},
  eprint = {2610.17953},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.17953v1}
}
```

## Related papers

- [Evolution Strategies at the Hyperscale](https://refivu.com/en/papers/77d44b80-fbe4-419d-a33e-e5ab69fb2914-evolution-strategies-at-the-hyperscale.md)
- [Reasoning-Trace Overflow in Code Generation: An Empirical Study of Explicit Reasoning Models](https://refivu.com/en/papers/341947d7-6234-48fc-bf19-74e8c2056166-reasoning-trace-overflow-in-code-generation-an-empirical.md)
- [On Evaluating User Simulators for Interactive Agents](https://refivu.com/en/papers/163eec3e-1ab6-43cf-8cb9-cb7e7b3c23ab-on-evaluating-user-simulators-for-interactive-agents.md)
- [StateAlign: Internalizing State-Aware Decision-Making for Reliable Multi-Turn Tool Agents via Reinforcement Learning](https://refivu.com/en/papers/5c880185-8094-4e73-83d9-b14e523c0f06-statealign-internalizing-state-aware-decision-making-for.md)
- [Reducing Batch Makespan for LLM Agent Workloads through Inference-Environment Coordination](https://refivu.com/en/papers/4f221a0a-61bb-41b5-956d-57bddb732211-reducing-batch-makespan-for-llm-agent-workloads-through.md)
- [Agent-R$^2$: Scaling Agents for Realistic Productivity Work via Real-Source Data Synthesis](https://refivu.com/en/papers/0a35b188-3771-4938-b5be-bee07e4e6512-agent-r-2-scaling-agents-for-realistic-productivity.md)

## Other paper commentary

- [AgentSWE: Can Coding Agents Build the Agent You Actually Want?](https://refivu.com/en/papers/0edc53d4-a7db-411e-a9bd-bcb685052116-agentswe-can-coding-agents-build-the-agent-you.md)
- [Reflexion: Language Agents with Verbal Reinforcement Learning](https://refivu.com/en/papers/a572f458-b121-4d38-bfc9-7a77309a3aba-reflexion-language-agents-with-verbal-reinforcement-learning.md)
- [A Generalist Agent](https://refivu.com/en/papers/890475cb-e797-43df-8de3-0d0eb9ed882e-a-generalist-agent.md)
- [Toward Agentic Robotics: A Large-Scale Study of Harness Design for Robot-Use Agents](https://refivu.com/en/papers/14d1c215-9799-4493-b5f1-c86c787dcba4-toward-agentic-robotics-a-large-scale-study-of.md)
- [VeriLadder: A Multi-Agent Specification Refinement System for Tool-Verified Verilog Datasets](https://refivu.com/en/papers/f3a3ce4f-fd41-462e-8bb7-f3e5263ba827-veriladder-a-multi-agent-specification-refinement-system-for.md)
- [AutoPILOT: A Visual Agent Harness for Real-Time Gameplay](https://refivu.com/en/papers/610b7c6f-2c3b-4308-bb50-b139b48fceb7-autopilot-a-visual-agent-harness-for-real-time.md)
- [Prefix-Tuning: Optimizing Continuous Prompts for Generation](https://refivu.com/en/papers/01cf041e-b71c-444b-8b44-e94ac976a9db-prefix-tuning-optimizing-continuous-prompts-for-generation.md)
- [WebGPT: Browser-assisted question-answering with human feedback](https://refivu.com/en/papers/b41258c0-ce1e-478c-ad2b-6bccd936ae34-webgpt-browser-assisted-question-answering-with-human.md)
- [SparseGPT: Massive Language Models Can Be Accurately Pruned in One-Shot](https://refivu.com/en/papers/98e70bdf-a832-4686-b3f8-e3eefd5887c4-sparsegpt-massive-language-models-can-be-accurately-pruned.md)
- [GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpoints](https://refivu.com/en/papers/11792bcd-8c73-4a2d-8b43-c855c3d7ad48-gqa-training-generalized-multi-query-transformer-models-from.md)
- [DiffusionART: Efficient, Stable and Scalable Reinforcement of Diffusion Models](https://refivu.com/en/papers/89443a6c-9e26-4b10-9b54-a9d119590181-diffusionart-efficient-stable-and-scalable-reinforcement-of.md)
- [Beyond the Imitation Game: Quantifying and extrapolating the capabilities of language models](https://refivu.com/en/papers/acf2f583-364d-425a-bf01-6f0683cbe84f-beyond-the-imitation-game-quantifying-and-extrapolating-the.md)

## Terms in this paper

- [GRPO](https://refivu.com/en/terms/17129d1bafd8-grpo)
- [negative log-likelihood](https://refivu.com/en/terms/e6d7135ed9ca-negative-log-likelihood)
- [On-policy distillation](https://refivu.com/en/terms/ca2935e881b4-on-policy-distillation)
- [τ 2-Bench](https://refivu.com/en/terms/60d042ca9f30-2-bench)
- [BFCL-v4](https://refivu.com/en/terms/455184c79832-bfcl-v4)
- [SEED](https://refivu.com/en/terms/22c10bdc2e8f-seed)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/7eb7b09e-c398-4382-9fbd-fe06f80512f9-agent-reflex-teaching-language-agents-to-act-reflectively)
