Model vs. Harness: How to Choose the Right Combination for Code Agents

    When you evaluate a code agent, judging the model in isolation can be misleading. This article argues that the right unit of evaluation is the "model × harness" combination. It explains what a harness (the execution framework wrapping the model) actually changes—context assembly, action space, feedback loops, and error recovery—and why the same model can behave very differently under different harnesses. It then walks through a practical selection process: defining a realistic task distribution, preparing candidate combinations, choosing metrics (Pass@1, Pass@k, latency, cost, regression rate, safety), and running staged evaluations. A runnable minimal code example illustrates the combination-search structure, and the article closes with common pitfalls and a summary. By the end, readers should understand how to build evaluation sets from real tasks and keep models decoupled from execution frameworks for more reliable selection decisions.

    Model vs. Harness: How to Choose the Right Combination for Code Agents

    1. The Key Takeaway First: The Unit of Evaluation Should Shift from “Model” to “Model × Harness”

    In traditional tasks such as Q&A and summarization, evaluating a model usually means looking only at its inputs and outputs. But in a code agent scenario, the model does not answer in isolation. It works inside an execution framework, closing the loop of “understand the task, call tools, modify files, run tests, read feedback, and keep fixing.” The Harness is the execution framework wrapped around the model, including context organization, the toolset, command parsing, error feedback, and retry strategies.

    For this reason, the real performance of a code agent cannot be blamed solely on the model’s capability. A more accurate question is not “which model is strongest at code,” but rather “under the current task, cost, latency, and safety constraints, which model-and-Harness combination is more reliable.” This kind of combination evaluation is closer to a real production environment and helps avoid being misled by a single leaderboard.

    2. What Does a Harness Actually Change?

    A Harness influences at least four aspects.

    1. Context organization: Code repositories are often large, and the Harness decides which files, retrieval results, message history, error stack traces, and project conventions the model sees. Poor context selection can leave even a strong model missing key information.

    2. Action space: Which tools the model can call, and how granular those tools are, both affect the execution path. Fine-grained tools may help models with weaker planning ability, but they can also make strong models switch frequently, reducing efficiency.

    3. Feedback loop: How test failures, compilation errors, and malformed patches are fed back to the model determines whether it can self-correct. The clearer and more structured the feedback, the easier it is for the model to fix problems.

    4. Error recovery and retries: When a command fails or a patch conflicts, whether the Harness retries automatically, provides summaries, and limits repeated errors affects the task completion rate.

    Put differently, the Harness acts as the agent’s hands, eyes, and process controller. The same model, under different Harnesses, sees different contexts, can perform different actions, and receives different feedback—so its final performance may differ substantially.

    3. Why Results Can Vary Greatly Even When the Model Stays the Same

    In code agent evaluation, a phenomenon worth watching for is this: when the model is fixed and only the Harness is swapped, the task pass rate may change significantly. The following is an illustrative example meant to explain the trend, not measured results from a specific benchmark:

    • Model A passes roughly 23% of tasks under framework X, and about 52% after switching to framework Y;
    • Model B passes roughly 15% under framework X, and about 36% after switching to framework Y.

    These numbers are here only to make a point: the difference caused by changing the Harness can be several times larger, not a small fluctuation that ordinary evaluation noise can be ignored as. In real projects, the exact figures depend on task distribution, model version, sampling parameters, test coverage, timeout settings, and retry strategy, so re-testing against your own task set is the reliable approach.

    Another phenomenon is that the best Harness may differ across models. For instance, in one illustrative example, 10 harnesses were evaluated on two models, and the correlation coefficient between the final rankings was about -0.05. This result should not be simply interpreted as “there is definitely no correlation.” The reason is that the sample size is only 10, and if prompts, temperature, tool implementations, or task-difficulty distributions differ even slightly, the ranking correlation can swing widely. A more accurate understanding is that rankings may be unstable under a small sample, and you cannot assume one framework is best for all models.

    Three reasons lie behind this:

    1. Different capability gaps. A given Harness may compensate for a model’s weak planning ability through finer-grained step guidance; but once you switch to a model already good at planning, over-constraining it may reduce flexibility instead.

    2. Sensitivity to context strategy. Some models make good use of long context and perform better the more you give them; others tend to lose focus in long context and become more easily distracted the more you provide.

    3. Error-feedback coupling. Different models interpret error formats differently. A structured prompt that works for Model A may be misread by Model B, causing a fixable task to fail repeatedly.

    Therefore, code agent evaluation cannot look only at a “model score.” It should focus on “combination scores” and “combination rankings.”

    4. How to Choose a Harness for a Code Agent

    You can follow this process.

    Step 1: Define the real task distribution. Do not rely solely on a set of questions unrelated to your business. It is recommended to extract desensitized tasks from real repositories, such as bug fixing, interface implementation, test supplementation, dependency upgrades, code refactoring, and log analysis. Each task should ideally have an executable way to verify it, such as unit tests, integration tests, static checks, or patch-applicability checks.

    Step 2: Prepare candidate combinations. The candidates should not be models alone, but should also include different Harnesses: lightweight command-execution frameworks, frameworks with code retrieval, frameworks emphasizing test feedback, frameworks supporting multi-agent collaboration, and so on. For each framework, specify its toolset, context window, maximum number of steps, timeout, retry count, and logging granularity.

    Step 3: Choose metrics. Common metrics include:

    • Pass@1: the proportion of tasks that pass tests in a single run;
    • Pass@k: the proportion that pass after allowing k attempts;
    • Average steps and average latency;
    • Token cost and inference cost;
    • Regression rate: the proportion of cases where fixing one problem breaks other tests;
    • Safety metrics: whether it runs dangerous commands, leaks sensitive information, or modifies files beyond its authorization.

    Step 4: Evaluate in stages. First, run a smoke test on a small sample to confirm the environment works; then run coarse screening on a larger task set; finally, evaluate the candidate combinations repeatedly to observe stability. If conditions allow, you should also run a staged rollout, comparing online task success rate, human-takeover rate, and user wait time.

    5. A Minimal Code Example for Combination Evaluation

    The code below is a runnable minimal illustration of the “combination search” structure. In a real scenario, you would replace the model invocation, Harness execution, and test verification with your own implementation.

    1. def pass_at_1(results):
    2. return sum(results) / len(results) if results else 0.0
    3. def evaluate_combination(model, harness, task_set):
    4. results = []
    5. for task in task_set:
    6. result = harness.run(model=model, task=task)
    7. results.append(result["passed"])
    8. return pass_at_1(results)
    9. class MinimalHarness:
    10. name = "minimal"
    11. def run(self, model, task):
    12. # Illustrative logic: pass only when the model output matches the expectation
    13. return {"passed": model == task["expected"]}
    14. models = ["model_a", "model_b"]
    15. harnesses = [MinimalHarness()]
    16. tasks = [
    17. {"expected": "model_a"},
    18. {"expected": "model_b"},
    19. ]
    20. for model in models:
    21. for harness in harnesses:
    22. score = evaluate_combination(model, harness, tasks)
    23. print(model, harness.name, score)

    The core of this example is not the model logic but the evaluation structure: every combination runs on the same batch of tasks, with pass rates recorded in a consistent way. In practice, it is recommended to encapsulate model invocation, tool execution, test commands, timeouts, and logging inside the Harness, so that combination results are reproducible.

    6. Common Pitfalls

    1. Looking only at public leaderboards. The questions on public leaderboards may differ greatly from your repository, language, framework, and testing habits.

    2. Fixing on a single Harness. After the model is updated, the previously optimal framework may no longer fit.

    3. Focusing only on the highest score. A code agent needs to be stable, retryable, and auditable; a single highest score does not represent production readiness.

    4. Ignoring cost and latency. A combination with a slightly higher pass rate—but several times the latency or uncontrollable cost—may not be suitable for production.

    5. Skipping regression validation. Code fixes often “repair one place and break another,” so the regression rate should be part of the evaluation.

    7. Summary

    In the era of code agents, the core of evaluation is not attaching a fixed label to a single model, but finding a “model × Harness” combination suited to the task distribution. The model determines potential capability; the Harness determines whether that capability can be reliably delivered. It is recommended that teams build evaluation sets from real tasks, compare Pass@k, cost, latency, regression rate, and safety at the same time, and keep models decoupled from execution frameworks. This way, when a new model or new framework appears, you can quickly recombine, re-evaluate, and make a more robust selection decision.