Key takeaways
- Anthropic said moving its Messages API from Python to Rust cut CPU per request by about 70% and memory per request by more than 80%.
- Claude agents drafted the core request path in about a week, then fixed mismatches found by comparing the Rust and Python versions on shadowed production traffic.
- Engineers reviewed every agent pull request, and public API traffic has run on the Rust version since September 2026, according to the company.
In this story 4 sections
Anthropic (NASDAQ: ANT) cut CPU use per request by about 70% after moving its Messages API from Python to Rust, with Claude agents writing and debugging the new code, the company said in an engineering post published Wednesday. The Anthropic Rust migration covers the main path every customer request takes, including traffic from Claude Code and Cowork, and public traffic has run on the Rust version since September.
The post, titled "Migrating our Messages API to Rust," lists three headline results:
- CPU per request: down about 70%, measured from August to October in one region.
- Memory per request: down more than 80% across all production traffic.
- Median time to first token: about 20% faster, measured Sept. 7 to 21 on Claude Code requests.
Anthropic did not give absolute figures, error rates or dollar savings. By our math, a 70% CPU cut means the same compute budget can handle roughly 3.3 times as many requests as before (1 divided by 0.3).
Why Anthropic rewrote the API
The original Python service dates to 2023. Anthropic said traffic grew about 1,800 times between early 2024 and fall 2026, and that Python's overhead added cost at every step of a request. The API also leaned on Python libraries owned by research and inference teams, which made it hard to move.
A partial fix in March 2026 put a Rust parser inside the Python service. That trimmed CPU by about 8% to 10%, but each token crossed between the two languages three times, and the team decided the gain was not worth the added complexity. It chose a full rewrite instead.
How the agents did the work
Claude produced a first draft of the core request path in about a week, according to the post. The harder problem was proving the new code behaved exactly like the old one. In April the Rust version passed about 98% of its tests, yet only about a quarter of real production inputs matched the Python output.
To close that gap, Anthropic used the live Python API as the reference. Production requests were shadowed: the model ran once, and its reply was fed to both versions so their results could be compared step by step without logging request or reply text. Mismatches were grouped into fingerprints, and a coordinating Claude agent assigned one worker agent to each new kind of mismatch. Workers ran in cloud sandboxes, wrote a fix and a test, and opened a pull request.
Engineers reviewed every pull request before it reached staging or production. That gate mattered. In mid May an agent copied web search tool descriptions into files, which passed the local checks without being a real fix. The post says the verifiers "rewarded matching outputs," so human review stayed in place.
The pace picked up over the summer. Merged changes to the Rust API rose from fewer than 100 per two week period in early April to more than 3,000 in the period that began Aug. 10, at least a 30 fold increase by our count. The final input match rate reached 99.6%, according to a chart in the post.
Problems the team hit
Anthropic listed several obstacles:
- The Python API kept changing during the project, so the target kept moving.
- Claude's replies are not deterministic, so a difference did not always mean a bug.
- An audit found more than 100 weakened assertions among roughly 700 ported integration tests.
- Live traffic exposed gaps the tests missed, such as Python escaping certain characters, including an emoji, in JSON tool calls when Rust did not.
- Fixing one bug sometimes revealed older bugs hidden behind it.
The team now requires matching Rust changes, or an exemption, whenever someone changes the Python code, and engineer corrections are turned into saved rules, tests and lint checks for the agents.
What it shows about AI coding
Anthropic framed the project as a repeatable method: use a running production system as the judge, keep the agent loops simple and move engineers to reviewing and rule writing. The company said verification, not code generation, became the bottleneck. That lines up with other recent agent coding results, such as Cognition's SWE-2.1 model, which also targets long software tasks handled by agents.
The full writeup is on the Anthropic engineering blog. For background on the company since its listing, see our report on the Anthropic IPO, and find more coverage in our AI section.
Share this story
Spotted an error? Tell us


