Harness-R1: Learning to Edit Executable Runtime Harnesses from Agent Failure Trajectories
Reading guide · Based on sections of the original paper
Why read this
This is for agent builders who want to improve a deployed agent's context, tool-mediation and recovery code without touching its weights, and who want evidence that a learned editor beats simply prompting a frontier model to write patches.
What the authors found
- On a frozen Qwen3.5-9B target, the authors report that equal-weight average success@1 across WebShop, ALFWorld and DBBench rises from 44.3% to 53.6%. By comparison, the supervised-only engineer reaches 46.4% and the best prompted frontier editor, GLM-5.2, reaches 48.8%. The largest gain is on ALFWorld (40.6→53.2). Reflection's 55.8% comes from a two-episode protocol and is not ranked against these single-episode results. Outcome-trained harness editing improves the frozen target.
- In a held-out-task test, each engineer saw 10 failures per benchmark and wrote one patch, which was then applied to 1,270 unseen tasks. Harness-R1 gained +8.9±1.5 points over three seeds, positive on every seed. Under the same protocol, Qwen3.5-397B scored −4.3±2.5 and DeepSeek-V4-Pro −0.4±3.6. 4.4 Held-Out Task Generalization
- The editing policy transferred to 20 untrained target models, each receiving newly generated patches from its own failures. The mean gain was +7.06 points. Of 63 target–benchmark cells across all 21 targets, 56 improved, 4 were unchanged and 3 regressed slightly (≤2.0 points). WebShop showed the smallest gains. 4.3 Generalization across Target Agents
Main limitation
The training reward is computed on the same batch of tasks used to mine the failures, so the objective is transductive, and patches are not remembered across batches. Each of the K=8 candidates also requires a full rerun of the batch. The authors themselves flag held-out regressions and runtime cost as open issues. 3.1 Problem Setup
Where to start
Appendix F Held-Out Task Generalization · This section reports the held-out results alongside how many patches were valid (9/9 for Harness-R1 versus 8/9 and 6/9 for the frontier editors) and the full-split comparison. Read it to judge whether the gains survive outside the same-batch setting.
Abstract
Agents built around large language models continually accumulate interaction trajectories during deployment, yet their behavior typically remains fixed. Beyond updating model weights, these trajectories can improve the agent harness that constructs context, mediates tools, validates actions, and recovers execution. We introduce Harness-R1, the first method, to our knowledge, that makes failure-conditioned, lifecycle-wide editing of an existing executable runtime a learned capability. It post-trains a dedicated harness engineer with online reinforcement learning so that its edits are optimized for the realized task success they produce, rather than proposed by a fixed editor. A separate 9B engineer converts batches of target-agent failures into validated executable patches; fresh same-batch reruns of the frozen target provide outcome rewards, so training updates only the engineer. Cold-start supervised fine-tuning initializes this editing policy, which is then trained online with group-relative policy optimization. Across WebShop, ALFWorld, and DBBench, Harness-R1 raises vanilla Qwen3.5-9B success from 44.3% to 53.6% (+9.3 percentage points). After direct target-agent fine-tuning, a target-specific engineer raises the average further from 59.2% to 64.2% (+5.0 points); because these gains hold both before and after fine-tuning the target, Harness-R1 points toward co-evolving the harness engineer and the target agent.