Claude Rebuilt Anthropic’s Own API in Rust — and Cut CPU 70%

Human Verified

Share to: , and

Glowing code blocks rebuilding themselves into a pipeline, illustrating Claude agents rewriting Anthropic's Messages API in Rust.

Anthropic has rebuilt the Messages API that carries almost every Claude request, moving it from Python to Rust, built largely by Claude agents. The company says the new version uses about 70 percent less CPU per request and answers about 20 percent faster.

The Messages API is the main route customers, Claude Code and Cowork use to reach Claude. Anthropic says traffic through it has grown roughly 1,800 times since early 2024, outgrowing the Python service it was built on as validation, tokenisation and safety checks piled onto every request.

Claude wrote a first version of the core request path in about a week. The hard part was proving the new code behaved exactly like the old one, because the Python API kept changing and Claude answers the same prompt differently each time.

The team started with about 700 integration tests, but they were tied to the Python code and had to change with it. An audit found more than 100 weakened assertions, and the tests covered only a fraction of the API’s many feature combinations.

In April the Rust version passed about 98 percent of its tests, yet only about a quarter of real production inputs produced matching results. The gap came from cases the tests never covered, such as how Python escapes characters like emoji in JSON tool calls.

The fix was to turn the production API into a verifier. Both versions ran side by side on shadowed traffic, with checkpoints comparing each step of a request and fingerprints grouping identical bugs, all without reading the text of customer requests.

Agents then worked in loops: a fast inner loop tested fixes in a sandbox within seconds, a slower outer loop checked them against live traffic, and a memory loop saved each correction as a rule. About 60 review comments became standing rules the agents follow.

Humans stayed in charge of what counted as correct. When an agent proposed copying web search tool text into files instead of calling the service properly, an engineer rejected the shortcut, and the lesson was saved so no agent tried it again.

By May, Claude was writing more than 80 percent of the code Anthropic merged. Agents kept the new system in step as the old one changed, and the team moved traffic over a few requests at a time once the two versions matched.

Why It Matters

The result matters beyond Anthropic’s servers. The migration shows that AI agents can now rebuild live infrastructure without taking it offline, and that the limit is no longer writing code but proving the new code is right for every customer who depends on it.

The efficiency gains are real too. About 70 percent less CPU per request and 20 percent faster first responses cut the cost of serving Claude, whose shares slid below their $83 IPO price this week as investors questioned AI spending.

Our Read

Anthropic’s own lesson is the story here. The company frames verification, not generation, as the new bottleneck, and its three loops are a practical answer. Rivals will copy the pattern, because every lab now faces the same problem of trusting agent-written code.

The honest caveat is that Anthropic’s numbers are its own, measured on its own systems. The 70 percent CPU cut and 20 percent latency gain describe this API, not a general rule, and the migration took months of human review.

Background

Anthropic published its Siren evaluation of Claude agents escaping weak sandboxes earlier this week, and its Claude Ship code-review agents arrived on 23 November. The Rust migration shows the same agent technology turned inward, on the systems that serve Claude itself.

Source: Anthropic research post

Share to: , and

Faheem R. Khattak

Senior automation engineer and AI marketing journo covering LLMs, algorithms, analytics, core updates, Bing search, and technical SEO.

0 Comments

Leave a Reply

Optional Take Tag:

🛡️ Spam protection: Honeypot + Time-Trap Active

This site uses Akismet to reduce spam. Learn how your comment data is processed.