Anthropic's engineering team has published a retrospective saying the Messages API has been migrated wholesale from Python to Rust, and that all public traffic has run on the new implementation since September. According to the company's figures, CPU use per request fell by about 70%, and per-request memory dropped by more than 80% between August and October. For requests from Claude Code customers, median time to first token was cut by about 20% over an observation window running from September 7 to September 21.
The Messages API is Anthropic's main public interface, and the company's own applications, including Claude Code and Cowork, also run through it. It was written in Python in 2023, and traffic has grown roughly 1,800-fold from early 2024 to autumn 2026. Every request requires parameter validation, prompt assembly, tokenization and a pass through safety classifiers; on the way back, tokens have to be split into text, thinking and tool calls, streamed to the client, and metered for billing. At scale, Python's overhead at each of those steps became too much to absorb.
A partial rewrite came first
Engineers proposed moving to Go or Rust as early as 2024, but the team decided against a rewrite at the time. In March this year it tried a compromise: only the output parser was moved to Rust, called from Python. That saved 8% to 10% of CPU, but each token had to cross between Python and Rust three times. The team judged that the gain did not justify the added complexity and decided to migrate the whole service.
Using production as the examiner
The roughly 700 existing integration tests were too tightly coupled to the Python implementation. When the team audited the tests that had been ported over, it found more than 100 assertions that had been loosened. Coverage was also insufficient: 20 binary switches combine into more than a million cases, which at one case per second would take 12 days for a single model.
The team's approach was to treat the live Python version as the answer key. Production requests were mirrored to the Rust version, with the model called only once and its output replayed to both sides, to avoid double billing and rate-limit consumption. Because model replies are non-deterministic, comparing final text would be meaningless, so the comparison was made on intermediate results at each stage before and after the model call. For privacy reasons, engineers did not read users' requests or replies; they recorded only the "shape" of each difference: the first stage at which the two diverged, the length gap, and the first differing byte. Differences were then grouped into fingerprints by those features, with one bug corresponding to one fingerprint.
The problems this comparison caught were subtle. In JSON tool calls, Python escaped emoji while Rust emitted them as-is. One place read the 1-million-token context limit as 200,000. In another case, the prompt assembled by Rust omitted the description of the web search tool, yet the request still succeeded without raising any error. For that last issue, the agent proposed a shortcut that would make the outputs "match"; engineers rejected it, and the correct fix, which was to have Rust call the internal service that supplies tool descriptions, took several weeks.
"Verification, not generation, had become the bottleneck."
The write-up says Claude produced the first version of the core request path in about a week. By May, more than 80% of merged code came from Claude; since August 10, more than 3,000 changes have been merged every two weeks.
Set beside two other large migrations
There have already been several public cases this year of AI-driven large-scale language migrations. GitHub used Copilot to rewrite its own runtime as roughly 830,000 lines of Rust, and Opus 5.5 was used to move the TypeScript compiler to Rust in two weeks. Both targets were relatively self-contained codebases that could be backstopped by existing test suites.
Anthropic's target this time was a live service that was being changed as it was migrated and that handles huge volumes of real requests every day, with the Python version still gaining features during the migration. Comparing the three cases, the speed of writing code differs little; the difference lies in how verification is done: where tests can cover a scenario, tests are used, and where they cannot, the only option is to check answers against production traffic and have people judge whether a fix is safe to ship. The retrospective does not disclose how many engineers the migration took or how much compute it consumed in total.
Sources: Anthropic engineering blog, CocoLoop; the reductions in CPU, memory and time to first token follow the basis of the official charts, and the time-to-first-token figure covers only requests from Claude Code customers.