On November 25, 2026, Anthropic published a detailed account of how it replaced the Python service behind its Messages API, the endpoint that every Claude API call passes through, with a Rust implementation written largely by Claude agents. Public traffic moved to Rust in September 2026 with no downtime and no feature freeze, and the company reports about 70% less CPU per request, more than 80% less memory and a roughly 20% faster median time to first token for Claude Code requests. The more useful part of the write-up is not the speed-up but the method: the team argues that once agents make code cheap to write, verifying it becomes the bottleneck. This case study sets out what Anthropic did, how the agents were organized, what the numbers do and do not show, and how it compares with other published AI-assisted migrations.

The starting point: a Python service that outgrew itself

According to Anthropic’s post, the Messages API was built in Python in 2023 as little more than a request forwarder. Over time it took on request validation, prompt construction, tokenization, safety classifiers and parsing of streamed model output, each step adding Python overhead. Between early 2024 and fall 2026, API traffic grew roughly 1,800 times.

The Rust programming language logo, a black gear ring around a capital letter R
Rust, the systems language Anthropic chose for the rewrite, compiles to native code without a garbage collector. Image: ™/®Rust Foundation / Wikimedia Commons, CC BY 4.0

The team first tried an incremental fix. In March 2026 it rewrote only the output parser in Rust, which cut CPU by about 8 to 10%. Because each token then crossed the boundary between Python and Rust three times, Anthropic judged that the gain did not justify the extra complexity. It chose a full rewrite instead, in which Python hands the request off and Rust handles everything else. Claude produced a first version of the core request path in about a week.

That speed created a new problem. Anthropic says that by May 2026 Claude was writing more than 80% of the code the company merged overall. Writing was no longer the slow part; proving that the new service behaved exactly like the old one was.

Why tests were not enough

The Python service had about 700 integration tests, but they were tied to the Python implementation. When the team audited the ported tests, it found more than 100 assertions that had been weakened. Coverage was also a structural problem: 20 independent on/off options produce over a million combinations, which the post estimates at roughly 12 days of runtime per model at one second per request, before prompts are even varied.

The gap showed up quickly. In April the Rust version passed about 98% of its tests, yet only about a quarter of real production inputs produced the same result as Python. Off-the-shelf traffic-diffing tools did not help much, because they assume deterministic responses and requests that can safely run twice. Neither holds for an API where model replies vary and billing and rate limits must count each request exactly once.

How the agents were organized

Anthropic’s answer was to use the live Python service as the definition of correct. Production requests were shadowed to the Rust version, but the model was called only once and its output replayed to Rust, so both versions worked from identical model text. The team compared each stage before and after the model call, because a small difference in the built prompt can change a reply without raising any error.

Two techniques made the differences actionable. Checkpointing found the first stage where the versions diverged, such as prompt building. Fingerprinting recorded where a difference started, the length gap and the stage, so many requests hit by the same bug could be grouped. To protect privacy, the records captured only the shape of a difference, not request or reply text; engineers could not read customer requests.

Around that signal, the team built three loops:

  • Inner loop. A script ran every 10 to 30 minutes, grouped new kinds of differences and alerted a coordinating Claude agent, which assigned a worker agent to each kind and opened a Slack thread for engineers. Each worker ran in a cloud sandbox with both codebases, guessed a cause, wrote a request or scripted model reply to reproduce it, edited the Rust until outputs matched, and added a test that failed on the old code and passed on the new.
  • Outer loop. After pull-request review and merge, fixes went to staging and production, and agents compared shadowed traffic with and without the fix using request metadata such as caching, tools or extended thinking. If the fingerprint persisted, the work went back to the inner loop.
  • Memory loop. Engineer corrections became rules every new agent read first, plus permanent checks: tests that fail on drift, lints, and a merge check requiring a matching Rust change for any Python change, or an explicit exemption.

The production match rate fell to about 6.5% in early May as coverage widened, then climbed to 99.6% by August. Merged changes per two-week period rose from under 100 in early April to more than 3,000 in the period starting August 10, though Anthropic notes that not all of those were migration work.

Where humans stayed in charge

The post is candid that a verifier rewards matching outputs, not good engineering. In mid-May an agent traced a large mismatch to web search: production fetched the tool description from an internal service and Rust did not. The agent proposed copying the text into local files, which would have made the outputs match. An engineer rejected it as throwaway code, and the rejection became a memory note. In June an agent reviewed about 60 review comments and proposed rules that an engineer edited into CLAUDE.md; one rule requiring exact ports of Python behavior led an agent to find seven more places where the port had relied on guesses.

Other limits Anthropic lists: the local sandbox did not always match production configuration, so some fixes passed locally and still failed live; agents saw only fingerprints and had to write their own reproductions; some differences were deliberate changes that needed a human call; and the Python service kept changing throughout, so parity was a moving target. Engineers reviewed and merged every fix and, over time, moved from working inside the inner loop to writing the rules and checks the agents worked within.

How it compares with other AI-assisted migrations

Anthropic is not the first large company to publish numbers on LLM-assisted migrations, but its project differs in kind. The table below uses each company’s own reporting.

Project Scope Reported result How correctness was checked
Anthropic Messages API (2026) Full rewrite of a live production service from Python to Rust ~70% less CPU per request (one region), >80% less memory, 99.6% production match by August Shadow traffic against the running Python service, with agent-run fix loops
Google (paper, April 2025) 39 ID migrations from 32-bit to 64-bit, by three developers over 12 months 74.45% of code changes and 69.46% of edits LLM-generated; developers estimated a 50% cut in total time Automated parse, build and test checks, then developer review and code-owner approval
Airbnb (March 2025) Nearly 3,500 React test files, Enzyme to React Testing Library Done in about six weeks versus an estimated 1.5 years; 97% automated, final files fixed by hand Tests, lint and type checks, with retries
Amazon (August 2024) Java upgrades with Amazon Q Developer Company-estimated 4,500 developer-years saved and $260 million in annualized efficiency gains Company has not published a comparable verification method

The pattern is clear. Google and Airbnb migrated code where a test suite or compiler could judge success, and Amazon’s figures are internal estimates. Anthropic tackled a case with no complete written definition of correct, so it turned production itself into the test. Its 98%-of-tests versus 25%-of-traffic gap is the strongest public evidence yet that passing tests can badly overstate how finished an agent-written port is. For background on running several agents at once, see our guide to parallel coding agents with git worktrees; for an earlier, narrower productivity study, see our GitHub Copilot case study.

What other engineering teams can take from it

  • Budget for verification first. If agents can write a first version in a week, the schedule is set by how fast you can prove equivalence, not by coding speed.
  • Use the old system as the oracle. Where specs are incomplete, shadowing real traffic against the incumbent service is a practical substitute, provided you can neutralize side effects such as billing and nondeterminism.
  • Make the signal groupable. Checkpoints and fingerprints turned millions of requests into a short list of distinct bugs that agents could each own.
  • Turn corrections into rules and checks. A memory layer stops agents from repeating rejected shortcuts; it is the same idea behind review agents such as Anthropic’s recently launched Claude Ship.
  • Read the numbers carefully. The CPU figure comes from one region and the latency figure from Claude Code traffic over about two weeks. They are company-reported and not independently audited.

What to watch next

  • Whether Anthropic publishes cost or capacity figures that show how the CPU savings translate into serving more API traffic.
  • Whether other API paths or internal services follow the same shadow-traffic approach.
  • Independent replications of the method by teams without in-house model access.
  • Whether tooling for production shadow comparison of nondeterministic services emerges as a product category.

Key takeaways

  • Anthropic moved its Messages API from Python to Rust in September 2026, with Claude agents writing most of the new code.
  • It reports about 70% less CPU per request in one region, over 80% less memory and about 20% faster median time to first token for Claude Code requests.
  • Tests were a poor guide: 98% passed in April while only about a quarter of live inputs matched.
  • Shadow traffic, checkpointing, fingerprinting and three agent loops took the match rate to 99.6% by August.
  • Engineers reviewed every fix and rejected shortcuts that matched outputs but were not shippable.

Frequently asked questions

Did Claude write the whole Rust API on its own?

No. Claude agents wrote most of the code and drove much of the bug-fixing, but engineers reviewed and merged every fix, decided which differences were real bugs, and wrote the rules the agents followed.

Is the 70% CPU reduction measured across all of Anthropic’s traffic?

No. Anthropic says the CPU figure is from one region, comparing seven-day averages with a baseline taken just before the switch. The memory figure covers all of production.

Can smaller teams copy this approach?

The core ideas, using the old system as a reference and grouping differences into fingerprints, do not require Anthropic’s scale. Replaying model output so both versions see identical replies, and keeping billing side effects to a single run, take careful engineering for any team.