Anthropic used Claude agent teams to move its Messages API to Rust

The company says the new service uses about 70% less CPU per request, and that checking the agents' work, not writing the code, was the hard part.

Illustration of two identical ships sailing side by side, one built of gray planks and one of rust-orange metal, with small robots on a bridge between them comparing matching parts while an engineer checks a clipboard. Image: AgenticFeed illustration

Anthropic has moved its Messages API, the main way customers and its own apps reach Claude, from Python to Rust, using teams of Claude agents to find and fix differences between the old and new versions. In an engineering post published November 25, the company said the Rust service uses about 70% less CPU per request and cuts median time to first token by about 20%.

Public traffic moved to Rust in September 2026, according to the post, credited to Lance Martin, Jake Eaton, Arvin Aminpour, Emma Webb, Bharat Mediratta and Ravi Trivedi. Anthropic says the API never went offline and feature work didn't pause during the switch.

Why Anthropic rewrote it

Anthropic built the Messages API in Python in 2023. Traffic grew roughly 1,800 times from early 2024 to fall 2026, the company says, and Python added overhead to every step of handling each request and streaming the reply.

A partial rewrite came first, according to the post. Rust code that parsed model output cut CPU use by about 8% to 10%, but each token then crossed between Python and Rust three times, which created new overhead.

Claude wrote a first version of the core request path in about a week, the post says, and by May 2026 Claude was writing more than 80% of the code Anthropic merged. "Verification, not generation, had become the bottleneck," the authors wrote.

Tests weren't enough

The team started with about 700 integration tests, the authors wrote. When it audited the ported tests, it found more than 100 weakened assertions, so a pass didn't always prove the code was right. In April the Rust API passed about 98% of its tests, yet only about a quarter of inputs matched on production traffic.

In one mismatch, Python escaped some characters, such as emoji, inside JSON tool calls, while Rust wrote them as is. The prompts ended up a few bytes apart.

So Anthropic used the live Python API as an oracle, a reference system whose behavior defines the right answer. Its shadowing setup ran real requests through both versions. It called the model once and replayed that output to Rust, so randomness in Claude's replies wouldn't look like bugs.

Engineers couldn't read customer requests, Anthropic says. Instead, the system recorded only the shape of each difference, such as the processing step where it began and the size gap between versions. Anthropic calls these fingerprints, because one bug tends to leave the same one on every request it touches.

Agents in loops, humans at the gates

Every 10 to 30 minutes, the post says, a script grouped new kinds of difference records and alerted a coordinating Claude agent. That agent assigned a worker agent to each new kind and opened a Slack thread where engineers could follow along.

Worker agents ran in cloud sandboxes with both codebases, where an input check compared the two versions' prompts in under a second.

Each agent guessed a cause and wrote its own request to reproduce the difference. It then edited the Rust until the outputs matched and added a test. Fixes reached production shadowing only after human pull request review.

That review caught shortcuts, the post says.

In mid-May an agent copied a web search tool description into files instead of having Rust call the internal service that supplies it. The prompts matched, but an engineer rejected the change as throwaway code. "A verifier can tell an agent whether the outputs matched, but not whether the fix is good enough to ship," the post says.

Corrections turned into rules in shared memory that later agents read, according to Anthropic. In June an agent grouped about 60 review comments and proposed rules, which an engineer edited and approved for the team's CLAUDE.md file. A later merge check required anyone changing the Python code to make a matching Rust change or ask for an exemption.

The performance figures come from Anthropic's own post and haven't been independently measured.

Source: Anthropic Engineering, Lance Martin, Jake Eaton, Arvin Aminpour, Emma Webb, Bharat Mediratta and Ravi Trivedi, Anthropic, “Migrating our Messages API to Rust”

Additional sources: Anthropic on X, Anthropic, “We recently migrated our Messages API from Python to Rust”; Lance Martin on X, Lance Martin, Anthropic, “We recently migrated the Claude Messages API from Python to Rust”

Get the AgenticFeed newsletter

A free, regular roundup of the agent stories that matter. No spam, and you can unsubscribe at any time.

Want to reach readers following AI agents? Advertise with AgenticFeed

Next event · 30 Nov, 2026

AWS re:Invent 2026 in Las Vegas

AWS’s annual conference runs Nov. 30 to Dec. 4. Matt Garman’s CEO keynote is on Dec. 1, and the catalog lists more than 2,200 sessions.

The AgenticFeed newsletter

A free, regular roundup of the agent stories that matter. No spam.