News · · 8 min read
Anthropic's Messages API Moves to Rust: 98% of Tests Passing, 24% of Production Inputs Matching
In this post
On November 25, 2026, Anthropic published an engineering post, "Migrating our Messages API to Rust," describing how the Messages API — the core of the Claude API — moved from Python to Rust. Anthropic reports that the Rust service uses about 70% less CPU per request and cuts median time to first token (TTFT) by about 20%. The service never went offline, and feature work never paused.
The post is mostly about verification, not speed. Claude wrote a first Rust version of the core request path in about a week. Yet in April 2026 that Rust API passed about 98% of its tests while matching Python on only about a quarter of production inputs. To close that gap, Anthropic turned the live Python API into the answer key. This piece covers why the two numbers diverged, where humans sat in the verification system, what each published improvement actually measures, and what this means for developers who call the Claude API and for teams planning similar agent-driven migrations.
Between 98% passing and 24% matching
Both numbers measure the same Rust code with different yardsticks. The chart below puts the values from Anthropic's text and figure descriptions on one axis; we compiled it ourselves.
The first reason the tests looked good is that the tests moved too. The roughly 700 existing integration tests ran the Python API in-process, so porting the code meant changing the tests, and Claude helped with both. When Anthropic audited the ported tests, it found more than 100 weakened assertions. A pass could mean the code was right — or that a test had been changed to let wrong code through.
The second reason is combinatorics. By Anthropic's arithmetic, 20 binary options alone yield over a million combinations, which at one second per test is 12 days for a single model. Tests cover the combinations someone thought of; production traffic sends the rest. One example from the post: Python escaped characters such as emoji into text codes when writing JSON tool calls, while Rust wrote them as is. The prompts differed by a few bytes, which still counts as a mismatch.
The production match rate started at 24% in late April, fell to 6.5% in early May, then climbed to 99.6% by August as fixes landed. Per the figure description, the comparison began on Anthropic's own traffic and later moved to a wider sample. The caption notes that "what we compared changed over time," and the description attributes two falls during the climb to changes on the Rust side. No sentence directly explains the early-May drop to 6.5%, so it's hard to read that dip as a measure of code quality alone.
Using production as the oracle
Sending live requests through old and new code and comparing results is usually called shadowing. The textbook version didn't fit the Messages API. Here is what got in the way and how Anthropic responded:
| Obstacle | Response |
|---|---|
| A request run twice could count twice toward limits and billing | Designed so each request counts only once |
| Claude replies differently to the same input | Run the model once, replay its output to Rust |
| Customer requests and replies can't be read | Record only where and how large each difference is (checkpoints, fingerprints) |
| One bug leaves hundreds of thousands of near-identical records | Group records every 10–30 minutes; alert a coordinating agent only on new kinds |
The third row is the heart of the system. Both versions go through the same steps — accept or reject, resolve settings, build the prompt — so the first step where results diverge roughly locates the bug. Add where the difference begins in the prompt and how much the lengths differ, and a single bug tends to leave the same shape on every request it touches. Anthropic calls that shape a fingerprint and grouped mismatches by it to triage fixes. No text goes into the record.
From a fingerprint alone, an agent guesses the cause, writes a request or model reply that should trigger the same difference, and runs it through both versions. The input check never calls the model and takes under a second. Once the difference reproduces, the agent edits the Rust code and adds a test that fails on the old code and passes on the new.
Where the humans sat
In this setup, people judged rather than typed. A fix crossed into the production-comparison stage only after PR review, and the post's main example shows why that gate mattered.
In mid-May, one of the largest remaining differences was a missing web search tool description. Python fetched it from an internal service that Rust didn't call yet. An agent proposed copying the text into files Rust could read; the prompts then matched and the local verifier passed. An engineer rejected it as throwaway code, since Rust would have to call the service before launch anyway. Anthropic's takeaway: a verifier can tell an agent whether outputs match, but not whether the fix is good enough to ship.
The rejection became durable. The agent saved the decision, the reason, and the correct direction to memory, so when the same bug reappeared under new fingerprints, other agents linked it to the known issue instead of writing new workarounds. After an engineer made "port exactly what Python did" a rule, another agent scanned the code against it and found seven more places that relied on a guess. In June, an agent grouped about 60 team review comments into proposed rules, which an engineer edited and approved for CLAUDE.md.
We looked earlier at settings in Anthropic's PR review, fix, and approval agents that can open a path to merging without human review (our Claude Ship write-up). This post differs in that Anthropic shows, from its own work, a concrete decision that human review caught.
Reported gains and what each one measures
Every improvement figure is Anthropic's own measurement; we found no independent measurement of this change. The chart below lays out the reported reductions alongside their scope.
The four bars measure different things. According to the figure description, CPU is one region, memory is all of production, and TTFT covers customers' Claude Code requests over a shorter period. The "more than 80%" memory figure appears only in the figure description, not in the body text. Read each bar on its own rather than against the others.
The orange bar is the partial rewrite tried first: rewriting only the model-output parser in Rust and calling it from Python cut CPU by about 8–10%. But each reply token then crossed between Python and Rust three times, and Anthropic concluded the gain didn't justify the added complexity. Public traffic moved to Rust in September 2026.
For context, API traffic grew roughly 1,800-fold between early 2024 and fall 2026. Every request must be validated, converted into a prompt, tokenized, and screened by safety classifiers, and every streamed reply must be sorted into text, thinking, and tool calls — steps where Python's object creation and memory management kept adding overhead.
Hacker News reaction
The post reached Hacker News the day it was published, sitting at 33 points and 10 comments when we checked. The discussion was small but split.
User dzonga read it as the end of an era: "the era of 'productivity gains' using dynamic languages is over," asking whether readability matters if humans aren't reading the code (comment).
Pushback followed. curt15 asked, "If humans are not reading the code, what are they doing besides pulling a lever?" (comment). nextaccountic argued that unreadable code makes agents spend more reasoning tokens understanding it (comment). derwiki put the human role on verification instead: "Humans should be reviewing the verification that the code is doing what it's intended to do." (comment). That last view lines up with the conclusion of Anthropic's own post.
What it means for API users and migration teams
If you call the Claude API, there is nothing to change in your code. This was a reimplementation of the same API, and the bar Anthropic set was parity with the production Python API. The roughly 20% TTFT reduction appears to come from server-side processing time. For callers far from Anthropic's serving regions — Korea, for instance — network round trips add to TTFT, so the felt improvement is likely smaller than 20%. Anthropic hasn't published per-region figures, so we can't confirm this.
The bigger lessons are for teams handing a large migration to agents. Three seem portable:
- If one agent ports both the code and the tests, the pass rate is hard to trust. Anthropic's own audit of its roughly 700 ported integration tests found more than 100 weakened assertions. Audit ported tests separately, or use the old system's real outputs as the reference.
- You can compare without reading production data. Recording only the location and size of each difference, not the content, looks transferable to services that can't inspect real requests for privacy reasons.
- Passing the verifier is not the same as being shippable. As the web search case shows, a verifier rewards the cheapest way to match. The design here fixed in advance where human review sits between verification stages.
Limitations
| Item | Detail |
|---|---|
| Who measured | All improvement and match-rate figures are Anthropic's own; no third-party measurement |
| Scope | CPU, memory, and TTFT cover different targets and periods; no per-region or per-model figures |
| Memory figure | "More than 80%" appears only in a figure description |
| Match-rate sample | Sample widened from internal to broader traffic; Anthropic says six misleading days were left out of the chart |
| Cost | Token, staffing, and time costs of running the agents were not disclosed |
| This article | Summarizes public documents and Hacker News comments; we did not measure API latency ourselves |
Our charts re-plot the values Anthropic published. What generalizes is the direction — passing tests and matching production are different yardsticks — not the specific numbers 98% and 24%.
Sources
- Anthropic Engineering, Migrating our Messages API to Rust (2026-11-25)
- Hacker News, Migrating Our Messages API to Rust
