Why AI Agent Performance Varies with the Harness

    This article explains why an AI agent's effective intelligence fluctuates even when the underlying model stays the same: performance depends not only on model weights but also on the execution harness, the runtime structure that defines how the agent works. It breaks the harness into four configurable layers (prompt, tools, memory, and flow), diagnoses the problem of overfitting to a single harness rather than mastering the task, and proposes Harness Scaling: systematically exposing the model to diverse, well-structured harness combinations during training so it learns harness-invariant skills. The article also includes a practical engineering checklist, common misconceptions, and guidance on matrix-based evaluation that reports cross-harness worst-case results. Readers will learn how to treat the harness as a trainable, measurable variable to improve agent robustness and portability at lower cost.

    An Analogy: Same Brain, Different Workbench

    The same person behaves differently in a formal suit during a negotiation than in pajamas scrolling a phone on the couch. This intuition is easy to accept for humans, yet it is often overlooked for AI agents: an agent’s performance depends not only on the model itself, but also on the workbench it is placed on—how tools are registered, how instructions are organized, how history is compressed, and how the workflow is orchestrated. This runtime structure, which determines how work gets done, is referred to in this article as the execution harness.

    Over the past two years, agents capable of autonomous planning, tool invocation, and multi-step operations have been widely deployed, from coding assistants to everyday task assistants. Behind each of them sits a harness. The harness is usually treated as a fixed backdrop, while only the model weights are optimized. This article argues that the harness is a variable, and its diversity directly determines how well an agent’s capabilities transfer.

    What Is an Execution Harness: Four Configurable Dimensions

    Breaking the harness apart reveals at least four configurable layers:

    • Prompt layer: the structure of the system prompt, the strength of constraints, output format conventions, and retry phrasing after failures.
    • Tool layer: the number and granularity of tools, naming style, strictness of parameter schemas, and readability of error messages.
    • Memory layer: the truncation policy for the context window, the trade-off between summarization and retrieval, and how cross-session state is persisted.
    • Flow layer: single-turn direct answers, plan-execute-verify, multi-agent division of labor, and where human confirmation gates are placed.

    An illustrative configuration snippet (pseudocode, expressing only the configurable dimensions):

    1. harness:
    2. prompt_style: structured | terse | roleplay
    3. tools:
    4. granularity: coarse | fine
    5. schema_strictness: loose | strict
    6. error_message: raw | actionable
    7. memory:
    8. policy: sliding_window | summary | retrieval
    9. cross_session: none | file | kv_store
    10. flow:
    11. pattern: single_shot | plan_act_verify | multi_agent
    12. human_gate: none | before_write | before_deploy

    The same model running under different combinations of these values often shows larger behavioral differences than switching to a mid-sized model. This is not magic; it is a distribution problem: the distribution of harnesses a model saw during training determines its prior at inference time.

    Diagnosing the Problem: Overfitting the Harness, Not Mastering the Task

    Efforts to improve agent capability have mainly focused on two dimensions: task scaling (more task types and harder problems) and environment scaling (more diverse external scenarios and dependencies). Both matter, but they share a blind spot—they scale what to solve and where to work, not how to execute.

    The result is a typical distribution shift: trained in only a single harness, the model mistakes fluency with that interface for the essential ability to get the task done. The symptoms include:

    • Renaming tools or changing parameter order causes a clear drop in invocation accuracy;
    • Switching the prompt from structured to minimal colloquial form makes planning quality unstable;
    • Changing the memory policy from sliding window to retrieval causes key constraints to be lost midway through long tasks;
    • Replacing raw stack traces with actionable suggestions leaves the model unable to self-correct.

    This is the same root cause as implicit coupling in software engineering: a module is validated under only one fixed calling convention and breaks when the convention changes. If evaluation does not cover the harness dimension, overfitting will be misread as generalization.

    The Solution: Harness Scaling

    The core idea in one sentence: do not train in only one harness; systematically expose the model to a large set of well-structured, comprehensive harness combinations during training, forcing it to learn harness-invariant skills—goal recognition, state tracking, error attribution, constraint satisfaction, and knowing when to ask for help.

    Implementation can follow four steps:

    1. Define the harness space: turn the four layers above into discrete dimensions, specify the values and combination constraints for each dimension, and remove obviously unreasonable combinations.
    2. Sampling and stratification: use stratified sampling to ensure key dimensions are all covered and avoid missing long-tail dimensions through random sampling; increase sampling weight for high-risk combinations (such as strict schema plus raw error messages).
    3. Training and curriculum: arrange harness difficulty from simple to complex, starting with a single tool and short flow, then multiple tools with long flows and multi-agent setups; rotate the same task across different harnesses so that “same task, different harness” becomes a normal signal.
    4. Matrix-based evaluation: hold out unseen harnesses as a test set, and report the cross-harness mean and worst-case performance rather than the peak of a single harness.

    Illustrative pseudocode:

    1. for task in task_suite:
    2. for harness in stratified_sample(harness_space, k=4):
    3. traj = rollout(policy, task, harness)
    4. loss += objective(traj, invariant=task.goal) # Reward only task completion, not interface fluency

    The key is the last line: the reward is bound only to the task goal and decoupled from the harness form, preventing the model from learning the shortcut of pleasing the interface.

    Engineering Practice Checklist

    • Tool design: make names and descriptions readable for the model, keep parameter schemas strict, and have error messages provide actionable fix suggestions instead of raw stack traces.
    • Layered prompts: put stable constraints in the system layer and volatile details in the outer layer, so constraints are not lost when the harness changes.
    • Replaceable memory: make the memory policy an interface so summarization and retrieval can be switched, and explicitly maintain a goal-constraint-progress triple for long tasks.
    • Orchestrable flow: set confirmation gates for high-risk actions, and route failures into a verify-retry loop instead of forcing complex tasks through single-turn direct answers.
    • Observability: uniformly record harness configurations and trajectories, and use logging services with monitoring and alerting to determine whether an issue is a model problem or a harness problem.

    When deploying on the cloud, you can use a container platform to host multiple harness images for parallel evaluation, object storage to archive trajectories, a message queue to decouple task scheduling, and monitoring and alerting to track cross-harness metric fluctuations; the relevant general capabilities of Baidu AI Cloud can be combined along these lines.

    Common Misconceptions

    • Misconception 1: a more complex harness is always stronger. In fact, dimensions conflict with each other, and complex combinations often reduce stability; aim for coverage rather than stacking.
    • Misconception 2: a performance drop after switching harnesses means the model is inadequate. Perform harness attribution first, then decide whether to retrain.
    • Misconception 3: evaluation should look only at the best score. The cross-harness worst case is the lower bound of production risk.

    Conclusion

    An agent’s “intelligence” is not a constant; it is a conditional performance determined jointly by the model and the harness. Elevating the harness from a fixed backdrop to a first-class variable that can be trained and evaluated, and trading Harness Scaling for cross-interface generalization, is currently the most direct lever for improving agent robustness. Define the harness space and build matrix-based evaluation first, then discuss model iteration—this often yields more reliable gains at lower cost.