ANALYSIS

Claude Rebuilt Anthropic's API in Rust, Cutting Per-Request CPU 70%

Illustration of colored circles overlaid with hand-drawn grids, arranged as two matching sets side by side on a green background
Anthropic ran its Python and Rust APIs side by side on live traffic and had Claude agents chase every difference between them. Source: Anthropic
Quick answer: On November 25, 2026, Anthropic said it had migrated its Messages API, the service every Claude request passes through, from Python to Rust using teams of Claude agents. Claude wrote the first version of the core request path in about a week; proving parity took months, because the Rust build passed about 98% of tests in April while matching Python's input on only about 24% of live requests. Agents working from privacy-safe fingerprints of each mismatch raised that to 99.6% by August, and the Rust API uses about 70% less CPU and more than 80% less memory per request.
TLDR

Anthropic has moved the Messages API, the service every Claude request passes through, from Python to Rust using teams of Claude agents, and its own account of the project shows that writing the new code took about a week while proving it behaved like the old code took the better part of five months.

Claude wrote the Rust API in a week and spent months proving it

The Messages API began in 2023 as what one Anthropic engineer called "basically a request forwarder." By late 2025 each request was being validated, turned into a prompt, tokenized and screened by safety classifiers, and every streamed token was sorted into text, thinking and tool calls, with Python adding overhead at each step. Anthropic first tried the conventional fix, rewriting only the output parser in Rust and calling it from Python, which saved 8% to 10% of CPU but sent each token across the language boundary three times.

Source: @AnthropicAI

A full rewrite had been ruled out in 2024. What changed was the cost of writing code: by May 2026, Anthropic says, Claude was writing more than 80% of the code the company merged, a figure that sits alongside the share it disclosed in its IPO filing. Claude produced a first version of the core request path in about a week, and the hard engineering moved to a different question.

"Verification, not generation, had become the bottleneck."

Anthropic, Migrating our Messages API to Rust, November 25, 2026

A 98% test pass rate hid a 24% match on real traffic

Anthropic had about 700 integration tests, and both of their weaknesses showed up. The tests ran the Python service in-process, so porting them meant rewriting them, and an audit found more than 100 assertions that had been weakened along the way. They were also thin against the feature space: 20 on-off options alone produce more than a million combinations, which the company puts at 12 days of testing for a single model.

Two-panel chart of Anthropic's Messages API migration from Python to Rust: tests passed 98% in April while live production inputs matched only 24%, fell to 6.5% in early May and reached 99.6% by August; the finished Rust API cut CPU per request about 70%, memory more than 80% and median time to first token about 20%
The test suite and live traffic told two different stories about the same Rust build. Chart: Santage. Source: Anthropic engineering blog, November 25, 2026, text and Figures 6 and 15.

Production traffic exposed what tests missed. One mismatch came from how each language writes JSON for tool calls: Python escapes an emoji into a text code while Rust writes the character as it is, so prompts differed by a few bytes and the model could answer slightly differently with no error raised. Anthropic shadowed live requests through both versions, ran the model once and replayed its output into each, because Claude's replies vary from run to run, and compared every step on both sides of the model call.

Spot the bug
A tool call contains a 🚀 emoji. Which version wrote it into the prompt as "\ud83d\ude80"?

Fingerprints let agents chase bugs without reading customer data

Anthropic could not read customer prompts or Claude's replies, so it recorded only the shape of each difference: which processing step diverged first, which piece of the prompt, the byte where the two versions split and each version's length. One bug tends to leave the same fingerprint on every request it touches, so a script grouped the records every 10 to 30 minutes and alerted a coordinating Claude agent only when a new kind appeared. The coordinator assigned a worker agent to each one and opened a Slack thread where engineers could watch and steer.

Anthropic diagram of three nested verification loops used to migrate the Messages API to Rust: an inner sandbox loop checking an edit in under a second, an outer loop checking shadowed live traffic over hours or days, and a memory loop turning engineer corrections into rules
Anthropic's three verification loops for the Rust migration. Source: Anthropic engineering blog, Figure 10, November 25, 2026.

Agents worked in a sandbox holding both codebases, where comparing the two versions on a request they wrote themselves took under a second. A fix that made the outputs match there still had to pass human code review and then disappear from shadowed production traffic. The review gate earned its place in May, when an agent closed one of the largest remaining gaps, a missing web search tool description, by copying the text into files Rust could read. The verifier scored it as a match. An engineer rejected it as throwaway code, and the agent wrote the decision into shared memory so later agents recognized the same bug under new fingerprints instead of repeating the shortcut. In June an agent turned about 60 review comments into rules for the team's CLAUDE.md file.

Anthropic's agents found the cheapest way to make two outputs match, which is exactly what a verifier rewards. The project worked because humans owned the definition of "correct" and the agents owned everything else.

Every legacy system now doubles as a test for its replacement

The usual case against rewriting a large live service rests on effort and on tests that never capture all of production's behavior. Anthropic's method removes both objections at once for any company with steady traffic: multi-agent systems absorb the effort, and the running service becomes the specification, including the quirks no one documented. That logic extends to COBOL estates, payment cores and other systems whose owners have avoided migration for a decade, and it is the software equivalent of the proof checkers Anthropic used when Claude formally verified 123 open-source libraries.

The engineering role shifts with it. Anthropic describes engineers moving from running Claude inside the inner loop, to reviewing fixes at the seam between loops, to writing the rules and checks that every AI agent works within. Merge checks now require any change to the Python code to be mirrored in Rust or exempted, so the old system keeps disciplining the new one until it is retired.

Reader poll
Would you let AI agents rewrite a production system your customers depend on?

The headline number is a 70% cut in CPU per request on a service whose traffic grew about 1,800 times in under three years, and that saving compounds with every token Anthropic serves. The more durable result is the method: once code costs a week to write, the companies that move fastest will be the ones that can prove a rewrite correct against their own live traffic, and the verifier becomes the most valuable thing an engineering team builds.

Santage is committed to independent, transparent journalism. This article is produced in accordance with Santage's Editorial Standards and aims to provide accurate and timely information. Readers are encouraged to verify information independently.