Anthropic Moved Its Messages API From Python to Rust — CPU Down ~70%
November 26, 2026 · 5 min read
Anthropic published an engineering retrospective on November 25: with Claude's help, the company migrated its Messages API from Python to Rust, cutting per-request CPU consumption by about 70%. The team produced a first version of the core request path within a week, and validated the agent-written changes with production parity checks. For Anthropic, the migration is also a public demonstration: the tool it sells to developers rewrote the code that serves those same developers. It is a neat piece of symmetry — an AI company used its own AI to rewrite the infrastructure that serves its AI — and the savings are large enough to matter.
The Messages API is not a side project; it is the front door to Claude. Every request a developer sends passes through it, which means a 70% CPU reduction lands directly on the cost of serving every customer. That is why the story is worth more than a language-war talking point. Python is fast to write and slow to run; Rust is the opposite. For a high-throughput API, the trade is obvious in hindsight — the interesting part is that the migration itself was done with an AI coding agent, and done quickly, with checks that compared the new code's behavior against production traffic.
A week to the first version
The timeline is the part that would have sounded implausible two years ago. A core request path rewritten in a new language, in a week, by a team working with an agent. Migrations like this used to be quarter-long projects: the new code had to be written, then reviewed line by line, then tested against every edge case the old code had accumulated. The agent did the bulk of the writing; the humans did the verifying. That division of labor is the real story — the agent is fast at producing code, and the humans are still responsible for proving it correct.
Production parity checks are the whole game
The detail that separates this from a demo is the validation method. Anthropic checked the Rust code against production behavior — the same requests, the same responses, compared at scale. That is the only kind of test that matters for a migration: unit tests prove the code does what you think; parity checks prove it does what the old code did, including the behaviors nobody documented. It is also the part that is hardest to automate, because it requires a harness that can run both versions side by side and compare. The lesson for other teams is not "rewrite in Rust" but "build the parity check first, then let the agent do the rewrite."
The bill is the argument
A 70% CPU cut is not a style preference; it is money. At the scale of a frontier-model API, compute is the largest cost, and a migration that removes two-thirds of the CPU from the hottest path pays for itself quickly. That is the calculation that will push other companies to do the same: not because Rust is fashionable, but because the savings are measurable and the agent makes the migration cheap enough to attempt. Expect a wave of similar announcements — "we rewrote X with an agent and saved Y%" — and expect the honest ones to include the parity-check story too. The announcement reads as a case study aimed squarely at engineering leaders weighing the same decision.
What to watch next
Three things. First, whether Anthropic publishes more detail — the failure modes, the places where the agent's code needed human fixes. Second, whether other API providers follow with their own agent-assisted rewrites, and what they save. And third, whether the pattern spreads beyond infrastructure: if an agent can rewrite the API that serves the model, the next question is which parts of the stack are still off-limits to agent-written code — and for how long.