Mental model
Agent evaluation treats multi-turn autonomous workflows as stateful software systems rather than static text completion prompts. Instead of judging eloquent final answers, production harnesses spin up seeded sandbox environments, assert exact external world-state transitions (database records, diffs, API ledger mutations), audit tool call trajectories and security boundaries, and measure consistency across multiple independent runs (pass^k).
Learning outcomes
- Measure world-state side effects deterministically rather than trusting an agent's self-reported completion summary.
- Contrast optimistic
pass@kcapability discovery (1 of k succeeded) against production reliability consistencypass^k(all k runs succeeded). - Construct layered agent evals spanning unit code graders, trajectory step-cost limits, security injection probes, and calibrated LLM rubrics.
Theory
Evaluation harnesses built solely for stateless chat fail catastrophically on tool-using agents because an agent can apologize politely while deleting the wrong row, burn 28 tool calls circling broken filters before stumbling onto luck, or claim "Refund complete" while omitting database commit calls completely. Comprehensive agent benchmarking grades four distinct layers on every release:
| Evaluation Layer | Primary Signal Graded | Determinism | Production Failure Caught |
|---|---|---|---|
| Environment State Assertions | Post-run SQL row values, failing-to-passing test suite exit codes, ledger receipts | 100% deterministic | False success claims, forgotten cleanup, silent corruption |
| Trajectory Efficiency & Path | Tool call count, redundant retry loops, total latency & dollar spend | Deterministic counters | Infinite browse/search loops, wasteful brute-force scanning |
| Policy & Adversarial Security | Unauthorized tool/tenant arguments blocked; prompt injection payloads ignored | Rule engine + taint check | Confused-deputy exfiltration, deleting protected fixtures |
| Rubric & UX Quality Grader | Tone, citation completeness, escalation timing across nuanced edge transcripts | Pairwise LLM judge calibrated via kappa | Correct outcome reached via rude/confusing user interaction |
Notice the crucial statistical distinction between pass@k and pass^k when evaluating non-deterministic agents over repeated trials per task:
pass@k: Probability at least 1 out of runs passes (useful for exploratory R&D / coding search where users pick the best diff).pass^k( approximation across independent trials): Probability all trials succeed consecutively (critical for unattended customer refunds, compliance actions, or SRE playbooks). An agent scoring70%per single trial delivers only five-run consistency (pass^5), exposing fragile edge behavior immediately!
pythonfrom dataclasses import dataclass@dataclass(frozen=True)class TrialTrace:task_id: strtrial_idx: intdb_state_valid: boolpolicy_violations: inttool_calls: intmax_allowed_calls: intdef compute_agent_reliability_metrics(traces: list[TrialTrace],k_trials: int = 3,) -> dict[str, float]:"""Compute pass@k vs strict pass^k consistency while disallowing policy violations."""by_task: dict[str, list[bool]] = {}for t in traces:passed = t.db_state_valid and t.policy_violations == 0 and t.tool_calls <= t.max_allowed_callsby_task.setdefault(t.task_id, []).append(passed)valid_tasks = [runs[:k_trials] for runs in by_task.values() if len(runs) >= k_trials]n = max(1, len(valid_tasks))pass_at_k = sum(1 for runs in valid_tasks if any(runs)) / npass_pow_k = sum(1 for runs in valid_tasks if all(runs)) / nreturn {"pass_at_k": round(pass_at_k, 3), "pass_power_k": round(pass_pow_k, 3)}
Trade-offs
Full container-isolated environment assertion suites with trajectory replay catch real production regressions reliably and expose silent policy tampering before rollout, at the cost of slower CI execution (minutes per run), stateful sandbox reset plumbing, and trace storage redaction overhead. Lightweight final-answer LLM judges run cheaply in seconds on pull requests cleanly, yet miss broken database state, subtle privilege escalation attempts, and multi-turn thrashing completely. Teams pair fast deterministic unit/mock-tool trajectory sanity checks on every commit with nightly real-sandbox pass^3 suites across high-consequence billing and admin tasks.
Failure modes and misconceptions
- Grading Self-Reported Completion: Trusting
"I have refunded $49 cleanly"without asserting downstream ledger state misses silently dropped commits and API errors. - Confusing Single-Run Luck with Production Readiness: Celebrating
pass@5 = 90%whenpass^5 = 12%ships wildly flaky behavior to unattended workflows. - Allowing Test Tampering in Coding Agents: Failing to hash-lock unit tests during autonomous SWE grading lets agents delete failing assertions to make exit codes green cleanly.
- Unredacted Production Trace Leakage: Saving raw customer secrets cleanly into public evaluation fixtures creates severe compliance leaks.
Decision scenario
A customer operations team plans to move a refund agent from supervised human-draft mode into unattended automation after seeing 88% rubric score on single-turn final responses. Telemetry reveals no database postcondition checks or repeat consistency tests. Design a sandboxed SQL state verifier, pass^3 consistency gate, and policy violation suite.
Why is grading an agent solely on a fluent, accurate-sounding final response insufficient before enabling autonomous external actions?