HarnessFlow: MCTS-Guided Harness Optimization for LLM Agents
AuthorsZhi Hong, Qianlong Wang, Hongchen Wei, Aidan Wu, Daohong Ying, Mingze Kong, Bei Liu, Chong Luo
AffiliationsSouth China University of Technology Fudan University · Wuhan University Cornell University University of California, San Diego · The Chinese University of Hong Kong, Shenzhen Microsoft Research Asia∗ Corresponding author. ‡ Work done during an internship at MSRA
HarnessFlow uses tree search and a coding agent to automatically refine the software harnesses that guide LLM agents.
Key results
Mean across six benchmarks after search.
Percentage-point improvement in average test score.
Percentage-point improvement in average test score.
Candidate attempts per benchmark.
Mean best-so-far validation score.
USD per task, averaged across benchmarks.
What the paper found
HarnessFlow treats an LLM agent’s complete executable harness—not just its prompt or workflow—as the object to optimize. With the model and task environment held fixed, it stores candidate harnesses, scores, edits, and execution traces in a refinement tree; Monte Carlo Tree Search balances refining high-scoring designs against exploring underused branches, while a coding agent draws on that history and a reusable component library to modify context construction, state, control flow, and tool use. Tested with GPT-5.4-mini on TAU2-bench, AppWorld, WebShop, BrowseComp-Plus, SWE-bench Verified, and BigCodeBench-Hard, HarnessFlow achieved a 69.48% average test score after 15 refinement attempts per benchmark—10.89 percentage points above the initial harness and 3.95 points above Meta-Harness. Its best-so-far validation score reached 71.5% after three candidate evaluations and 74.2% by round 15. The system also compared favorably with hand-engineered agents including Anthropic’s Claude Code and OpenAI’s Codex; its average execution cost was $0.232 per task, lower than those baselines. The central contribution is a budget-aware search process that preserves and revisits complete harness designs instead of relying on a single sequence of edits.
Original abstract
The performance of large language model (LLM) agents depends on both the underlying model and the harness that governs interaction with tools and the environment. Yet harness design remains largely manual, and automating it requires navigating an open-ended search space through costly end-to-end evaluations. We introduce HarnessFlow, a framework for optimizing complete executable harnesses under a limited candidate-evaluation budget, with the model and task environment held fixed. HarnessFlow organizes candidates and their evaluation histories in a refinement tree, using a Monte Carlo Tree Search (MCTS)-based policy to balance exploitation and exploration. A coding agent refines selected harnesses using archived code, execution feedback, and a library of reusable harness mechanisms. With 15 refinement attempts per benchmark, HarnessFlow achieves the highest mean test scores among the compared methods on six benchmarks spanning agentic tasks, coding, and web interaction. The optimized harnesses achieve an average score of 69.48%, outperforming the initial harnesses and Meta-Harness by 10.89 and 3.95 percentage points, respectively, while incurring lower average per-task execution costs than hand-engineered baselines. These results suggest that structured harness search offers a promising route toward automating the design of capable and efficient LLM agents.
Read the original paperMore in AI Agents
Browse all 77 papers →From Attack Surface to Defense Architecture: Compositional Security for Agentic Coding Harnesses
Simon Hegelich, Bardh Prenkaj, Habiba Sarhan, Morteza Shahrezaye, Kolja Hegelich, Christian Montag, Ralf Schneider, Erik Cambria
A security architecture aims to keep coding agents useful while preventing malicious instructions from turning their tools into an attack platform.
Test-Time Compute Scales Better with Parallel Agent Teams
Junlin Wang, Haozhe Chen, Ang Li, Rahul Chalamala, Zhuang Liu
Instead of choosing between many solo agents and one huge team, run many small teams in parallel and keep the strongest result.
Experience-Handoff Reinforcement Learning for Recursive Self-Improvement
Doyoung Kim, Byeongguk Jeon, Kailin Zhang, Sherry Yang
The work trains an AI agent not only to act, but also to write useful playbooks that help its future attempts succeed.