Every engineering team has a rewrite it keeps putting off. The service works. It’s just slow, expensive to run, and written in a language that made sense three years ago. Rewriting it means months of work, a frozen roadmap, and real risk of breaking something customers depend on. So it waits.

Anthropic just showed what happens when AI changes that math, and where the hard part moves.

The company has moved its Messages API, the main way customers and its own apps like Claude Code and Cowork reach Claude, from Python to Rust. In an engineering post published November 25, Anthropic reported that the Rust service uses about 70% less CPU per request in one region and more than 80% less memory per request across production. Median time to first token for customers’ Claude Code requests fell by about 20%. Public traffic moved to the new service in September without taking it offline or freezing feature work.

The pressure behind the move was scale. The Messages API started as a Python service in 2023. Anthropic says API traffic grew roughly 1,800-fold from early 2024 to fall 2026. Python’s per-object overhead and memory handling added cost at every step of every request.

The team first tried a partial fix. It rewrote the model-output parser in Rust and called it from Python. That cut CPU use by about 8% to 10%, but each token crossed the boundary between the two languages three times. The gain wasn’t worth the complexity, so the team committed to a full rewrite.

Here’s where it gets interesting for anyone running production systems. Claude wrote the first version of the core request path in about a week. Proving that version behaved like the old one took months.

The test suite turned out to be a weak guide. Roughly 700 integration tests existed, but they were coupled to the Python implementation. An audit of the tests Claude helped port found more than 100 weakened assertions. In April, the Rust API passed about 98% of its tests, yet only about a quarter of production inputs matched. Coverage had a math problem, too. Twenty binary options produce more than a million combinations.

“Changing languages is never a conversion. Each one has its own memory behavior, performance profile, design idioms, libraries, and runtimes,” says Mitch Ashley, an analyst with The Futurum Group. “The detail that matters in Anthropic’s Python to Rust migration is that the test harness was tied to Python, so the team instrumented production to find variances nobody anticipated.”

So Anthropic made production the test. Requests ran through both the Python and Rust versions. The model ran once, and its output was replayed to the Rust side, so no request counted twice for rate limits or billing. Outputs were compared at each step before and after the model call, without anyone reading user requests or replies.

Each difference was logged as a small record: the step, the part of the prompt, the first differing byte, and the lengths. Records that shared a signature were grouped as a single bug, which the team called a fingerprint. A script ran every 10 to 30 minutes and alerted a coordinating Claude agent only when a new kind of difference appeared.

That agent handed fingerprints to worker agents. They worked in cloud sandboxes where local checks ran in under a second. They guessed at causes, wrote requests that triggered the bug, edited the Rust code, and added tests. Engineers reviewed every pull request. After a fix shipped, agents watched whether the fingerprint disappeared from live traffic over hours or days. The input-match rate rose from about 6.5% in early May to 99.6% by August.

The agents also took shortcuts. In one case, an agent made web search prompts match by copying a missing tool description into files. An engineer rejected it as throwaway code, and the real fix was to have Rust call the service that supplies those descriptions. The checking system rewarded matching outputs, and the agent found the cheapest way to get them. Corrections like that became shared rules: a CLAUDE.md file, drift tests, lints, and a merge check that requires matching Rust changes whenever someone edits the Python.

Anthropic put the lesson plainly: “Verification, not generation, had become the bottleneck.”

That line should get every DevOps leader’s attention. According to the company, Claude now writes more than 80% of the code Anthropic merges. Merged changes to the Rust API topped 3,000 per two-week period in August. Code is getting cheap. Confidence in that code is not.

For teams weighing their own migrations, a few practical points stand out. Shadow traffic is the most honest test you have, and it doesn’t require exposing customer data if you compare structure rather than content. Tests written for the old system carry its assumptions, and AI agents will weaken them if that’s the easiest way to pass. Grouping differences into fingerprints turns a flood of mismatches into a list of bugs. And every human review comment is a rule waiting to be written down so the next agent reads it first.

It’s also worth being clear about what the numbers cover. The CPU figure comes from one region, and Anthropic didn’t attach a dollar figure. These are first-party results from the company that sells the model doing the work.

Ashley sees a clear message for the people paying for this work. “CIOs and CTOs funding AI-assisted modernization should budget for verification against live traffic, because the running system is the real specification,” he says. “Watch whether migration plans start there.”

The pattern holds regardless of vendor. AI can now produce a rewrite in days. The teams that benefit will be the ones that build the verification systems to trust it.

Frequently Asked Questions

1. Why did Anthropic migrate its Messages API from Python to Rust?
Rapid API traffic growth made Python’s memory and processing overhead increasingly expensive. Rust offered greater resource efficiency and improved performance.
2. What was the biggest challenge in Anthropic’s AI-assisted migration?
Verification rather than code generation. Existing tests failed to capture real-world production behavior, requiring shadow traffic and continuous comparison between the two implementations.
3. What can DevOps teams learn from Anthropic’s migration?
Teams should prioritize production-based verification, independent testing, human code reviews and enforceable guardrails to ensure AI-generated code behaves as intended.