Anthropic said on Nov. 25 that it moved its Messages API, the service behind most Claude requests, from Python to Rust, using Claude agents to write and check much of the new code. The company said the Rust version uses about 70% less CPU per request, more than 80% less memory per request, and cuts median time to first token by about 20%. Public traffic moved to Rust in September.
Why Anthropic rewrote it
API traffic grew roughly 1,800 times from early 2024 to fall 2026, Anthropic wrote in an engineering post. The team first rewrote only the reply-parsing code in Rust. That cut CPU use by about 8% to 10%, but each token then crossed between Python and Rust three times, so the team chose a full rewrite.
Claude wrote the first version of the core request path in about a week, the post said. By May 2026, Claude was writing more than 80% of the code Anthropic merged.
The hard part was checking, not writing
Passing tests turned out to be a weak signal. In April, the Rust API passed about 98% of its tests, but only about a quarter of inputs matched on production traffic, Anthropic said. The team had an existing set of about 700 integration tests. A chart in the post shows the match rate falling to 6.5% in early May and ending at 99.6% by August. An audit also found more than 100 weakened assertions in the ported tests.
Testing every option was not practical. Anthropic said 20 binary settings produce over a million combinations, about 12 days of tests at one second each, for a single model.
So the team used the live Python API as the reference. It replayed the same model output through both versions, so the model’s randomness would not create false mismatches. It compared results at each processing step and recorded only the shape of each difference, never request or reply text, to protect user privacy. Each type of difference got a “fingerprint,” and a coordinating agent assigned a worker agent to each new type.
“Verification, not generation, had become the bottleneck,” the authors wrote.
Humans stayed in the loop
The agents worked in three nested loops, according to the post. An inner loop checked fixes locally in under a second without calling the model. An outer loop tested fixes on shadowed production traffic. A memory loop turned human review comments into rules and permanent tests. Human review gated fixes between the inner and outer loops.
In June, an agent reviewed about 60 team review comments and proposed rules, which an engineer approved, Anthropic said. A chart in the post shows merged changes to the Rust codebase rising from under 100 per two-week period in April to about 1,000 by late June, and above 3,000 in the period starting Aug. 10. Anthropic noted that not all of those changes were migration work.
Why it matters
Lower CPU and memory per request mean the same hardware can serve more API traffic, which matters as demand keeps climbing. In our view, the more useful lesson for engineering teams is Anthropic’s own: AI agents can generate a large port quickly, but most of the work went into proving the new system behaved like the old one. The approach it describes, a live reference system plus privacy-safe difference tracking with humans approving fixes, is a pattern other companies attempting large AI-assisted migrations are likely to study.
Sources: Anthropic (Nov. 25, 2026)
Featured image: Rust logo by the Rust Foundation, CC BY 4.0, via Wikimedia Commons