Skip to content

Verification

How to measure agent output quality, design evaluation suites, and use evals to drive development.

Measuring Quality

Behavioral Testing

  • Behavioral Testing for Agents — Test decision quality and end-state for non-deterministic agent systems using capability matrices, three grading methods, and acceptable variance thresholds
  • Behavior Specs: Grading the Trajectory, Not the Result — Declare expected agent conduct in a BEHAVIOR.md file the agent never sees, then grade whole trajectories against it — worth the judging cost only on long runs whose outcome resists verification
  • FLARE: Coverage-Guided Fuzzing for Multi-Agent LLM Systems — Apply coverage-guided fuzzing to multi-agent systems using interaction path coverage as the exploration signal to surface coordination failures and emergent failure modes
  • Structural Coverage Criteria for Agent Workflows — Represent multi-agent workflows as a typed coordination graph and derive coverage obligations over reachable agents, allowed tool edges, restricted tool edges, and delegation edges — a test-adequacy layer that complements end-to-end success scores
  • Skill Test Coverage as a Release Gate — Extract operational obligations from a skill's natural-language workflow and gate release on how many of them any testcase activates; 36.3% of 157 production skills failed an 80% threshold on first measurement
  • Mutation Testing as a Quality Gate for AI-Generated Test Suites — Coverage proves a line ran; mutation testing proves the suite would notice a regression — the discriminator that separates ceremonial agent-written tests from load-bearing ones
  • Code Health as a Signal for Agent-Generated Test Quality — Maintainability of the file under test weakly predicts how good an agent's generated tests are; the signal shows up in mutation score and barely registers in line coverage
  • Audit Your Test Suite With an Agent, Then Certify Each Flag — An agent generates inputs your suite wrongly accepts, and a four-gate certification chain proves each flagged failure genuine before a human triages it — usable only where an oracle independent of the code under test exists
  • Planted-Bug Methodology: Deliberate Bugs as Observability Calibration — Plant deterministic bugs and check that captured signals lead an agent to the responsible layer — if they don't, the gap is in the instrumentation, not the bug
  • LLM API Fault Injection at the HTTP Layer (AgentChaos) — Corrupt named LLM response fields at the HTTP client to score agent robustness; the ranking tracks architecture across all four backbones, and truncation is the fault diagnosis misses at 4.3% accuracy
  • Handoff-Boundary Fault Injection (llmmas-otel) — Delay a message between two agents and diff the faulted trace against a structurally aligned baseline; the amplification it reports is heavy-tailed runtime, reading 59.2 mean against 6.6 median on ChatDev
  • Recovery as a Separate Eval Axis (UndoBench) — Pair every faulted run with an identical-seed control and report recovery only over pairs whose control passed; nominal success read 83.54% against 46.72% conditional recovery, and one fixed method moved 56.96 pp across fault boundaries
  • Behavior-Partitioned Security Tests as Executable Specs — Split security cases by attack mechanism, show one set to the model as its spec, and hold the rest out; showing tests upfront lifts joint success 19.3 pp but raises the visible-pass-but-hidden-fail rate from 5.6% to 18.8%
  • Route-Parity Auditing of Agent Safeguards — Audit safeguards by protected asset rather than by interface, then test that each route's check fails when its control is removed; route inconsistency was coded in 152 of 157 surveyed agent projects
  • Timeout Oracles for Agent-Written Code — Agent-written C utilities produced fewer fuzz failures than their human originals, and every failure from the agent's own code was a hang, so add a timeout-and-memory oracle beside the crash oracle
  • Auditing Agent Tool Chains for Silent Partial Success — Diff a tool's richest surface against its API and wrapper to find calls that return success with fields missing; 51 of 91 audited failures sat at the API layer
  • Red-Team Your Blocking Monitor Before You Trust It — Run a live, monitor-aware agent at your action-approval gate; production gates allowed over 55% of attacks, and the fixes are serializer, coverage, and staging changes
  • Test Adequacy of LLM-Dependent Harness Code — Scope coverage and mutation to the harness statements that depend on model output; across ten agent codebases that slice averaged 44.27% line coverage and a 33.60% mutation score
  • Mock-Boundary Validation for Agent-Built Systems — A green mock-based suite can miss failures at real integration boundaries; in one single-developer case, four features passed the suite and a headless smoke test and then failed at the browser, the model API, and the SDK

Regression Testing

Eval-Driven Development

Review Techniques

  • Five-Pass Blunder Hunt — Run the same critique prompt five times in sequence on a plan or spec; each pass normalizes the issues it finds, forcing later passes deeper into structural and logical problems
  • Pre-Completion Checklists — Block agent completion signals with a mandatory verification sequence
  • Golden Journeys: Restartability as a First-Class Verification Primitive — Name a small set of end-to-end paths with explicit failure signals per step and gate completion on the system restarting cleanly afterward
  • Test-Driven Intent Clarification — Use AI-generated tests to surface specification ambiguity before code review — validate tests instead of code to clarify intent with lower cognitive cost
  • Decision Pins: Confirm an Acceptance Example Discriminates — Run two throwaway implementations that differ only at the named ambiguous point and keep the input where they disagree; 42.7% of 600 generated test suites contained no test that distinguished the readings at all
  • Probing Unstated Constraints in Generated Code (Intent Violation Rate) — A stated suite only checks the constraints your prompt named; two frontier models passed over 92% of stated tests while violating a hidden constraint in more than half of problems, and the violations are deterministic per problem rather than sampled
  • Unstated-Contract Bugs: Sort Tickets by Information Gap — Agents fixed two hard bugs 16/16 and failed an easy one 12/12 because the correct answer lived in user data rather than the repository, so triage tickets by where the information sits and enrich the ticket before the agent starts
  • Source-Grounded Test Plan with Pre-Action Assertion Annotation — Before a UI-driving agent verifies its change, have it write a source-read test plan and annotate each step's expected behavior upfront so it cannot rationalize an unexpected result as a pass
  • Agent-Recorded Video Demos as a Verification Artifact — The agent drives the running app and records a screencast as proof-of-work for human PR reviewers — a visual modality that complements tests where they are weakest, under stated conditions
  • Review That Runs the Application, Not Just the Diff — Pair static review with a pass that renders the change and inspects it; a rendered layout property is not in the diff, and the pass cannot repeat its own verdict
  • Agent-Generated Verification Reports: A Structured Round-Trip for Human Review — Each parallel agent emits a per-sub-task report with the request quoted verbatim and exact test steps, and the human's verified or not-fixed verdict routes back as the completion signal
  • Spec-Derived Execution as a Correctness Oracle — Judge candidate code against a natural-language spec by deriving inputs from the spec, executing them, and grading the I/O pairs — ground the LLM judge in real execution traces instead of asking it to reason over the code
  • Specification-Grounded Test Writing — Give an agent's test writer the specification as enumerated rules so it catches the missing-validation and boundary bugs its own tests otherwise pass — grounding in intent, not test count, drives a +38pp correct-code gain on spec-completeness defects
  • Deriving a Specification From Buggy Code Before Generating Tests — When no written specification exists and the code under test may be wrong, have the model write a behavioral docstring first and generate tests from that with the implementation removed — recovers part of the lost bug-detection power, not all of it
  • Spec-Driven Test Generation: Contract Coverage Is the Lever — Having the agent document pre-conditions, post-conditions and undefined behaviors before writing tests lifted bug detection from 53.4% to 63.2% across five runs, but only when the extracted contract named the condition the bug violated — 54.9% detection with that coverage against 19.4% without
  • Natural-Language Documentation as a Code-Review Intermediate (Verifiable Literate Programming) — Translate LLM code into a deterministic natural-language documentation layer and review that prose, so intent-code mismatches surface where a human can judge them
  • Audit-Budget Allocation for Agent Fleets — Screen an agent's self-reported confidence for discrimination before ranking a review queue by it; past a mimicry threshold the ranked queue does worse than random, and a larger audit budget flips first
  • Evidence-Chain Run Logs: Bracket the Reported Symptom — Pair every agent tool call with its actual result and bracket the change with one machine-readable measurement of the reported symptom, taken identically before and after — a gate, never a signal the agent iterates against
  • Evidence-Bundled Agent PRs: Sizing the Reviewer's Effort — Attach the reproduction, failing probe, and executed test the agent already ran so a reviewer picks a depth per change; the artifacts carry the value, and the agent's own risk grade carries none
  • Claim-to-Evidence Trace Graphs for Auditing Agent Runs — Rebuild a finished session as a layered graph with typed edges so a reviewer traverses backward from a claim to its artifacts and checks; the record layer is deterministic, the graph above it is inferred
  • Post-Merge Fix Signals for Agent Merges — Agent merges draw a verified follow-up fix at 1.62 times the odds of human merges in the same repositories; watch the first week and rank by the commits it took to land, because review duration carries no within-repository effect
  • Name the Check That Passed Before Accepting AI Code — Across 506 coded accounts of AI use in research code, evaluation confidence tracked trust in the tool (r=.33) rather than the checks actually run (r=.05), so gate acceptance on a recorded check instead
  • Reject on a Failing Check, Never Accept on a Passing One — After a fail-on-base check, a generated test still failing on an agent's patch rejected it at 0.82 precision in the test stage of a 121-trace held-out Python run, while the same test passing accepted at only 0.30, so give the reject arm a mechanical decision and the accept arm none
  • Require the Metric the Optimization Should Move — Validation evidence appears in 82.3% of agentic and 80.6% of human performance PRs, but only 34.5% report a metric the applied optimization is expected to improve and 17.7% of caching gains report the memory cost, so name both numbers instead of asking whether the change was validated
  • Transcript-Measured Review Coverage — Agents skipped at least one in-scope file in 67.9% of 1,140 review runs and 80.4% of those runs did not disclose it; derive coverage from the tool-call trace and flag the mismatch with what the report claims
  • Verify Agent Diagnoses and Fix Proposals Before Acting — In a Claude-built codebase, design-fix proposals scored 79.4% accurate against 94.3% for checkable facts, narrowing to 93.4% once rejected proposals are excluded; run the check before you adopt a diagnosis or proposal, since it predicts rather than reports
  • Task Category as the Security Review Routing Key — Generated-code security findings varied three to six times more by task category than by which tool wrote the code, so route review depth by task and grade model choice separately
  • Defect Visibility as the Unsupervised Review Boundary — Diff-visible defects carried an adjusted odds ratio of 2.621 for detection while repository size showed no significant effect once diff size was adjusted, so route unsupervised review on whether the bug is decidable from the diff
  • Circular CI Verification in Dual-Scope Agent PRs — A green check on an agent PR that edited its own CI workflow carries no independent assurance, so require one non-author human approval on infrastructure paths; the observed +13.13-hour median merge-time difference in one cohort does not measure the cost of adding the gate
  • Human-Only Approval Rights at the Agent Merge Gate — 71 of 263 gated merges into main rested only on an approval a coding agent had submitted through the technical lead's account, so express the human-only rule in the setting that counts approvals rather than in the agent's identity
  • Human-Only Approval Rights at the Agent Merge Gate — 71 of 263 enforced-period merges into main rested only on an approval a coding agent had submitted through the technical lead's account, so express the human-only rule in the setting that counts approvals rather than in the agent's identity
  • When a Second Model Helps in LLM Review — Same-model fresh-session review leads on code (F1 40.7% vs 37.2%) and cross-model review on documents (42.1% vs 24.5%); pairing a same-model review with a top-tier cross-model one matched 56.7% of 150 planted errors against 42.7% for two same-model reviews
  • Auditing an Instruction File for Interference Between Its Own Rules — Check rule pairs for mandates another section prohibits; 20 of 21 findings on one vendor prompt needed no model call, and the pairs worth fixing are the ones no action satisfies
  • Oversight Stage Attribution for Missed Agent Defects — Study participants checked beyond the mandatory gate on 65 of 71 silent-defect tasks and fixed 28, so grade a missed defect by which of five review stages it reached rather than by whether a review happened
  • Plan-Stage Checkpoints in Agent Code Repair — A planted wrong mechanism failed 1.5 to 2.4 times as often from a repair agent's implementation plan as from its hypothesis across 1,844 requests, so spend one checkpoint on the plan and have it name state ownership, rollback, isolation, and the API contract
  • A Separate Critic Over Completion-Time Self-Checking — Across 17 verification designs, the strongest separate critic design gained 9.5 points on Terminal-Bench against the strongest completion gate's 6.0, and ran there at 1.13 to 1.25 times baseline cost against the rejection gates' 1.60 to 1.76
  • Paraphrase-First Review: A Zero-Context Reader Restates the Design Before Listing Gaps — A zero-context reviewer restates what a design document proposes before it lists gaps, and a wrong restatement is itself a finding

Rubric Design

Guardrails

  • Verification Capacity as the Agent Quality Ceiling — Agent generation scales with compute and verification throughput does not; measure the two rates and pick deliberately between scaling verification, throttling generation, and lowering the bar
  • Verification Capacity Saturation: Three Levers, One Default — When changes arrive faster than a gate clears them, a genuinely saturated station admits only three responses, and a gate that degrades rather than blocks picks the third on its own
  • Diff-Coverage Gating for Agent-Authored Pull Requests — Gate an agent's PR on the coverage of its changed lines, not the whole-repo percentage, because agents test under half of code-touching PRs and existing suites cover a minority of what they change
  • Deterministic Guardrails Around Probabilistic Agents — Wrap agent output in hard, deterministic checks — linting, schema validation, CI gates — that enforce correctness regardless of what the agent produces
  • Replacing the LLM Filter Stage With a Fine-Tuned Classifier — GitHub's new secret scanner pairs regex candidate generation with a fine-tuned ModernBERT classifier; every figure it publishes is relative to its own previous LLM pipeline, and none is absolute
  • Verification as a Tool, Not an Instruction — Prompting an agent to verify its answer moved reference-based checking from 19% to 22%; a callable scoring tool roughly tripled that share at every prompt level, and improved score and calibration with it
  • Zero Violations Is Not Evidence Your Hook Works — A blocking hook writes output only when it denies something, so record a firing trace and run a directed attempt against the locked path before reading a clean run as enforcement
  • Per-Layer Suppression Accounting in Acceptance Gates — Record which layer discarded each item, because a composite count hides whether the deterministic half is filtering at all; in one pre-registered 40-run ablation it never fired
  • Choose Agent Gate Layers by Mechanism Class, Then Measure — Two LLM judges over 560 agent actions labeled block composed to 1.2 to 1.4 independent layers and a rule layer plus one judge to 1.9 to 2.1; a 20% solo-accuracy gain added no coverage at all
  • Count Evidence Sources, Not Approving Votes — Gate a consequential agent action on approvals spanning two independent evidence sources; the source-counting rule blocked 0.9% of correct payments against 7.4% for the best vote-counting rule at equal safety
  • Slop Detectors Fail as Per-Item Review Gates — Model-free AI-content signals are corpus-level estimators whose strongest code features an autoformatter erases; gate on build, test, diff-versus-description, and changed-line coverage instead
  • Evidence-Conditioned Execution: Gate Edits on Observations — Hold an agent's edit or patch submission until its trajectory satisfies machine-checked conditions naming the repository entities it should have observed first; the gain shrinks as the model strengthens
  • Pre-Execution Failure Scoring with a Draft Model (Speculative Uncertainty) — A 4B draft model scores a black-box agent's emitted tokens in one forward pass and vetoes actions likely to fail; it cut token cost 14-19% and cut SWE-Bench Verified resolve rate from 49% to 44%, so it buys cost and not quality
  • Evidence-Gated Lifecycle Control for Coding Agents (Proof-or-Stop) — Advance an agent's lifecycle states (reviewed, tested, done, ready-to-merge) only when fresh, source-bound, mechanically verifiable evidence clears the gate — the agent's own assertion never advances the state
  • Non-Compensatory Readiness Gates Before Agent Release — Score release evidence on separate axes (evaluation, context, compliance, governance) and aggregate so a failure on one cannot be averaged away — the blocking rules do the work, not the composite score
  • Staged Evidence Gates for Agentic Program Repair — Order cheap evidence gates ahead of expensive ones in agentic repair loops — retrieval-grounded context, compile gate, target-test gate, then full regression — to filter invalid candidates before paying full-suite cost
  • Execution Budgeting in Agentic Program Repair — Cap test executions in generate-run-revise loops on frontier commercial agents; prohibiting execution drops resolve rate ~1.25 pp on SWE-bench Verified — applies only under specific preconditions on model strength, codebase familiarity, and execution cost
  • Optional Runtime Tool Access for Fault Localization — Provision the probe and the debugger but leave the prompt silent; instructing use multiplied tokens 14.7-27.0x for at most +0.6 accuracy points on short, precisely specified, single-fault programs — and inverts at repository scale
  • Bounded Repair-Loop Iterations — Cap generate-validate-repair loops near three to four rounds; most gains land early and later rounds mostly burn tokens — prefer stop-on-plateau, and watch strong-model late gains, thin-oracle overfitting, and self-critique loops
  • Probing an Agent's Completion Claim in a Disposable Fork — Call the critic at the completion claim rather than during partial progress, and give it execute access to a fork of that state; a transcript-only critic rejected 60% of passing states against 22% for one that could run commands
  • Profiler-Guided Optimization Loops for Coding Agents — Feed the agent a summarized profile and gate every iteration on a behavior-preserving test run; the profiler and the gate only pay off shipped together, and profiler evidence is itself fallible
  • Validity-Estimate Stopping for Noisy Verify-Repair Loops (VRR-Stop) — When the verifier is noisy, its acceptance rate rises while true validity falls as repair damages correct plans — estimate validity from repeated votes and stop on the sign of expected marginal gain, not on acceptance
  • Dual Executable Specifications for Long-Horizon Features — Compile a feature design into an architecture spec (do the required components exist and stay connected) and a behavior spec (does data flow through them correctly) that re-run after every edit — the gain appears only past roughly 3,000-word instructions or 200 agent turns
  • State-Bound Evidence and Typed Revision Contracts for Repair Loops — A repair loop can find a correct patch and then destroy it (0.847 ever-correct against 0.673 submitted); bind every test result to the code state that produced it, preserve the last verified candidate, and admit only typed revision actions
  • Dependency Gap Validation for AI-Generated Code — AI coding agents declare a fraction of the dependencies their code actually needs at runtime — validate in clean environments before trusting the manifest
  • Verify Observability in Agent-Generated Code — Agent-generated systems pass functional tests but expose fault signals for under 14% of failures despite having logging — verify runtime fault-signal coverage with fault injection, not the mere presence of logging
  • Phantom Symbol Detection for LLM API Migration — Verify symbols in LLM-generated migration code against a documentation-derived knowledge base — a deterministic check that catches fabricated imports, constructors, and methods that probabilistic judges miss
  • Generative Provenance Records for Tool-Using Agents — Emit a structured record (tool turn, evidence span, relation) alongside each output sentence so a mechanical verifier can check claim-level grounding before the answer leaves the loop
  • Per-Line Requirement Citations for Hallucination Detection — Cite a requirement ID on every generated line so a set-difference check flags any citation to a requirement absent from the spec as a hallucination — detection at a determinism cost
  • Typed Generation Contracts for Grounded Extraction — Split a wrong grounded answer by context sufficiency first, then make the extraction half checkable with typed fields, verbatim evidence spans, and a validator that runs
  • Semantic Validation for Schema-Valid Agent Output — Schema conformance proves shape and says nothing about values; check identifiers against a register, values against a real bound, and fields against each other, and escalate where no anchor exists
  • Auditing LLM Call Sites Against Their Expected Contract — Across 496 call sites, 82% were checked in code on both sides of the call and 5.3% met their whole contract; triage by where the output goes and stop at the threat chain
  • Post-Failure Evidence Contracts for Tool-Using Agents — Requiring status, evidence, limitation, and next action on the final report tracks pooled false success at 0.8% against 22.8% under a plain request, and forced-choice framing concentrates the baseline error that a neutral request barely shows
  • Defense-in-Depth Against Coding Agent Fabrication (Honesty Harness) — Four uncorrelated layers — instruction-level honesty rules, verify-before-write, real-time hooks that feed output back, and an external-tool fact-checker subagent — that reduce fabrication survival without claiming elimination
  • Layered Oracle Stack for Agent IaC Security Repair (TerraProbe) — Stack scanner-pass, full-scanner, validate, plan, and plan-diff oracles so LLM-generated infrastructure-as-code security fixes have to clear behavioral checks — first-pass agent repairs cleared the targeted Checkov finding 83.3 percent of the time but 71.4 percent of plan-compared repairs were deceptive fixes
  • Explained Feedback for LLM Vulnerability Repair — Pass the raw scanner diagnostic back first; rewriting it into an attack mechanism plus ordered repair steps adds roughly 1 to 1.5 points, and reverses on weak instruction-followers, multi-CWE tasks, and the self-explained variant
  • Classification Before Repair in an Analyzer Backlog — Handing a static-analysis backlog to an agent puts the expensive errors in deciding whether each finding is real, not in the patch; gate the queue on classification and read a falling finding count as fixed-or-silenced
  • Out-of-Query Evidence for Agent-Fixed Code Scanning Alerts — Agentic autofix iterates until CodeQL stops reporting the alert, so the closed alert is the loop's stopping condition; route by weakness class to decide which fixes need evidence the query cannot produce
  • False-Pass Liability Decides the Next Harness Component — Price an erroneous accept before choosing between a planner and a terminal completion check; the ordering flips with that liability, and the check withholds correct work rather than improving it
  • Hash-Pinned Command Approval for Non-Interactive Plugin Installs — Claude Code 2.1.271 accepts the sha256 of a command a previous --json run displayed, binding the approval to the command that was read; the acceptance covers command, plugin and catalog, not what the command produces
  • Behavioral Preflight: Replay Tool-Call Rules Before Enforcing — Replay each tool-call rule over recorded passing runs and flag any that would have refused most of its calls; one flagged rule on a development domain, and a high firing rate alone is not a defect
  • Lock the Transitive CI Dependency Graph — A workflow lockfile records the commit each action and its transitive dependencies resolved to, so a moved tag cannot change what runs; coverage stops at reusable-workflow calls and at anything an action fetches at run time

Tooling