Key points
- The Messages API was built in Python in 2023; traffic through it grew about 1,800× from early 2024 to autumn 2026, making Python’s per-request cost a problem.
- Results after the move to Rust: CPU per request down about 70% (measured in one region), memory per request down more than 80% (whole system), median time to first token down about 20% (Claude Code requests, shorter window).
- Fixing it piecemeal was not enough: rewriting the model-output parser in Rust and calling it from Python only cut CPU by 8–10%, while each token had to cross the two-language boundary 3 times — so the team dropped that approach.
- The hard problem was not writing code but proving the Rust version matched the Python one: the 700 existing integration tests were not enough — an audit found more than 100 assertions weakened when the tests were ported; in April the Rust version passed about 98% of tests but only about a quarter of inputs from real traffic matched the Python version.
- The method: use the live Python API itself as the “oracle” — run the model once, then replay its output through both versions, compare step by step (checkpointing) and group errors by “fingerprint”; Claude agents ran in three nested loops (inner, outer, memory), with humans reviewing at the loop seams.
- By May 2026, Claude had written more than 80% of the code Anthropic merged. The lesson the company draws: “verification is the new bottleneck” — writing code is no longer the bottleneck, verification is.
Why was verification so hard? A live system has countless “implicit” behaviours that no test records: users rely on edge cases and odd habits of the old system that no documentation mentions. A telling example: when Python writes a JSON tool call, it escapes emoji characters into text codes; Rust writes the characters directly — two prompts differing by a few bytes, the model still answers normally, with no error, but the answer may differ. Only by comparing step by step, before and after the model call, on real traffic, could the team catch discrepancies like this. To do that without reading customers’ request content (for privacy), they recorded only the “shape” of each difference — at which step it happened, by how much — then handed it to an agent to guess the cause and fix it.
The memory loop is the most interesting part of the project. When an engineer rejects an agent’s proposal — for example, the agent wanted to “patch” a problem by copying a search tool’s description into a file instead of making Rust call the right service for that description — the agent records the decision, the reason and the correct fix in shared memory. Later agents hitting the same error read the note and recognise at once that this is a known mistake, instead of proposing the old shortcut again. By June, one agent had even grouped 60 of the engineers’ review comments into general rules, which the engineers approved and put into CLAUDE.md. Anthropic likens the whole process to rebuilding the Ship of Theseus: replacing planks while the ship is still sailing used to be risky; now Claude lets you build an identical ship alongside — even while the old ship is still being repaired — then move passengers across in batches once you trust the two ships sail the same.

Why it matters
This is one of the rare, detailed case studies of using AI to rewrite a live system serving millions of users — and the biggest lesson is not “AI writes code fast” but “verification is the new bottleneck”. Anthropic’s approach — using the live system itself as the referee, comparing step by step, recording each error’s “fingerprint” — can be applied to many other migration projects, and it shows the human role shifting: from writing code to defining what “correct” means and reviewing the judgements that automated checks cannot answer.
