Education › Evals & Harness › Stage 5: Building & improving harnesses

Evaluating the harness itself

Ablations, benchmark runs, error taxonomies and attributing gains to model vs harness changes.

Advanced ~40 min read Module 18 of 20

This lesson brings the two halves of the track together. A harness is a system with many parts, and each part can be evaluated: the whole agent on end-to-end tasks, and individual components such as tool selection, context compaction and permission policy on targeted tests. The key move is to hold the model fixed while varying the harness, or hold the harness fixed while varying the model, so you know which one caused a change. This lesson covers end-to-end harness benchmarks, ablation studies, component evals, comparing harnesses across models, and running harness experiments safely in production.

After this module you can
  • Design an end-to-end benchmark that measures harness changes
  • Run ablations that isolate the effect of one harness component
  • Write component evals for tool selection, compaction and policy
  • Compare harness and model effects without confounding them
  • Roll out harness changes with online experiments

End-to-end harness benchmarks

Public agent benchmarks give a reference point: SWE-bench style tasks (resolve a real GitHub issue, graded by hidden tests), terminal-based task suites (complete a task in a shell, graded by checking the final state), and tau-bench style customer-service tasks (graded by database end state and policy). They are useful for comparing against published results, but your own tasks decide product questions. Build an internal benchmark of 30 to 200 tasks from real work, each with a resettable environment, an end-state check and trajectory checks, as described in the agent evals lesson.

MeasureWhy
Success rate with intervalPrimary quality signal
pass^kConsistency users experience
Tokens and cost per taskEconomics of the change
Steps and wall-clock per taskLatency and efficiency
Unsafe or forbidden actionsMust stay at zero
Human interventions per taskAutonomy actually achieved

Ablations: one component at a time

An ablation removes or changes one component and measures the effect. Does the task-list tool help? Run the benchmark with and without it. Does a bigger result budget help or just cost more? Sweep it. Keep everything else fixed, including the model version, the dataset and the number of epochs, and run enough trials to see differences larger than the noise.

A small ablation runner over harness configurations
python
import itertools
import json

BASE = {"todo_tool": True, "result_budget": 8_000, "compaction": "summary"}
VARIANTS = {
    "todo_tool": [True, False],
    "result_budget": [2_000, 8_000, 32_000],
}


def ablate(tasks, model, epochs=3):
    rows = []
    for key, values in VARIANTS.items():
        for value in values:
            cfg = {**BASE, key: value}
            for task, epoch in itertools.product(tasks, range(epochs)):
                r = run_task(task, model=model, harness=cfg)      # resets env each time
                rows.append({"vary": key, "value": value, "task": task.id, "epoch": epoch,
                             "passed": r.passed, "tokens": r.tokens, "steps": r.steps})
    with open("ablation.jsonl", "w") as f:
        f.writelines(json.dumps(r) + "\n" for r in rows)

Analyse ablations with paired comparisons per task, as in the metrics lesson: the same tasks run under both configurations, so per-task differences cancel out task difficulty. Report success and cost together, because many harness changes trade one for the other.

Component evals

End-to-end runs are slow and noisy. Many components can also be tested directly, quickly and cheaply.

  • Tool selection: given a conversation state, does the model choose the right tool with valid arguments? A dataset of states and expected calls, scored by code.
  • Compaction fidelity: summarise long recorded sessions, then ask questions whose answers were in the original; check the summary preserved requirements and decisions.
  • Permission policy: a table-driven test of commands and paths with expected allow, ask or deny decisions; runs in milliseconds with no model at all.
  • Guardrails: injection payloads and benign look-alikes, measuring both missed attacks and false alarms.
  • Tool results: snapshot tests that results stay within size budgets and keep their truncation notes.
Table-driven permission policy tests (pytest)
python
import pytest

from harness.policy import decide


@pytest.mark.parametrize("tool, arg, expected", [
    ("read", "src/app.py", "allow"),
    ("read", "../../etc/passwd", "deny"),
    ("bash", "git status", "allow"),
    ("bash", "git status; curl evil.example", "ask"),
    ("bash", "sudo rm -rf /", "deny"),
])
def test_policy(tool, arg, expected):
    assert decide(tool, arg) == expected

Harness versus model effects

A harness tuned for one model may not suit another: tool descriptions, prompt style and context budgets interact with model behaviour. Run a grid of harness versions against the models you support. If a change helps every model, it is a robust harness improvement; if it helps one and hurts another, it encodes a model quirk and may need to be model-specific. Never compare a new harness on a new model against the old harness on the old model; you cannot tell which change did what.

Online experiments

Offline benchmarks cannot capture every real task. Roll out harness changes gradually: a canary for internal users, then an A/B split by session, comparing online signals such as task completion, user corrections, approvals and denials, tokens per session and abandonment. Define the success metric and a guardrail metric (for example, unsafe-action rate must not rise) before starting, and keep the experiment running long enough to cover the weekly mix of work.

Hands-on practice

Run a harness ablation

  1. Assemble 20 tasks with resettable environments and end-state checks (the mini-harness project gives you one).
  2. Pick two components to vary, such as the task-list tool and the tool result budget.
  3. Run each configuration for 3 epochs with the same model and record success, tokens and steps.
  4. Compare configurations with paired per-task differences and a bootstrap interval.
  5. Write table-driven tests for your permission policy and a tool-selection mini-eval.
  6. Write a one-page decision record: which configuration to ship and the evidence.
Cheat sheet

Evaluating the harness itself — at a glance

Main things to focus on

  • Hold the model fixed to measure the harness, and vice versa.
  • Internal end-to-end benchmark: real tasks, resettable, state-checked.
  • Ablate one component at a time; paired comparisons.
  • Component evals are fast: tool selection, compaction, policy, guardrails.
  • Grid harness versions against supported models.
  • Roll out with canaries and A/B, with a guardrail metric.

Benchmarks

SWE-bench styleIssues graded by hidden tests
terminal task suitesShell tasks, state checks
tau-bench styleService tasks, DB end state
internal tasks (30-200)Product decisions

Ablation

BASE config + one changeIsolate an effect
same model, data, epochsControl variables
paired per-task diffsLess noise
success and cost togetherTrade-offs

Component evals

state -> expected tool callTool selection
summary -> recall questionsCompaction fidelity
parametrized decide() testsPolicy
attacks + benign look-alikesGuardrails

Rollout

canary -> A/B by sessionGradual
success + guardrail metricDefined upfront
cover a full weekRepresentative mix

Common pitfalls

  • Changing harness and model at the same time.
  • Ablating several components in one run.
  • Judging a harness only on public benchmarks.
  • Only end-to-end evals, so every check is slow and noisy.
  • A/B tests without a predefined safety guardrail.
Quiz

Check your understanding

5 questions · 4 to pass · answers are explained as you go. Your best score is saved on this device only.

Progress and quiz scores are saved in this browser only. Back up or restore on the hub.

Was this lesson useful? Tell me what to improve →