Anthropic Rewrote Its Messages API in Rust With Claude Agents. The First Version Took About a Week. Matching Production Took Until August. Here Is the Verification Loop I'd Copy for a Solo Rewrite.
Anthropic published a long engineering post on November 25 about moving its Messages API from Python to Rust, with Claude writing most of the code. The headline numbers are good: about 70% less CPU per request, more than 80% less memory per request, and about 20% faster median time to first token. The number I keep coming back to is a different one. Early on, the Rust version passed about 98% of its tests, and only about a quarter of production inputs produced the same result as Python.
I've had "let an agent port the backend" on my own list for months. My billing service is a Flask app I wrote in a weekend in 2023 and have regretted every Tuesday since. This post is the most honest public account I've seen of where that kind of project actually spends its time, and it's not where I assumed.
What they shipped, and what the numbers cover
The team says Claude wrote a first version of the core request path in about a week. Verification against production traffic started in April 2026. Public traffic moved to Rust in September, and the post says the service never went offline during the switch.
Read the chart caption before you quote the headline. CPU per request is measured in one region. Memory covers all of production. The time-to-first-token improvement covers only customers' Claude Code requests, over a two-week window in September. Those are still big wins, but they're narrower than the tweet version.
The post also doesn't give lines of code, headcount, agent count or what the compute cost. And it doesn't separate how much of the speedup came from Rust itself versus restructuring the request path during the port. On a podcast in late October, Anthropic platform leads cited 40% to 50% lower CPU for the service layer. I can't reconcile that with the 70% figure from what's public, and I'd guess the two measure different scopes.
Passing tests proved almost nothing
The existing integration suite had about 700 tests, written against the Python implementation. When the team audited the ported tests, they found more than 100 assertions that had been weakened so that wrong code would pass. Nobody set out to cheat. An agent told to make tests green found the cheapest path.
Even a perfect suite couldn't cover the API. The post does the math: 20 binary options make over a million combinations, and at one second each that's 12 days of tests for one model before you vary the prompt.
The match rate tells the real story. It sat at 24% in late April, dropped to 6.5% in early May as Rust-side changes landed, then climbed as fixes shipped, reaching 99.6% in August. That climb took roughly four months, against about one week for the first version of the code.
The loop that got them from 24% to 99.6%
The approach is clever, and most of it scales down.
They shadowed production traffic. The model ran once, and its output was replayed into both the Python and Rust paths, so both saw identical model output. That removes nondeterminism and avoids double billing. Checkpoints compared each step (accept or reject, settings, prompt construction) without reading customer text.
Every mismatch became a fingerprint: the first differing byte, which piece, which step, and the length difference. One bug could produce hundreds of thousands of near-identical records, so a script ran every 10 to 30 minutes and alerted a coordinating agent only when a new kind of fingerprint appeared. The coordinator assigned a worker agent to own each new kind. Workers reproduced the bug in a sandbox, wrote a fix with a test, and opened a PR. Engineers reviewed and deployed, and shadow traffic confirmed whether the fingerprint disappeared.
Two bugs from the post stuck with me. Python escaped certain characters in JSON tool calls and Rust wrote them as-is, so prompts differed by a few bytes. And the Rust side didn't call the service that supplies the web search tool description, so the description silently vanished from prompts. An agent proposed copying the text into a file Rust could read. An engineer turned it down because it didn't fix the actual problem. That's the human's job in this setup: knowing when a green result is the wrong green.
Corrections also compounded. Engineers' review comments became rules in CLAUDE.md, and one rule led to finding seven more places where the port had relied on a guess. A merge check forced anyone changing Python to make the matching Rust change or ask for an exemption, because the Python code kept moving during the port.
Where this doesn't transfer
Anthropic had production traffic at a scale where a rare bug shows up within minutes. My billing app gets a few hundred requests a day. Shadowing that for a week gives me a few thousand samples, which won't hit the weird edge cases. A solo dev will need to manufacture traffic, from logs, fixtures and fuzzed inputs, and that's real work the post doesn't have to do.
The other gap is people. Secondary coverage says the team started with no Rust specialists and later hired several engineers with more Rust experience. If you're solo and don't read the target language well, you're the reviewer who can't tell when a fix is wrong. I'd only port into a language I can review.
What I'd actually do
For my Flask service, the plan is now verification-first, and I'll write the harness before I let an agent write a line of the new version.
First, a record-and-replay diff harness: log real requests and responses from the old service for two weeks, replay them into the new one, and diff the outputs with a fingerprint per mismatch type. Second, I'll track match rate, not test pass rate, as the number that decides cutover. Third, one hard rule for the agent: it can't edit an existing test in the same PR as the code that makes it pass. If a test is wrong, that's a separate PR I review on its own. That single rule would have caught the 100-plus weakened assertions.
And I'll budget the time the way Anthropic's timeline suggests: a week to write, months to trust. If I'm not willing to spend that, the rewrite isn't worth it, and the 2023 Flask app keeps its job.
Author
Lukas
@lukcombinator