BunCosmos AI Research Lab

27 November 2026 · AI Agents

When AI Writes the Code, How Do We Know It Works?

An AI agent can produce a working draft of a large software project remarkably quickly. Establishing that it behaves correctly can take much longer. Anthropic’s engineering account, published on 25 November, offers a concrete example: Claude helped migrate the company’s Messages API from Python to Rust, producing an initial version of the core request path in about a week. [1]

The broader issue is easy to recognise without knowing either programming language. A replacement system needs to preserve the behaviour people depend on. Looking complete, starting successfully and passing a collection of checks each provide useful evidence, but they answer different questions.

Why software can pass tests and still be wrong

Imagine a simple online shop. A test confirms that adding a £10 item to a basket produces a £10 total. Another confirms that removing it leaves an empty basket. Both pass, yet neither checks what happens when a discount expires during checkout. A customer can still encounter a failure in a system that passed every test its developers wrote.

The example illustrates a basic limitation: a test establishes what happened under the conditions it examined. Its value depends on the behaviour it checks and the situations it covers. A thousand tests concentrated on ordinary purchases could still miss one unusual combination involving a discount, a return and a payment retry.

GitHub described this problem in its 2016 explanation of Scientist, a tool for comparing replacement code with an existing system. Real services accumulate unusual data and behaviours that users come to depend on, including cases that were never fully captured in a specification. A rewrite can look reasonable while changing those behaviours. [2]

What Anthropic found

Anthropic reported a high integration-test pass rate for an early Rust version. That result concerns the tests it ran; the migration team separately examined how closely the implementation matched the existing service.

The team used its existing service as a reference, comparing processing around a single model run and recording the structure of differences without exposing customer text to the debugging agents. Proposed fixes underwent human review. Anthropic ultimately reported about 70 percent lower CPU use per request and a 20 percent reduction in median time to the first token. These are company reported engineering results. [1]

Learning from the system already in use

The general comparison method is often called shadow testing. An established system continues serving users while a candidate implementation processes comparable inputs. Engineers examine differences to discover where behaviour has changed. In GitHub’s Scientist approach, the original code supplies the user facing result while the experiment records how the candidate differs. [2]

Running something twice requires care. If both copies charge a payment, send an email or update a database, the test itself can change the real world. GitHub explicitly cautioned that Scientist was intended for read operations rather than operations with such side effects. Comparison systems therefore need controls over what the candidate can actually do. [2]

A match also has a limited meaning. If the old system contains an error, reproducing it preserves that error. Comparing implementations helps establish consistency; deciding whether a behaviour should be retained or corrected remains a separate engineering judgment. [2]

Giving agents a dependable way to work

Verification is also connected to how an agent’s work is organised. In an earlier engineering report from November 2025, Anthropic described agents attempting too much at once, leaving incomplete work between sessions or declaring a project finished before every feature worked. Its approach used explicit feature requirements, incremental changes and written progress records that later sessions could consult. [3]

For web applications, the company also found value in asking agents to test through a browser, following the steps a user would take. A program can return a successful response while a person still cannot complete the intended action. Testing the whole interaction helps expose that gap, although the testing tools have limitations of their own. [3]

These practices give an agent evidence it can act on. A clear requirement describes the intended outcome. A reproducible failure identifies a problem. A new check can show whether a proposed change resolves it. Records of completed work allow the next session to continue from a known state. [3]

What a successful check actually establishes

Different checks support different conclusions. Rust’s ownership rules, for example, are checked by the compiler and help govern memory use. They cannot establish that a shop calculated a customer’s discount correctly. That requires evidence about the application’s intended behaviour. [4]

For anyone assessing an agent built system, the practical question is what evidence accompanies the result. Which user actions were exercised? Which unusual conditions were examined? Can a reported failure be reproduced? Keeping those questions visible makes it easier to judge what has been demonstrated and what still needs investigation.

Sources

[1] Anthropic, 25 November 2026. Migrating our Messages API to Rust.

[2] Jesse Toth, GitHub, 3 February 2016. Scientist: Measure Twice, Cut Once.

[3] Anthropic, 26 November 2025. Effective harnesses for long-running agents.

[4] The Rust Programming Language. What Is Ownership?

BunCosmos AI Research LabBack to top ↑