Incident sheet · Enterprise AI
- System
- Enterprise AI
- Filed
- Read
- 4 min · 828 words
- Severity
- Routine
Anthropic moved its Claude Messages API from Python to Rust, with zero downtime
Anthropic ported its Claude Messages API from Python to Rust with no downtime, cutting CPU per request by 70%, memory by 80% and time-to-first-token by 20%. Claude wrote the code in a week; verification took the rest.

Event log
- The Rust rewrite uses ~70% less CPU per request, ~80% less memory and cuts median time to first token by ~20%
- Claude wrote the port in about a week; the migration ran with zero downtime and no feature freeze
- Messages API traffic grew more than 1,800x from early 2024 to fall 2026
- The team's ~700 integration tests proved inadequate, so production shadowing became the verifier
- By May 2026 Claude wrote over 80% of all code Anthropic merged
Anthropic has moved the production Messages API for Claude from Python to Rust without taking the service offline or freezing feature development. The rewritten system uses about 70% less CPU per request, 80% less memory, and cuts median time to first token by roughly 20%, the company said. Claude itself wrote the port in about a week; proving the new system behaved like the old one took considerably longer.
The engineering team laid out the project in a blog post titled "Migrating our API to Rust." Their verdict: the hard part is no longer writing code. "Now that the hard part is no longer writing new code, we need to build sufficient confidence that the new system behaves like the old one," they wrote.
What forced the rewrite?
Anthropic launched the Messages API in 2023 as a simple Python "request forwarder" — the primary route by which customers and Anthropic's own internal apps reach Claude. Traffic then grew by more than 1,800 times between early 2024 and fall 2026.
By late 2025, every request had to be validated, converted into a prompt, tokenized, and screened by safety classifiers; reply tokens had to be sorted into text, thinking, and tool calls. Python added overhead at each step, and the service had accumulated shared dependencies with Python libraries.
"Traffic eventually grew far beyond what the initial Python service was built for, and we quickly needed to find a way to make the service much more efficient," the engineers said. They tried incremental rewrites of the slowest components first, but the CPU gains did not justify the added complexity.
The barrier dropped by May 2026, when Claude was writing more than 80% of all code Anthropic merged — recursive self-improvement in practice, and a full migration suddenly within reach.
How do you verify an AI-written rewrite?
Not with the test suite, it turned out. The team had about 700 existing integration tests and found them inadequate: incomplete, coupled to Python implementations, and in some cases passing when they should have failed. Live outputs were also hard to check — constant Python changes, privacy limits, and nondeterministic replies all got in the way.
"Verification, not generation, had become the bottleneck," the engineers wrote.
Their answer was to turn the production API itself into the verifier. They shadowed requests through both the old Python service and the new Rust service, compared the results, and logged each difference as a small record that described what differed and where — sharing no customer content. A single bug could generate hundreds of thousands of nearly identical diff records. Those records went to agents tasked with reconciling the differences.
The agents ran in three loops:
- Inner loop: a sandboxed environment where agents debug a difference and propose a fix in under a second. It simulated production quickly but imperfectly — agents could only test on requests they had written, with a local verifier not always configured exactly like production.
- Outer loop: a slower validation stage that caught problems the inner loop missed, comparing Rust API deployments with and without each fix.
- Memory loop: a record of mistakes and human review decisions carried forward, so later agents learn from earlier ones. When an engineer rejected a web search shortcut, the agent saved a note explaining the decision, the reason, and the correct fix.
"The inner and outer loops fixed one difference at a time," the engineers said. "The memory loop improved how agents made those fixes."
What did Anthropic's engineers learn?
The post closes with five lessons that apply well beyond one API migration:
- Verification is the new chokepoint. Large rewrites used to be hard to justify because of effort and risk; with generation cheap, the constraint has moved to verifying results.
- Verification builds confidence. Tests and formal checks determine whether each step Claude takes is valid. When those run out, the production system itself can serve as the verifier.
- Design verification signals deliberately. Production systems offer no signal by default, so the engineers built checkpoints that located each difference in the code and fingerprints that distinguished one bug from another.
- Build loops Claude can run autonomously. Human judgment went only into what counted as correct; Claude chose which hypotheses to test and how to reproduce and fix each bug, with verifiers judging the result.
- Move humans to the outer edge. Engineers started inside the inner loop, "chasing differences themselves." They moved to the seam between loops, steering agents and reviewing fixes in Slack, then to the edge, writing rules and checks.
What does this change for engineering teams watching from the outside? The migration suggests a production rewrite by an AI agent is now operationally feasible — provided you can instrument the comparison. "As Claude grew more intelligent (and as we grew more intelligent at working with it), we evolved from directing Claude to Claude directing itself, relying on humans mainly for important judgment calls," the engineers wrote. The port took a week. The proof took the machinery.
via infoworld.com/feed/ (Source)
More from Tom Whitfield
Show full bio
Market editor covering people, launches and day-to-day practice in enterprise information technology and the leaders who run at CIO Monitor.
275 articles
The newsroom digest
One email a day with the stories that matter. No noise.
Cross-references
- Anthropic quietly throttled Claude's AI-research skills — and got caught
- Anthropic delays next frontier model, calls for federal AI release vetoes
- Anthropic finds “thorough” prompts trigger Claude sandbox escapes
- Anthropic launches Claude Meetings as workplace race intensifies
- Cisco and OpenAI launch open-source AI shields for Java4Shell