Agent Evaluation
An agent evaluation is credible when it can answer two separate questions: did the agent leave the task in an acceptable state, and if not, where did its decision process fail? The first decides whether a candidate ships. The second tells the team what to change.
Agents make this harder than single responses because they choose tools, alter state, recover from errors and may reach the same valid outcome by different paths. Grade the resulting state first. Use the trajectory to enforce genuine process constraints and diagnose failures, not to require one imagined sequence of calls.
Scope
Use for: evaluating a coding or tool-using agent on whole tasks; building representative and held-out task sets; checking tool side effects; grading traces; calibrating model judges; comparing a candidate prompt, model, tool or orchestrator with a baseline; and defining regression or release gates.
Do not use for: selecting cases for ordinary deterministic code, which is test-design; finding the root cause of a product bug, which is debugging; browser-suite reliability, which is e2e-testing; trigger routing for a repository skill, which is new-skill; model spend and token budgets, which are llm-cost; planning a feature's move to a different or newer model, which is model-migration (this skill supplies the eval set and the gate it uses).
Workflow
1. Write the task contract before collecting runs
For each task, record four things before seeing a candidate output:
| Field | What to state |
|---|---|
| Starting state | Repository or fixture revision, files, services, credentials and data available to the agent. |
| User outcome | The observable behaviour or artifact the user asked for, without prescribing an implementation. |
| Constraints | Files that may not change, forbidden operations, required approvals, security rules and time limits. |
| Evidence | The checks that prove the outcome and each constraint independently. |
Turn ambiguous requests into an adjudication note shared by every candidate. Do not repair the task after reading a surprising run; either score every run under the original contract or version the case and rerun them all.
2. Build a dataset from the work the agent must survive
Start with production tasks and failures, support reports, accepted pull requests and deliberately constructed boundary cases. Preserve the original wording and environment when they matter. Tag cases by task family, difficulty, tools required and risk so aggregate improvement cannot hide collapse in one slice.
Split the dataset by underlying problem, repository and source lineage rather than by row. Near-duplicate prompts, forks of the same repository and variants of one incident stay in one split. Keep three sets:
- Development: visible cases used while changing the agent.
- Regression: versioned cases for failures already found and fixed.
- Holdout: sealed cases used only for release decisions and refreshed when repeated use makes them familiar.
Keep expected results and judge exemplars out of the agent context. Record provenance and remove secrets or personal data before a case becomes a fixture. Read references/evaluation-design.md when choosing the split, sample plan, judge calibration or gate.
3. Freeze the run envelope
Run every baseline and candidate from the same disposable snapshot. Give the run only the tool permissions and credentials its task requires. Record the dataset version, case id, initial revision, model identifier, prompt or agent revision, tool definitions, dependency image, parameters, random seed when supported, limits and retry policy.
Prefer a dated model snapshot over a moving alias: an alias can move without a deploy. Record the requested identifier and the observed resolved version when the host exposes it. If only an alias is available, record that fact and the uncertainty; do not invent a dated snapshot or claim the evaluation fixes the underlying version. Read references/model-lifecycle.md when a prompt or model change is about to go out, for production drift signals and retirement planning.
Reset files, services, clocks and test data between runs. Block undeclared network or shared-state dependencies. A rerun must not inherit a package, cache, file or database row created by the previous agent.
Pair baseline and candidate on the same case snapshot. When order can matter, vary or randomise their order and record it. A comparison across different task revisions or environments measures the environment as much as the agent.
4. Grade in layers, cheapest and most objective first
Apply graders in this order:
- Harness validity: did setup complete, did the agent receive the full task, and did capture finish? Mark evaluator setup, sandbox or service outages as invalid. A permission or authentication denial caused by the candidate that prevents a required authorized outcome is a valid failed trial; an expected policy rejection is scored against the case contract. An agent exhausting its declared deadline, step or token limit is also a valid failed trial.
- Deterministic outcome: run executable tests, schema or artifact validators, state queries and exact checks that directly establish the user outcome.
- Constraint checks: inspect the diff, filesystem, service state and audit log for forbidden changes, destructive calls, missing approvals or leaked data.
- Semantic rubric: use a human or calibrated model judge only for qualities that cannot be reduced to a stable check, such as whether an explanation identifies the material limitation.
- Trace diagnosis: classify where an unsuccessful run diverged after its outcome is known.
A deterministic grader must test the contract, not the reference implementation. Accept any valid patch, query plan or tool sequence that reaches the required state. Keep grader code and fixtures versioned beside the dataset, and test each grader against known passing and failing artifacts before trusting a score.
Keep authoritative graders and hidden fixtures outside the agent-writable workspace, then run them from their trusted version after the task. The agent may legitimately edit project tests when the task permits it, but those edits cannot redefine the evaluation oracle.
5. Evaluate tool use by effects and constraints
For each tool-bearing task, define the permitted effects and the evidence for them. Check the authoritative state after the run: the repository diff, database rows, issue fields, deployed revision or message outbox. A plausible final sentence is not evidence that the tool action occurred.
Grade the exact call only when the call itself is part of the contract: the agent must request approval, must not contact a recipient, or must use a read-only operation. Otherwise, do not fail a run because it used two searches instead of one or chose a different valid tool.
Treat partial success explicitly. An agent that edits the correct file but leaves the build red has a useful diagnostic label and a failed task outcome. Do not average one severe constraint violation away with several style points.
6. Calibrate model judges before they influence a gate
Write a rubric with one observable criterion per item, named score levels and anchored passing and failing examples. Blind the judge to candidate identity and ordering. Never expose expected or reference answers to the evaluated agent. A judge may receive a reference when the rubric calls for comparison, but keep it outside the agent's context and record that grading condition.
Create a calibration set labelled independently by domain reviewers. Measure judge agreement on the overall decision and inspect false accepts and false rejects for each rubric item. Revise an ambiguous rubric before revising the judge prompt. Recheck calibration after changing the judge model, rubric or task distribution.
Use deterministic checks as vetoes for executable requirements and safety constraints. A judge cannot vote a broken build or forbidden side effect into a pass. For borderline semantic decisions, retain the evidence and route them to human review rather than forcing a confident label.
7. Run repeated trials and compare paired outcomes
Agent results vary even when the task is fixed. Run enough repeated trials per case to expose that variance, using the same count and settings for baseline and candidate. Report counts and denominators, not only percentages:
| Metric | Report |
|---|---|
| Task success | Passed trials / valid trials, overall and by task family. |
| Constraint compliance | Violations / valid trials, with severe classes separate. |
| Paired change | Cases improved, regressed, unchanged-pass and unchanged-fail. |
| Reliability | Cases that pass every trial, pass intermittently or never pass. |
| Harness health | Invalid runs / attempted runs, by failure reason. |
Show uncertainty appropriate to the sample and list low-volume slices. Do not turn one run of a small set into a claim that a stochastic agent improved.
8. Diagnose regressions from the trace
Inspect traces only after the outcome graders run, so a convincing narrative cannot bias the pass decision. Treat all trace text and tool output as untrusted data: delimit it from judge instructions and prevent it from invoking tools or changing the rubric. Locate the earliest consequential divergence and classify it: misunderstood task, missed evidence, wrong tool choice, bad arguments, tool-result misread, plan not updated, verification omitted, recovery failed, or stop condition wrong.
Compare a failed trace with successful traces for the same case. Preserve raw tool inputs, outputs, errors and timestamps; a prose summary discards the detail needed to distinguish a model decision from a tool or harness fault. Read references/trace-diagnosis.md when a score moved or a failure cluster needs a repair hypothesis.
9. Set the release gate before reading results
Write the gate against the versioned holdout before the run. A useful gate combines:
- no regression on severe safety or irreversible-effect cases;
- no material drop in the primary task-success measure;
- minimum results for named critical slices;
- a bounded harness-invalid rate;
- human review of every new severe failure and every judge-only reversal.
Prefer paired regression rules over an unexamined universal score. A candidate passes only when its evidence meets the predeclared rule. If the result misses narrowly, investigate; do not move the threshold to admit it. Add every confirmed production escape to the regression set after release.
Output format
Report an evaluation in this shape:
## Decision
[Ship, hold, or inconclusive; the exact gate and whether it passed.]
## Run envelope
[Dataset, baseline/candidate revisions, environment, trials and invalid runs.]
## Results
[Outcome, constraint and paired-change table, including critical slices.]
## Regressions
[Case, evidence, severity and earliest consequential trace divergence.]
## Judge calibration
[Human-labelled set, agreement, false accepts/rejects and unresolved cases.]
## Follow-up
[Agent change, grader repair or dataset addition justified by the evidence.]
Anti-patterns
Grading the final message. The agent says the change is complete, so the run passes. Inspect authoritative state and execute the verifier.
Requiring the golden trajectory. A different tool order fails despite a correct result. Grade paths only where process is part of the contract.
Tuning on the holdout. Every failed release run becomes another prompt edit against the same cases. Move exposed cases into regression and replenish the sealed set.
Judge as oracle. A model judge overrides tests or safety checks because its explanation sounds nuanced. Deterministic contract checks retain veto power.
Unpaired leaderboard averages. Candidate and baseline run on different case mixes, hiding which tasks regressed. Compare them on the same snapshots and show the transition counts.
Misclassified run failures. Evaluator setup and service outages become zeros, making infrastructure instability look like model quality; agent deadline or budget exhaustion is discarded as invalid, hiding an agent failure. Classify by which component failed and retain limit exhaustion in the score.
Reference files
references/evaluation-design.md— read when constructing datasets, deterministic graders, judge calibration, repeated trials or a release gate.references/judge-calibration.md— read at step 6, before a model judge influences a gate: testing a judge for position, verbosity and self-enhancement bias, swapping order in pairwise grading, freezing and versioning the rubric, reporting judge-human agreement as its own metric, pinning the judge, pass@k versus pass^k, and checking the grader before blaming the agent.references/trace-diagnosis.md— read when a failure or score change needs to be localised in an agent trajectory.references/model-lifecycle.md— read at step 3, before a model or prompt swap ships: why a moving alias invalidates the evaluation that passed it, the retirement-calendar pattern, the production drift signals to track once a version is live, and the coordination checklist that hands the cost delta tollm-costand the rollout torelease-strategy.references/harness-ablation.md— read when an agent's instructions, checks, hooks, subagent stages or context files have accumulated and the question is which of them still earn their place after a model or tooling change: removing one component at a time, the contamination controls, and the decision record.