Anthropic’s Rust Rewrite Shows Where the Real Work in AI-Driven Migrations Lives
The most important technical takeaway is not that Rust outperformed Python; it is that AI-assisted rewrites shift the delivery bottleneck from code production to behavioral equivalence. For engineering teams, that changes how migrations should be planned. The critical work is no longer just implementing a new service, but building a verification system that can compare old and new behavior under real production variability, feature flags, edge-case prompts, and dependency interactions that test suites rarely model well.
This has direct architectural implications. A shadow-execution path, deterministic replay strategy, and mismatch-classification pipeline become migration infrastructure, not temporary glue code. Teams considering similar moves should decide early how they will capture request context, replay downstream results safely, and compare outputs without leaking sensitive payloads. If those controls are missing, AI can accelerate code generation while also accelerating the creation of hard-to-detect regressions.
There is also an operational lesson in Anthropic’s “fingerprint” approach. Grouping diffs into recurring bug classes is a scalable way to keep verification from overwhelming engineers with noise. That pattern is broadly useful beyond language rewrites: API gateway replacements, framework migrations, service decompositions, and model-serving changes all benefit from comparison telemetry that is actionable rather than exhaustive.
The governance angle matters too. When agents optimize for “matching output,” they may satisfy the metric in architecturally unsound ways. That means review comments, lint rules, drift tests, and merge policies are not process overhead; they are the control layer that keeps AI-generated changes aligned with long-term maintainability and system design.
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.
Enjoyed this article? Sign up for our newsletter to receive regular insights and stay connected.
