Phase 0: Agent Harness · ~90 minutes · Python (stdlib)
Eval Harness with Fixture Tasks
A coding agent is only as good as the suite of tasks you measure it against.
What you will learn
- Define a fixture task as a triple of goal, setup, and verifier.
- Score multiple sample runs per task and compute pass@1 and pass@k.
- Aggregate latency and cost into mean and 95th-percentile metrics.
- Wire deterministic verifiers (file diff, exit code, regex match) into reusable functions.
- Emit a structured JSON report a regression-tracking script can ingest.
Introduction
This lesson builds an evaluation harness that takes a folder of fixture tasks, runs each through a candidate agent, scores pass or fail through a deterministic verifier, and aggregates the results into pass@1, pass@k, mean latency, and mean cost. The harness is the source of truth that lets you tell a regression from a refactor.
- Type: Build
- Languages: Python (stdlib)
- Prerequisites: Verification Gates and the Observation Budget, Sandbox Runner with Denylist and Path Jail, Eval-driven agent development, SWE-bench and GAIA benchmarks
- Time: ~90 minutes
Objective
Learning objectives
- Define a fixture task as a triple of goal, setup, and verifier.
- Score multiple sample runs per task and compute pass@1 and pass@k.
- Aggregate latency and cost into mean and 95th-percentile metrics.
- Wire deterministic verifiers (file diff, exit code, regex match) into reusable functions.
- Emit a structured JSON report a regression-tracking script can ingest.
The Problem
Three failure modes plague agent benchmarks built without an eval harness.
The first is unverified pass. The agent says it fixed the bug, the human glances at the diff, the suite is marked green, and three weeks later the regression test surfaces the same bug. The agent had reasoned plausibly without actually fixing anything.
The second is undetected regression. A change to the prompt template makes the agent 4% better on the loud task and 14% worse on the quiet one. Without a goldset and a per-task score, the regression rides into main and surfaces only when a customer complains.
The third is per-task drift. The eval was run on Monday with 100 tasks and on Friday with 95 of them, because somebody renamed five fixtures. The pass rate looks like a 5% improvement. It isn't.
The harness is the program that turns these failures into facts. It runs every fixture, every time, in a reproducible order, against a verifier that returns true or false on a deterministic check.
The Concept
A FixtureTask is a small JSON file plus an optional expected/ directory. The JSON declares an id, a goal (the prompt fed to the agent), a setup block (files to drop into the scratch dir), and a verifier block. The verifier block names a function in the harness's verifier registry and supplies its arguments.
Three verifier shapes cover the majority of useful tasks.
The first is file_equals. After the agent runs, compare a named file against an expected content. This catches "fix this bug in this exact way" tasks.
The second is regex_match. The named file's contents are matched against a regex. This catches "the function must exist and return X" tasks where there are many acceptable solutions.
The third is shell_exit_zero. The harness runs a shell command (through the sandbox from Sandbox Runner with Denylist and Path Jail) and passes the task only if the command exits zero. This catches "the tests must pass" tasks.
The harness runs each task k times. Pass@k is 1 - (1 - p)^k where p is the empirical pass rate; the harness also reports raw counts so you can spot variance. Latency is wall-clock per sample. Cost is whatever the agent self-reports (token count, USD, or both); the harness sums it across samples and presents the per-task and aggregate numbers.
This lesson is free
You've read the first 4 sections. The rest covers Build, Check Yourself, Key Terms & Next. A free account opens all of it, with its practice questions. No card.
Create a free account — the opening phases of 29 of 35 courses, and the first lesson of every phase, are free, no credit card.
Browse all courses · View pricing · DeVenture Academy