Manuscript Offprint

arXiv:2610.36469

CoHARL: Co-Evolving Agent Policies and Executable Harnesses with Reinforcement Learning

Jianwen Chen, Peng Xia, Kaide Zeng, Siwei Han, Zhen-Yu Zhang, Charles Fleming, Xinyu Ye, Huaxiu Yao

Abstract

Large language model (LLM) agents interact with their environments through executable harnesses that govern tool use and feedback. Optimizing a harness for a fixed policy overlooks how its behavior changes during learning, while training a policy under a fixed harness leaves the interface that generates its training experience unchanged. This motivates adapting the harness throughout policy training. We introduce CoHARL, a population-based reinforcement learning framework that co-evolves a shared policy and a population of executable harnesses. The policy learns from rollouts across the population, and a proposer uses its execution traces to revise harness code during training. CoHARL achieves a 27.6% mean resolved rate on SWE-rebench, improving over harness-only search by 6.4 percentage points. Experiments on SWE-bench Verified and Terminal-Bench 2.0 show gains in software engineering and terminal-based tasks. Under matched training budgets, CoHARL also outperforms searching for a harness once before RL and alternating policy updates with revisions to a single active harness.

1 INTRODUCTION

LLM agents solve software-engineering tasks by interacting with repositories, tools, and execution environments (Weng, 2026; Yang et al., 2024; Wang et al., 2025; Karten et al., 2026). Their behavior depends on both model weights and the harness: the program that handles prompts, action parsing, tool responses, and episode control. The same program controls inference-time execution and the collection of training trajectories.

Agent failures can originate in either the execution code or the policy. If an action parser rejects a valid tool call, or a tool-output handler discards feedback needed for the next decision, updating model weights does not repair that code. Policy-only reinforcement learning (RL) (Wei et al., 2025; Luo et al., 2025) may teach the agent to work around the defect, but leaves its cause in the harness unchanged. Conversely, even with correct tool execution, a policy may choose an uninformative command or misinterpret a test failure. Harness-only search (Lee et al., 2026; Zhang et al., 2026a; Lin et al., 2026) can add guidance and safeguards, but does not update the model's parameters to learn from these mistakes.

The two forms of adaptation are also linked during training. Repairing a tool handler changes the feedback available to the policy and the trajectories from which it learns. As the policy improves, its execution traces can reveal further harness weaknesses that were not apparent under the initial model. Searching once before RL cannot respond to those later failures; keeping the policy frozen cannot train it on the experience collected through the revised interface. We therefore ask (Figure 1): how can an agent's policy and execution interface adapt together throughout training?

(a) Policy-only learning

(b) Harness-only search

Figure

(c) Co-evolution (ours)

Figure

Figure 1: Coupling policy optimization with harness evolution. Policy-only RL adapts policy weights under a fixed harness (a), whereas harness-only search adapts the harness under a fixed policy (b). CoHARL jointly adapts a shared policy and a harness population (c), using execution traces to guide harness edits and population rollouts to update the policy.

Recent methods update both model weights and harness or training code (Chen et al., 2026a; Luo et al., 2026). WHALE alternates harness search under frozen model weights with rejection-sampling fine-tuning under a selected harness (Kim et al., 2026). Its policy updates therefore use one selected execution interface at a time. In CoHARL, multiple harnesses remain active during training: a scheduler allocates rollouts across the evolving population, and these rollouts jointly update one shared policy through reinforcement learning. This allows new candidates to contribute training experience alongside existing versions, rather than replacing the interface for all subsequent rollouts. We evaluate the benefit of this population-based design against single-harness alternating updates under the same training budget.

In CoHARL, a proposer model reads the policy’s successful and failed trajectories and revises harness code. Accepted candidates join the population, from which a scheduler selects versions for training rollouts. The proposer also receives a Pareto archive of historical accuracy–cost trade-offs. Figure 2 shows how search and rollout collection alternate with policy updates.

We evaluate CoHARL on software-engineering and terminal-based tasks. On SWE-rebench, it achieves a 27.6% mean resolved rate, compared with 21.2% for harness-only search and 20.3% for policy-only training. CoHARL also outperforms both baselines on SWE-bench Verified without further adaptation. A separately trained Terminal-Bench 2.0 agent improves on harness-only search. Matched-budget controls favor continued population-based training over one-time search and single-harness alternation; ablations examine execution feedback and historical context.

Our contributions are threefold: (i) a population-based formulation of policy–harness co-evolution, in which diverse execution interfaces supply experience to one shared policy; (ii) a search-and-training procedure that uses current-policy traces and historical accuracy–cost context to propose programs, then schedules accepted versions for future rollouts; and (iii) evaluation across three benchmarks, with matched-budget controls for one-time search, single-harness alternation, and search context.

References (65)