Anthropic moved Claude's API to Rust using Claude agents, cutting CPU per request by about 70%
The hard part was proving the new version matched the old one, and an engineer still turned down an agent's shortcut that had passed the local check.
On November 25, 2026, Anthropic published an engineering post on how it moved its Messages API from Python to Rust. That API is how customers reach Claude, and Anthropic's own apps, Claude Code among them, go through it too.
Claude wrote the first version of the new request path in about a week. Teams of Claude agents then hunted down the places where it behaved differently from the old one, and public traffic moved over in September 2026 without the service going offline.
- What moved
- Messages API, from Python to Rust
- First version
- Claude, in about a week
- CPU per request
- about 70% less
- Time to first token
- about 20% lower
- Public traffic moved
- September 2026
Why rewrite it at all?
Traffic, mostly. Anthropic says API traffic grew roughly 1,800 times between early 2024 and fall 2026, and Python added overhead at every step of a request: validating it, building the prompt, screening it with safety classifiers and sorting the reply into text, thinking and tool calls.
The team tried the cautious route first. It rewrote only the code that parses a model's output and called that from Python, which cut CPU use by about 8% to 10%. Each token then crossed between the two languages three times, and the gain didn't justify the mess. (Back in 2024, one engineer had shut down the idea of a full rewrite in Go or Rust outright.)
Claude changed the math. By May 2026, the post says, Claude was writing more than 80% of the code Anthropic merged, so producing a whole new API stopped being the expensive part.
Verification, not generation, had become the bottleneck.
How do you check a rewrite of a live system?
The existing tests weren't enough. Anthropic had about 700 integration tests, but they were tied to the Python code and had to be ported along with it, with Claude helping on both. When the team audited the ported tests, it found more than 100 weakened assertions. Twenty on-off options alone make over a million combinations, so no suite covers everything.
In April the Rust version passed about 98% of its tests. On real traffic, only about a quarter of inputs matched.
So the team used the live Python service as the reference. The model ran once per request and its reply was replayed to both versions, which meant Claude's varying answers to the same prompt didn't show up as bugs and nobody was billed twice.
Engineers couldn't read customer requests, so the system logged only the shape of each difference: the step where it appeared, where in the prompt the two versions split and by how many bytes. A script grouped those records every 10 to 30 minutes and passed each new kind to a coordinating Claude agent, which assigned a worker agent to fix it.
Each agent ran in a cloud sandbox with both codebases and fast, local checks for what happens before and after the model call.
Where a person stepped in
Agents could test guesses on their own in seconds, but no fix reached production without an engineer reviewing the pull request. The post describes one case where that mattered. In mid-May the Rust version was missing the web search tool's description, which Python fetched from an internal service. An agent copied the text into files Rust could read, the prompts matched and the local check passed.
An engineer rejected it. Rust would still have to call that service before launch, and the copy would be thrown out.
A verifier can tell an agent whether the outputs matched, but not whether the fix is good enough to ship.
The agent saved a note on that decision. Later agents that hit the same bug at other spots in the prompt linked their records to the note instead of writing another workaround, and engineers' corrections ended up as rules in the team's CLAUDE.md, along with new tests and lints.
Katelyn Lesse, who works on the API at Anthropic, posted two minutes after the company did.
this migration was the coolest thing ive ever seen an engineering team pull off. our api serves all of claude’s tokens, across our api customers and our own apps. and its nondeterministic! imagine swapping out a massively scaling distributed system, racing the clock to avoid infra falling over, proving correctness through nondeterminism, while it keeps serving all of claude … without anybody noticing?! new things are possible, and it takes damn good engineering brains to make them happen. im so insanely proud of the team for pulling this off, and im excited for the community to learn from the journey
What it means for people who write software
I read this as a story about where the engineering job moves. Over the project, Anthropic says, its engineers went from chasing differences themselves to reviewing fixes in Slack, and finally to writing the rules and checks the agents worked inside.
That lines up with what Anthropic heard from other employers in its interviews about working with AI. People at two-thirds of the companies it spoke to said AI had reduced their hiring, mostly hiring they'd otherwise have needed in order to grow. One engineering leader described adding capacity "by buying tokens instead of hiring people."
The Rust post gives no headcount for the migration team, and it doesn't say whether that team grew or shrank. Its web search episode shows the review step earning its place: the shortcut that satisfied the automated check was stopped by a person.
Public traffic has run on the Rust version since September 2026, which Anthropic says uses about 70% less CPU per request than the Python one did.
More on Anthropic
- Dario Amodei calls it absurd to say he'd surrender human free will to AINovember 25, 2026
- Anthropic's Siren test finds newer Claude agents rarely misuse what they find outside their sandboxNovember 25, 2026
- Anthropic study of 58 companies finds few AI layoffs, but two-thirds are hiring lessNovember 24, 2026
- Anthropic's Claude Ship lets Claude approve routine pull requests when a team's policy allowsNovember 23, 2026