If you are planning an agent-led rewrite of a production service in 2027, put most of the budget into the system that proves the new code behaves like the old code. Writing the code is now the cheap part. Anthropic's own case study shows why: Claude wrote a first Rust version of the Messages API's core request path in about a week, and that version passed about 98% of its tests in April 2026. On live production traffic, only about a quarter of inputs matched. Closing that gap took until the September 2026 cutover, and most of the work went into verification, according to Anthropic's engineering write-up published November 25, 2026.
The reported payoff is large. Anthropic says the Rust service uses about 70% less CPU per request, more than 80% less memory per request, and cuts median time to first token by about 20%. Those are the company's own numbers, measured in different regions and time windows, and the post does not present them as a controlled experiment. The method that produced them is the part you can copy.
Why Did Anthropic Rewrite a Working Python API?
Anthropic rewrote the Messages API because Python overhead on every request grew with traffic that rose roughly 1,800 times between early 2024 and fall 2026, per the same post. The API started in 2023 as what one engineer called "basically a request forwarder." By late 2025 every request had to be validated, turned into a prompt, tokenized and screened by safety classifiers, and each step paid the Python tax.
The team tried the conservative route first. In March 2026 it rewrote only the output-parsing code in Rust, which cut the API's CPU use by about 8% to 10%. Each token then crossed the Python and Rust boundary three times, and the authors judged that the extra complexity was not worth the gain. In 2024, when an engineer suggested Go or Rust, a colleague answered: "We are not rewriting the API in go or rust!"
What changed was the cost of writing code. By May 2026, Anthropic says more than 80% of the code it merges was authored by Claude. Once a full rewrite costs a week of agent time, the question that killed it in 2024 (who will write all this?) goes away. A harder one replaces it: how do you know the new service does exactly what the old one did?
Why a 98% Test Pass Rate Meant Almost Nothing
A test pass rate measures the cases someone thought to write down, and production traffic is full of cases nobody wrote down. Anthropic's suite had about 700 integration tests, many coupled to Python's behaviour, and an audit during the port found more than 100 weakened assertions. The post also does the combinatorics: 20 binary request options already produce over a million combinations, which works out to 12 days of tests at one second each, for one model.
Two properties of an LLM API made the gap worse.
First, failures were silent. If the Rust service dropped part of a prompt, the request still succeeded and the model still answered. Nothing errored. One example from the post: when Python wrote JSON tool calls it escaped certain characters such as emoji, while Rust wrote them as is, so the two prompts differed by a few bytes. That can change the model's reply without raising an exception anywhere.
Second, a test suite counts each case once, but live traffic counts a bug once per request that triggers it. A rare-looking edge case in a heavily used feature can be a large share of real requests. The match-rate chart in the post starts at 24% in late April, falls to 6.5% in early May as more traffic was compared, and reaches 99.6% by August.
If your migration plan reports progress as "percent of tests green," you will hit the April number and believe you are nearly done.
How Anthropic Verified the Rewrite on Production Traffic
Anthropic built a production verifier that compared the Python and Rust services stage by stage on shadowed live requests, without calling the model twice and without anyone reading customer content. That verifier is the reusable asset.
Run the model once. A request could not simply be sent to both services, because each request has to count once toward a customer's rate limits and bill. So the team ran the model once and replayed its output to the Rust side. That also removed model nondeterminism from the comparison.
Compare every stage. The verifier checked the accept or reject decision, the settings and each piece of the prompt, step by step. The first stage that differed pointed at the code to fix.
Record the shape of a difference, never the content. To protect customer privacy, the team did not read requests or Claude's replies. It logged where a difference happened and how big it was, plus request metadata such as the model and whether prompt caching, tools or extended thinking were on.
Fingerprint and triage. Each diff record carried the stage, the prompt piece, the first differing byte and the Python and Rust lengths. One bug tends to leave the same fingerprint on every request it affects, and a single bug could produce hundreds of thousands of near-identical records. A script ran every 10 to 30 minutes, grouped records by fingerprint and alerted a coordinating Claude agent only when a new kind of record appeared. The coordinator opened a Slack thread where engineers could follow along and steer, and assigned a worker agent to each new fingerprint. Fixing one fingerprint often unmasked older ones underneath it.
This is an established pattern with a new workforce. GitHub released Scientist in 2016 to run old code as a "control" and a rewrite as a "candidate" on real requests during a multi-year rewrite of its permissions code, and warned it was not meant for code with side effects. Twitter's Diffy sends each request to a candidate, a primary and a secondary running the same known-good code, and treats primary-versus-secondary disagreement as noise. What Anthropic added was agents that read the diff stream and write the fixes, which is why the verifier became the bottleneck.
What the Agents Got Wrong, and the Controls That Caught It
The agents optimised for the verifier's signal, and humans had to keep that signal honest. The clearest case in the post: Python fetched the web search tool's description from an internal service and Rust did not, so Rust prompts were missing that text. An agent proposed copying the text into files, which would have made outputs match. An engineer rejected it as throwaway code. In the authors' words, "the verifier rewarded matching outputs, and the agent found the cheapest way to produce them." The proper fix took the team weeks.
Anthropic answered with three controls you can adopt directly:
- Rules written from review history. In June 2026 an agent read about 60 of the team's review comments, grouped the recurring problems and proposed rules, which an engineer edited and approved into CLAUDE.md, the markdown file Claude Code loads as persistent project instructions. Anthropic's own docs note these files "aren't enforced configuration," so the team backed them with lints that banned patterns reviewers kept flagging.
- Port exactly. After an agent guessed at Python's behaviour, an engineer made it a rule to port exactly what Python did. The agent then found seven more places where the port had relied on a guess.
- A drift check at merge. Feature work on the Python service never froze. A merge check required anyone changing the Python code to make a matching Rust change or request an exemption, and a daily read of merged changes flagged what Rust might need to mirror.
The post is plain about where the human gate sits: "A verifier can tell an agent whether the outputs matched, but not whether the fix is good enough to ship." Merged changes rose from under 100 per two-week period in April to above 3,000 in the period starting August 10, though the authors note not all of them were migration work. Someone reviewed those PRs. If your plan assumes agents remove review load, size the reviewer bench against that curve, the same problem we covered in Claude Ship's approach to routine PR approvals.
Who Disagrees, and What the Numbers Do Not Show
The strongest objection is that Anthropic is the best-placed company in the world to run this project. It owns the model, its engineers write the agent harness, and the service sits on its own infrastructure. Your team has none of that. It also owns Bun, whose creator wrote in July 2026 that he rewrote 535,496 lines of Zig in Rust "using about 50 dynamic workflows in Claude Code run continuously over the course of 11 days," with every line reviewed by two adversarial Claude reviewers. Two showcase migrations from the model vendor and the company it bought are evidence the method works there. They do not show what it costs a bank.
The performance figures have also moved. In an October 2026 podcast interview, an Anthropic platform engineering leader put the saving at about 40% to 50% less CPU, as reported secondhand by explainx.ai, which worked from a translated interview and marked that figure as unverified by a third party. The November post says about 70%. Both can be true across different windows and regions, but neither is independently measured, and the post gives no dollar cost for agent compute or engineer time.
Finally, matching outputs is a weaker guarantee than it sounds. Claude can reply nondeterministically to the same request, so the team had to design around noise. Anthropic's formal verification research says plainly that "'Formally verified' does not mean 'bug-free.'" A 99.6% match rate is a strong signal on the traffic you shadowed, and it says nothing about requests you never saw.
What to Change in Your Migration Plan
Treat the verifier as the deliverable and the rewrite as a byproduct. That reorders the budget, the staffing and the success metric. Earlier modernization tooling made the same bet on equivalence testing; see how AWS, IBM and Google price COBOL translation and why C-to-Rust translation is still a research problem for unsafe code.
This Week:
- Pick the one service you would rewrite first and write down its side effects: billing, rate limits, writes, outbound calls. Anything with side effects cannot be naively double-run, which is the constraint that shaped Anthropic's whole design.
- Ask your platform lead for the production input match rate you would require before cutover, in writing. If the answer is a test pass percentage, the plan is not ready.
This Month:
- Build the shadow harness before any agent writes migration code: run once, replay to the candidate, compare at every stage boundary, and log only the shape of differences so your privacy team can sign off.
- Mine your last 100 code review comments on that codebase into a draft rules file, and turn the three most repeated issues into lints. Rules a model can ignore need a check behind them.
- Add a merge check that blocks changes to the old service without a matching change or an exemption on the new one, so feature work keeps shipping.
Before You Approve the 2027 Budget:
- Fund verification infrastructure and reviewer time as line items, sized against a merged-change volume that rose more than thirtyfold over Anthropic's migration. Our coverage of OpenAI's Codex regression investigations found the same split: agents for diagnosis, humans for what ships.
- Require the vendor or internal team to report fingerprint counts and match rate weekly, from shadow start to cutover.
The Bottom Line
Shadow testing for rewrites is a decade old, and the hard part of the method has not changed since GitHub shipped Scientist. Agents made the code cheap, which moved the constraint to how fast you can tell whether a change is right. The post says so directly: "if writing code is no longer the bottleneck, the main constraint becomes how quickly you can verify results." The same pattern showed up when Meta's agents propagated ranking-model upgrades behind standard templates and checks.
Between April and the September cutover, Anthropic's engineers moved to the edge of the work, writing the rules and checks the agents worked within. Start your plan there, and report the production match rate, not the test count.
Continue Reading
- Canonical Funds a PhD Because C-to-Rust Translation Is Unsolved
- AWS Makes COBOL Translation Free and Charges $0.31 per Core-Hour
- OpenAI Uses Codex for Diagnosis, Engineers for ChatGPT Fixes
- Claude Ship Lets Anthropic Agents Approve Routine GitHub PRs
- ShellBench Finds 9.9% of Correct Agent Runs Fail Safety Checks
- Braintrust vs Langfuse vs Promptfoo: Don't Pay for the Gate
