How Agent Harnesses Quietly Change LLM Performance
A controlled experiment shows that swapping the agent harness while keeping model weights, temperature, and context budget fixed can move scores from the low 90s to 96–99. This article explains why harness consistency with post-training environments affects model performance, how to design reproducible evaluations, and how to build stable agents in production.
1. The Phenomenon: Same Model, Different Scores
In a controlled experiment on realistic engineering maintenance tasks, we kept the model weights, temperature, and context budget fixed and changed only the outer coding agent harness. In the fully featured standard mode, composite scores across multiple runs clustered between 91 and 93. After switching to a minimal mode, two runs scored 99 and 96, closely matching observations from a small pre-release canary stage.
This is not a marginal improvement. It is a visible shift from a degraded state to full performance. The language style also drifted: in standard mode, the model frequently output “Let me…”, while in minimal mode these expressions almost disappeared, replaced by “Let us…” and “We need…”. During the canary stage, such style shifts were often mistaken for a silent model swap behind the scenes. A more plausible explanation is that the same weights were running in two different inference configurations.
2. What the Minimal Mode Removes
Comparing the two modes, the constraints of the minimal mode come down to three points:
- A smaller tool surface: only command execution and file reading/writing/editing remain available. Retrieval, sub-agents, plugins, and external integrations are all disabled.
- A minimal prompt: the system prompt is compressed to a one-sentence role definition, without stacked style guides, process rules, or tool manuals.
- Shorter decision paths: with fewer available actions, the model does not have to weigh which tool to use, in what order, or how to hand off work.
Together, these changes return attention budget from tool selection and environment management to the problem itself.
3. The Mechanism: Post-Training and Harness Overfitting
A closer explanation is a mismatch between training and inference distributions. The post-training stage, especially reinforcement learning, is often tied to a specific agent setup: the tool set, call formats, prompt structure, and failure fallback strategies together form the “exam room” the model has seen. When the inference-time harness differs from that exam room, the model must spend extra capacity adapting to the new environment, and performance naturally drops.
This coupling can be expressed schematically:
score ≈ f(task difficulty, model capability, harness consistency)harness consistency = g(tool set, prompt structure, call protocol, fallback strategy)
When harness consistency decreases, model capability cannot be fully expressed. This also explains the style drift: language habits are a fingerprint of the training distribution, and the fingerprint changes when the environment changes.
There is no evidence here that the model became smarter. It simply recognizes the environment. Move it out of a familiar exam room, and its problem-solving performance falls back. This is an engineering problem, not something mysterious.
4. A Reproducible Evaluation Design
To test the hypothesis that the harness, not the model, is responsible, the evaluation must be a controlled experiment:
- Single-variable principle: change only the harness, and lock the weight version, decoding parameters, context window, and maximum steps.
- Multiple samples: run each configuration at least 3–5 times, and report the median and dispersion to avoid a lucky single run.
- Task layering: split tasks into locating, modifying, verifying, and regression, and measure pass rates separately to identify where performance degrades.
- Process metrics: record tool call counts, wasted call ratios, average steps, repeated file reads, and fallback counts.
- Environment isolation: unify dependency versions and initialization scripts to prevent environment differences from contaminating the conclusions.
A minimal evaluation skeleton:
def run_once(task, harness, model_cfg, n=5):results = []for _ in range(n):trace = harness.execute(task, model_cfg) # only the harness changesresults.append({"pass": trace.verified, # based on test passage"steps": trace.steps,"tool_calls": trace.tool_calls,"wasted_calls": trace.wasted_calls,})return summarize(results) # median, P90, variance
If a stable score gap appears when the model is fixed and only the harness changes, the result can be attributed to harness consistency.
5. Engineering Practice: Bringing the Exam Room into Production
Since the problem is distribution mismatch, the solution is to make the production environment as close as possible to the training environment while retaining necessary engineering guardrails.
- Minimize tools: by default, expose only file editing and command execution, and enable other capabilities on demand to reduce selection overhead.
- Layer prompts: keep only the role and goal in the system prompt, and push style and process rules down into a small set of pluggable constraints to avoid long prompts diluting attention.
- Stabilize protocols: keep tool descriptions, parameter names, and error return formats stable over time, and version any changes.
- Make failures recoverable: set timeouts and resource limits for command execution, and keep a rollback-capable patch view for file edits.
- Add observability: connect logging and monitoring with alerts, and set thresholds for steps, wasted calls, and fallback rates.
A minimal tool contract example:
{"tools": [{"name": "run_command", "args": {"cmd": "string", "timeout_ms": 120000}},{"name": "edit_file", "args": {"path": "string", "patch": "string"}}],"system_prompt": "You are a helpful software engineer assistant."}
6. Common Misconceptions
- Misconception 1: A higher score means a stronger model. The controlled experiment has ruled out this explanation.
- Misconception 2: Longer prompts are more professional. Overly long prompts take up attention and amplify the cost of adapting to the environment.
- Misconception 3: More tools make the agent more capable. The number of tools is not monotonically correlated with success rate, and selection cost cannot be ignored.
- Misconception 4: A single benchmark run is enough to draw a conclusion. Small-sample variance can create the illusion of improvement.
7. Building Stable Agents in the Cloud
To implement similar capabilities on Baidu AI Cloud, you can use a general combination of product categories: a container platform to host isolated code execution sandboxes, object storage to hold build artifacts and evaluation datasets, a message queue to decouple long-running tasks from result delivery, and logging plus monitoring with alerts to close the observability loop. The key is to turn evaluation, regression, and release into a pipeline, so every harness change passes a controlled evaluation before going live.
8. Conclusion
The score jump from the minimal mode is essentially improved consistency between the inference configuration and the post-training environment, not a sudden change in model capability. The takeaway for developers is direct: fix the model first, then converge tools and prompts, use controlled evaluations to locate bottlenecks, and reproduce the training-time exam room in production through engineering. With these four steps, reliably reproducing full performance no longer depends on luck.
