Anthropic has moved its Messages API from Python to Rust, and teams of Claude agents did most of the work. The company described the project on its engineering blog on November 25, 2026. The new API uses about 70% less CPU per request and cuts median time to first token by about 20%.
The Messages API is the main way customers reach Claude. Anthropic's own apps, including Claude Code and Cowork, run on it too. Public traffic moved to the Rust version in September, without taking the service offline or pausing new features.
Why Anthropic rewrote the Messages API in Rust
Anthropic built the Messages API in 2023 in Python, the language of most of its research code. At first it simply passed requests to the model and sent replies back. Over time, every request also had to be validated, turned into a prompt, tokenized and screened by safety classifiers.
Python added overhead at each of those steps, and traffic kept growing. Between early 2024 and fall 2026, API traffic grew roughly 1,800 times. Rust promised far less CPU per request.
The team first tried the usual advice and rewrote only the slow part. A Rust parser for model output, called from Python, cut CPU use by 8% to 10%. But each token now crossed between Python and Rust three times, and the gains did not justify the extra complexity.
A full rewrite had looked impossible a few years earlier. By May 2026, though, Claude was writing more than 80% of the code Anthropic merged. Claude produced a first version of the core request path in about a week. Writing the code was no longer the hard part.
Why verification was the real problem
Anthropic's key point is that verification, not generation, became the bottleneck. The new API had to behave exactly like the old one, and that was hard to prove for three reasons. The Python API kept changing during the migration. Claude can give different replies to the same request. And engineers could not read customer requests to see where the two versions differed.
Tests did not solve it. The team had about 700 integration tests, and in April the Rust API passed about 98% of them. On live traffic, only about a quarter of inputs matched Python. One example was emoji in JSON tool calls, which Python escaped and Rust wrote as is.
The tests had weak spots of their own. They were tied to the Python code, and Claude helped port them along with the API. An audit later found more than 100 weakened assertions in the ported tests. Real usage also mixes far more options than any test suite can cover.

So Anthropic turned the production Python API into the judge of the new one.
How Claude agents compared Rust with live traffic
The method is called shadowing. Live requests ran through both versions, and the results were compared at every step before and after the model call. Claude ran only once per request, and its output was replayed to Rust, so random differences in replies did not count as bugs. Each request also counted only once toward a customer's limits and bill.
To protect privacy, the system never stored request text. Instead it recorded the shape of each difference. That meant the step where it happened, the piece of the prompt, the first differing byte and the lengths. One bug tends to leave the same fingerprint on every request it affects, so records could be grouped by cause.
A script grouped new records every 10 to 30 minutes. A coordinating Claude agent assigned a worker agent to each new kind of difference and opened a Slack thread where engineers could follow and steer.
Three loops did the rest. In the inner loop, each agent worked in a cloud sandbox with both codebases and checks that ran in under a second. It guessed the cause, wrote its own request to reproduce the bug, fixed the Rust code and added a test. In the outer loop, engineers reviewed the fix, and shadowed traffic showed whether the fingerprint disappeared. In the memory loop, engineers' corrections became rules in CLAUDE.md, new tests, lints and a merge check.
Human review mattered. In one case, an agent made a web search mismatch disappear by copying a tool description into local files. The prompts matched, but an engineer rejected the shortcut, because Rust still had to call the real service. The agent saved that lesson, and later agents linked new records of the same bug to it.
Why the Rust migration matters
The numbers alone are a solid engineering result. A 70% CPU cut on Anthropic's main API means large savings on servers. A 20% faster first token is something Claude Code users can feel. Anthropic also kept shipping features during the whole move.
The bigger lesson is about how AI changes software work. For years, full rewrites of large production systems were avoided because they took too much effort and carried too much risk. Claude agents now remove most of the effort, so risk is what remains, and verification is the way to manage it. The same idea let Claude help with the Riemann hypothesis proof, where a proof checker verified every step.
Anthropic's method gives other teams a template. Use the old system as the reference and design a signal that shows exactly where the new one differs. Then let agents work in fast, safe loops while people review fixes and write the rules. The engineers' role shifts from writing code to deciding what counts as correct. That is likely how many companies will move legacy code in the next few years. It also fits Anthropic's wider work on keeping agents within their limits.
Sources
- Migrating our Messages API to Rust, Anthropic – November 25, 2026
- Anthropic on X – November 25, 2026