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.
- 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.
| Measure | Why |
|---|---|
| Success rate with interval | Primary quality signal |
| pass^k | Consistency users experience |
| Tokens and cost per task | Economics of the change |
| Steps and wall-clock per task | Latency and efficiency |
| Unsafe or forbidden actions | Must stay at zero |
| Human interventions per task | Autonomy 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.
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.
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) == expectedHarness 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.