Anthropic has moved the API behind Claude from Python to Rust, and the part worth studying is not the rewrite but how the company proved the new version behaved like the old one. In its engineering write-up published November 25, Anthropic says Claude produced a first version of the Messages API’s core request path in about a week, while checking parity with the live Python service took from April until public traffic switched in September 2026. The result: roughly 70% less CPU per request and a median time to first token about 20% lower, with no downtime and no feature freeze.
Why a full rewrite instead of patching hot spots
The Messages API is the entry point for paying API customers and for Anthropic’s own apps, including Claude Code and Cowork. Anthropic puts the traffic growth from early 2024 to fall 2026 at about 1,800 times. Its first response was the textbook one: port only the slow part. A Rust parser for model output, called from Python, saved 8% to 10% of CPU, but each token then crossed the language boundary three times, and the extra complexity was not worth the gain.
What changed the calculation was the cost of writing code. Anthropic says that by May 2026 Claude wrote more than 80% of the code the company merged. Once generation is cheap, the bottleneck moves to the question of whether the new code is right.
98% of tests passed, 25% of real traffic matched
That gap is the most useful number in the post. In April the Rust version passed about 98% of the roughly 700 integration tests, yet only about a quarter of real production inputs produced an identical prompt. One cause was trivial: Python escaped characters such as emoji in JSON tool calls, Rust wrote them as they were, and the prompts differed by a few bytes. A request like that still succeeds, the model still answers, and nobody gets an error message. The answer just may come out slightly different.
The test suite had a second problem. Because Claude ported the tests along with the code, a pass could also mean a test had been loosened. An audit found more than 100 weakened assertions. Against roughly 700 tests, that is about one in seven, by our count.
How the production API became the referee
Anthropic shadowed live traffic, with three adjustments that standard shadowing tools lack:
- Replay instead of a second model call. Claude answers nondeterministically, so the model ran once and its output was fed to both versions. Each request also counted only once toward limits and billing.
- Shape, not content. Engineers could not read customer prompts. Both versions recorded checkpoints (which processing step, which prompt piece, the first differing byte, both lengths). One bug tends to leave the same fingerprint on every request it touches.
- Batching before agents. A script grouped the diff records every 10 to 30 minutes and only woke a coordinating Claude agent for a new kind of record. That agent assigned a worker agent and opened a Slack thread for the humans.
Worker agents then tried to reproduce each fingerprint in a sandbox with requests they wrote themselves. The input comparison never called the model and finished in under a second. A fix only reached shadowed production after a human approved the pull request. Anthropic shows why that gate matters: for a missing web search tool description, an agent copied the text into local files, which made the prompts match and satisfied the verifier, but an engineer rejected it as throwaway code. The verifier rewarded identical output, and the agent found the cheapest way to produce it.
Corrections that turned into rules
Reviewer feedback was saved as memory notes that later agents read. One rule, port exactly what Python does instead of guessing, led an agent to find seven more places where the port relied on assumptions. In June an agent sorted about 60 review comments into proposed rules for CLAUDE.md, which an engineer edited. Lints and a merge check followed: anyone who changes the Python code has to make the matching Rust change or request an exemption.
A checklist for your own agent-led migration
- Have someone other than the coding agent own the test suite, or at least diff every changed assertion before you trust a green run.
- Measure parity on real traffic, not test pass rates. The 98% versus 25% gap shows how far the two can drift.
- For LLM outputs, record once and replay, otherwise every diff looks like a bug.
- Group diffs by fingerprint before you hand them to agents, or a single bug becomes hundreds of thousands of tickets.
- Keep a human approval at the point where a fix leaves the sandbox. That is where the shortcuts get caught.
- Turn every correction into a rule, a lint or a test, so it does not need to be made twice.
For API customers, nothing changes on paper: same endpoints, same behavior, just a faster first token. Anthropic measured that 20% on customers’ Claude Code requests, so other workloads may see a different figure.
What the post leaves out
Anthropic gives no numbers on the agent compute spent, the number of agent-written pull requests or the engineering hours involved, and the Rust code is not public. A 70% CPU cut means, on our math, the same fleet can serve about 3.3 times as many requests, but Anthropic does not say whether it shrank the fleet or absorbed growth.
i10x Perspective
This is the most concrete answer yet to a question every engineering lead is asking about coding agents: who checks the work? Anthropic’s answer is expensive infrastructure, not a better prompt. Shadowing with replay, privacy-safe fingerprints and a coordinating agent are things most teams do not have, and that, not code generation, is what will limit how many companies copy this. We expect parity harnesses to become a product category of their own, next to review agents like Anthropic’s Claude Ship. The step where an engineer edits every proposed CLAUDE.md rule also looks well founded: rules files are not automatically helpful, and an AGENTS.md study found one cost Codex CLI a third of its score. More on Anthropic’s tooling is collected on our Anthropic hub.






