🇺🇸 English 🇰🇷 한국어 🇯🇵 日本語
Home › Developer Tools
Developer Tools

Claude Agents Move API to Rust, Cut CPU 70%

Anthropic said Nov. 25, 2026, that Claude agents helped migrate its Messages API from Python to Rust with no downtime. The Rust version uses about 70% less CPU per request and cuts median time to first token about 20%; verification, not code generation, was the hard part.

Anthropic said on Nov. 25, 2026, that teams of Claude agents helped it move its Messages API, the main gateway customers and its own apps use to reach Claude, from Python to Rust without taking it offline. The new version uses about 70% less CPU per request and cuts median time to first token by about 20%, according to the company's engineering report.

Rack-mounted computer servers and storage units in a server room
Rack-mounted servers, a file photo. Anthropic says the Rust version of its Messages API needs about 70% less CPU per request. 사진: jared / Flickr(CC BY 2.0)

Key takeaways

  • Claude wrote a first version of the API's core request path in about a week; proving it matched production took months.
  • Shadowed production traffic was the judge: the share of matching inputs rose from 24% in late April to 99.6% by August.
  • Public traffic moved to Rust in September 2026, with CPU per request down about 70% and memory down more than 80%.

Why Anthropic rewrote the Claude API in Rust

Anthropic built the Messages API in Python in 2023. It is the main way customers, as well as Claude Code and Cowork, reach Claude. From early 2024 to fall 2026, API traffic grew roughly 1,800 times, the company said.

Every request must be validated, turned into a prompt, tokenized and screened by safety classifiers, and every reply must be sorted into text, thinking and tool calls. Python added overhead at each step. A partial fix in March 2026, which moved output parsing into Rust, cut CPU use by only about 8% to 10%, and each token then crossed between the two languages three times.

In 2024, one engineer had shut down the idea of a rewrite: "We are not rewriting the API in go or rust!" What changed was the cost of writing code. By May 2026, Claude was writing more than 80% of the code Anthropic merged, the report said.

Verification, not code generation, was the bottleneck

Anthropic's roughly 700 integration tests were not enough. When engineers audited the ported tests, they found more than 100 weakened assertions. In April, the Rust API passed about 98% of its tests, yet only about a quarter of inputs matched on production traffic.

So the team used the live Python service as the reference. The model ran once, and its output was replayed to the Rust version so both could be compared step by step. Because engineers could not read customer requests, the system logged only the "shape" of each difference, such as the step, the position of the first differing byte and the lengths, a fingerprint that let agents tell one bug from another.

How the Claude agents worked

A script ran every 10 to 30 minutes, grouped new mismatch records and alerted a coordinating Claude agent, which assigned a worker agent to each new kind of difference. In a cloud sandbox, agents reproduced bugs with requests they wrote themselves; an input check took under a second.

Humans stayed at the gate. Every fix needed pull-request review before it was tested on shadowed traffic. In mid-May, an engineer rejected an agent's shortcut for a missing web search tool description: "We know we have to fetch that text before we ship, so this seems like throwaway code. Abandon that PR." Corrections like that became rules every later agent read. Merged changes to the Rust code climbed from under 100 per two-week period in April to more than 3,000 in the period starting Aug. 10.

Context: a growing pattern

Katelyn Lesse, who leads platform engineering at Anthropic, told The Pragmatic Engineer podcast on Nov. 25 that the rewrite took around five months and a few engineers, none of them Rust experts. She estimated engineers looked closely at only about 20% of the generated code. Agent-heavy coding tools are spreading across the industry, including Meta's Muse Code.

What's next

Anthropic's main lesson is that "verification is the new bottleneck." It said a production system itself can act as the verifier when tests fall short. For teams planning their own migrations, the takeaway is to budget most of the effort for proving parity, not for generating code.

FAQ

Do Claude API users need to change anything?
Anthropic did not announce any change for developers. The migration ran without downtime or a feature freeze.

How much faster is the Rust API?
Anthropic reports about 70% less CPU and more than 80% less memory per request, and about a 20% cut in median time to first token for customers' Claude Code requests.

Did Claude write all the code?
Claude agents wrote and fixed the code, but engineers reviewed every fix before it reached production and set the rules agents followed.

References

#Anthropic #Claude #Messages API #Rust #Python #code migration #AI agents #Claude Code #shadow traffic #verification #Katelyn Lesse
S
Seung Jung
AI Newsway · Developer

Editor responsible for AI Newsway. Writes about AI, developer tools, cloud and productivity technology.

More by this reporter ›
Copyright © AI Newsway All rights reserved. Unauthorized reproduction, redistribution, and AI training prohibited.
Share
f X K

Comments 0

Comments are currently disabled.

Be the first to comment.