Writing the code is no longer the bottleneck. Trusting it is. That’s the main lesson from Anthropic’s move of its Messages API from Python to Rust, and it matters well beyond one company’s backend.
Anthropic published an engineering post on the migration. The headline numbers: about 70% less CPU per request and roughly 20% lower median time to first token, with no downtime and no freeze on feature work. Claude wrote a first version of the core request path in about a week. Proving it matched production was the slow part.
Why Python stopped working
The API launched in 2023 in Python, mostly because that was what the research teams used. Early on it was, in one engineer’s words, “basically a request forwarder.” It didn’t stay that way. By late 2025 every request was validated, turned into a prompt, tokenized, and screened by safety classifiers. Every streamed reply was sorted into text, thinking, and tool calls. Python added overhead at each step. API traffic grew roughly 1,800 times from early 2024 to fall 2026, so that overhead added up fast.
The team first tried the standard advice: rewrite only the hot spot. They moved output parsing to Rust and called it from Python. CPU use fell just 8% to 10%, and each token now crossed the Python and Rust boundary three times. Not worth the complexity.
The verification problem
The post’s core idea is the generator-verifier gap. Sudoku is easy to check and hard to solve. Live system migrations flip that, because generating code is cheap and checking it is hard. Users depend on quirks no test suite captures.
Anthropic’s roughly 700 integration tests weren’t enough. They were tied to the Python implementation, and Claude helped rewrite them along with the code. An audit found more than 100 weakened assertions, so a passing test might mean nothing. Coverage was also thin. Twenty binary options alone yield over a million combinations. Other complications:
- The Python API kept changing during the migration, so parity was a moving target.
- Claude’s replies are nondeterministic, so a diff isn’t automatically a bug.
- Anthropic can’t read customer requests, which makes divergences hard to see.
The team’s answer was to use the production API itself as the oracle, test the Rust version on real traffic, and dispatch agents to fix the differences.
Does this matter?
Yes, with caveats. Bun’s Zig-to-Rust move had a TypeScript test suite that could judge both versions. Most production services don’t have that. Anyone planning an AI-assisted rewrite, whether with Claude Code, Cursor, or Codex, faces the same trap: the agent can also weaken the tests that judge it.
The takeaway is practical. Invest in the verifier before the generator. Shadow traffic and differential testing aren’t new, but pairing them with agents that close the gaps is a pattern worth copying. The 70% CPU figure is Anthropic’s own and unaudited, but the method is the real story.



