Harness-R1: Learning to Edit Executable Runtime Harnesses from Agent Failure Trajectories

ArticleShuai Shao, Kangning Zhang, Qingyao Li, Shijian Wang, Hao Wang, Wenxiang Jiao, Yuan Lu, Yi Guo, Weiwen Liu, Weinan ZhangResearch

Researchers introduce Harness-R1, a framework that trains a dedicated agent to adapt and patch the runtime harness of LLM agents based on failure logs. Using online reinforcement learning, a separate 9B model learns to generate executable patches for context handling, tool mediation, and error recovery to directly improve task completion.

Key points

  1. Harness-R1 turns failure-conditioned runtime editing into a learned policy rather than relying on manual intervention or static rules.
  2. A separate 9B 'harness engineer' model is initialised with supervised fine-tuning and optimised via Group-Relative Policy Optimization (GRPO).
  3. Edits are evaluated by rerunning the frozen target agent, using actual task success as the training reward.
  4. Across WebShop, ALFWorld, and DBBench, Harness-R1 improved vanilla Qwen3.5-9B task success from 44.3% to 53.6% (+9.3 percentage points).
  5. When applied to fine-tuned target models, performance increased further from 59.2% to 64.2%, suggesting a path toward co-evolving the harness and agent.

Why it matters

Agent failures are frequently caused by surrounding infrastructure issues like malformed tool schemas, missing context, or weak recovery logic rather than the core model itself. Automating harness maintenance through reinforcement learning offers a cost-effective way to stabilise agentic workflows in production without constant model retraining.

Analysis

The research by Shao et al. highlights the importance of the agent harness in overall system reliability. By isolating runtime code generation into an independently trained model rewarded strictly on task outcomes, Harness-R1 decouples workflow adaptation from model weights while demonstrating consistent accuracy gains across diverse interactive environments.

Found in

Summary generated by AI (Gemini 3.8 Flash, 27 September 2026). It may contain errors – the original source is authoritative.

Similar in content, found by the AI search.

  • Article:Hongjun Liu, Yifei Ming, Shafiq Joty, Chen Zhao

    HASP: Harnessing LLM Agents with Executable Skill Programs

    A research team introduces HASP (Harnessing LLM Agents with Skill Programs), a framework that converts past agent experiences into executable Program Functions (PFs). Instead of relying on passive textual prompts, PFs act as executable guardrails that trigger on failure-prone states to alter the next action or supply corrective context.

    AI & LLMs· Research

  • Article:Siru Ouyang, Jun Yan, I-Hung Hsu, et al.

    ReasoningBank: Scaling Agent Self-Evolution with Reasoning Memory

    ReasoningBank is a memory framework for LLM agents that distils generalisable reasoning strategies from self-judged successful and failed experiences, enabling continuous self-evolution over time.

    AI & LLMs· Research

  • Article:Mehdi Allahyari

    The Harness Beats the Model: Demystifying Agent Harness Engineering

    Following prompt and context engineering, harness engineering marks the third wave in developing autonomous AI systems. Mehdi Allahyari explains why the software infrastructure wrapping an LLM matters more than raw model scale for reliability and self-correction.

    AI & LLMs· Resource

  • Article:Tejas Kumar

    What Is an Agent Harness? Harness Engineering Explained

    Tejas Kumar explains the concept of an agent harness: the runtime layer around a model that enforces reliable execution in real environments. Using a practical browser automation example, he demonstrates how deterministic code around GPT-3.5 Turbo fixes agent failures without altering the prompt.

    AI & LLMs· Tutorial

  • Repository:walkinglabs/learn-harness-engineering

    Learn Harness Engineering: Open-Source Course for Reliable AI Coding Agents

    The open-source project learn-harness-engineering by walkinglabs provides a project-based beginner curriculum on harness engineering for autonomous coding agents. It teaches how to build runtime environments, state management, verification routines, and control systems needed to operate AI agents reliably.

    14.8kstarsTypeScript

    AI & LLMs· Tutorial

Let's talk about your project

Locations

  • Mattersburg
    Johann Nepomuk Bergerstraße 7/2/14
    7210 Mattersburg, Austria
  • Vienna
    Ungargasse 64-66/3/404
    1030 Wien, Austria

Parts of this content were created with the assistance of AI.