A verification loop sends an agent's work through checks such as tests, type checkers, linters and reviewers, and sends failures back with the reason. The agent fixes and tries again until the checks pass. This pushback is what lets agents run unattended without piling up broken work.
An analogy
A driving school car with a second brake pedal. The learner steers, and each time the car drifts the instructor's foot stops it and says why. Round the block they go until a full lap needs no brake, and only then is the learner allowed out alone.
A verification loop sends an agent's work through checks that push back: the build and type gauges, the tests, and for large changes a comparison with the old system on real traffic. A failure returns to the agent with a message it can act on, and the agent tries again. The sources agree that the check defines what the loop treats as progress, so tests the agent can edit or that cover too little let wrong work through, and the strongest checks cost time.
The bench: a red test, then a patch
A change starts as a test that fails, written before any fix exists, and an agent then cuts the patch that turns it green. The danger sits here: when the same agent edits the code and the tests, green stops meaning right. The sources that trust agent-written code lean on tests that predate the work and that the agent cannot touch.
The red test bench takes the change order and writes the test that fails before any fix exists.
The patch lathe cuts the patch that turns the test green, and may edit the old tests it touches.
more than 100
Weakened assertions Anthropic found when it audited the tests it had ported for its Python-to-Rust migration, as reported by Anthropic Anthropic
2,900 lines
Size of a "compiler" one agent wrote that memorized the visible test inputs in a coding-agent benchmark, as reported by an a16z essay Yoko Li
In red-green test-driven development the developer starts with a failing test, because the feature does not exist yet, and only then works to make it pass. Marlene Mhangami
With an agent, writing the failing test and the code that passes it are both fast, so the speaker would spend the saved time refactoring what the agent wrote. Marlene Mhangami
Tests an AI writes can be self-affirming: the suite is green and coverage passes while the behavior of the system is not checked. Marlene Mhangami
When it breaksTests that changed with the code. Anthropic ported its Messages API from Python to Rust. The integration tests ran the Python API inside the test process and mocked services in Python memory, so the tests had to change along with the code, and Claude helped with both. An audit of the ported tests found more than 100 weakened assertions, so a pass could mean the code was right or that the test had been changed to let wrong code through. Anthropic
The gauge room: build, types and tests
Before anyone reads a patch it goes through checks the agent can run for itself: the build, type and lint errors, then the test suite. A failure goes back to the agent with a message it can act on, so a lap takes seconds and costs nothing. The sources warn that the tests cover only the cases someone thought of.
The build gauge compiles the patch and reads the type and lint errors; a failure goes back with its message.
The test cage runs the suite; a failing test names the case and sends the patch back to the lathe.
about 700
Integration tests Anthropic already had for its Messages API, the first check it used on the Rust port, as reported by Anthropic Anthropic
over a million combinations
Combinations of 20 binary options, about 12 days of tests at a second each for one model, so the suite tests a subset; reported by Anthropic Anthropic
under a second
Time for the local input check to compare the two versions in the agent sandbox, since it never called the model; reported by Anthropic Anthropic
about 98% vs a quarter
Share of its own tests the Rust API passed in April against the share of production inputs that matched, as reported by Anthropic Anthropic
13% of PRs
Share of pull requests on one code-review platform that had at least one required CI failure, as reported by its engineer Gautam Korlam
about 10 minutes to under 1
CI time before and after caching and sharding, for incremental steps once warm, as reported by one team Gautam Korlam
about half
Share of pull requests that passed a coding benchmark grader and that maintainers judged good enough to merge in one study, as reported in a talk Laurie Voss
44% fewer
AI-derived production outages reported by users of multilayered verification compared with others; a vendor claim, not independently checked Tariq Shaukat
Inside one agent turn, verification means checks the agent runs for itself: whether the build works, lint errors, type errors, runtime errors in the preview, and a headless browser to explore the app. Fabian Hedin
A second, outer loop runs between turns, when the agent hands back to the user: how visitors behave, what users report, automatic A/B tests and business metrics such as conversions. Fabian Hedin
Factory's CTO defines agent readiness as how many deterministic validation loops a code base has, such as linters, type checkers, security scans and end-to-end tests; with many of them agents work longer on harder tasks without a person. Eno Reyes
When it breaksGreen at 98%, wrong on three of four inputs. The Rust version of Anthropic's Messages API passed about 98% of its tests in April, yet only about a quarter of inputs matched on production traffic. One cause: Python escapes some characters in JSON tool calls as text codes and Rust wrote them as they were, so prompts differed by a few bytes. In a suite each case counts once; in live traffic one common bug shows up in every request that triggers it. Anthropic
The shadow dock: old and new on the same traffic
The strongest check in the sources runs the old system and the new one on the same live requests and compares every step, so "correct" is whatever the old one did. It is slow, hours or days a lap, so it sits after the fast checks, and what it catches becomes a permanent test. A person still decides whether a matching fix is a good one.
The shadow dock replays the same live requests through old and new code and compares every step.
The live chute sends the matched patch to production while shadowed traffic watches for the fingerprint.
The regression mould turns each caught miss into a test that fails if the versions drift again.
hours or days
How long one lap of the production loop takes, shadowed live traffic, against local checks that take under a second; reported by Anthropic Anthropic
hours or days
Feedback time in the first design, when every hypothesis needed a review and a deployment before the agent saw a signal; reported by Anthropic Anthropic
about $5 a PR
What one team says it costs to run all the checks it wants on each pull request, security scans among them, and judges worth paying for Greg Pstrucha
741% more code, 30% more shipped
Developers who turned on autonomous agents wrote far more code and shipped only a little more software in one study, as cited in a talk Laurie Voss
20 days
Time to merge changes one at a time and keep the main branch green in one very large monorepo before a merge queue was built, as reported by an engineer Gautam Korlam
99.8%
Share of the existing test suite that passed for a million-line Zig-to-Rust port of Bun, the gate for that change, as cited in a talk Laurie Voss
13,044 vs about 74
Unsafe blocks in the ported Rust against a comparable human-written code base of that size, which a suite never designed to look for them cannot certify; as cited in a talk Laurie Voss
Common shadowing tools assume a request can safely run twice and that the service is deterministic; neither held, so Anthropic ran the model once and replayed its output to the Rust version. Anthropic
Checkpointing compared both versions at every step, accept or reject, resolve settings, build the prompt, and the first step that differed showed roughly where the migration code diverged from production. Anthropic
A fingerprint, where a difference began in the prompt and the length gap, told one bug from another, because one bug leaves the same fingerprint on every request it touches; mismatches were grouped by fingerprint to triage. Anthropic
When it breaksThe shortcut that matched. The production API fetched the web search tool's description from an internal service, and the Rust version did not call it yet, so the description was missing from its prompts. An agent copied the text into files Rust could read; the prompts matched and the fix passed the local verifier. An engineer turned it down: Rust would need to call the service before launch, and the workaround would be thrown out. The agent saved a note to memory explaining the decision. Anthropic
Open questionCan a loop's own checks stand in for a person reading the code?
A person has to read what comes out: looping slop together does not stop slop, so someone must check the result is not slop. Dex Horthy
Stop reviewing pull requests one by one, which is the wrong level of abstraction: put human judgment into a review harness of context, rules and evals that the agents run against. Laurie Voss