Anthropic Rust Rewrite: API Rebuilt in Five Months

Anthropic Rust rewrite of the Claude API shown as code on a developer's monitor

The Anthropic Rust rewrite replaced the Python service that handles every external Claude token with a new Rust codebase, and it took only a few engineers around five months. Katelyn Lesse, who leads platform engineering at Anthropic and previously ran engineering teams at Stripe, says nobody on the team was a Rust expert when they started.

Why the Python service had to go

The service is the Messages API. It serves Claude tokens to outside customers and to Claude Code and Claude Desktop. It handles authentication, tokenization, billing and safety checks, then calls the GPU stack that generates the tokens.

It started as a Python monolith. In 2023 Anthropic was still a research company, the API team was small, and it overlapped heavily with research, where Python is the working language. That made it easy to wire the API into inference code. OpenAI’s API also began in Python and was later rewritten in Rust, and both companies ran into the same problem: the monolith’s CPU footprint kept growing.

Adding CPUs isn’t simple right now because of a global CPU shortage. The team first tried to optimize the Python, but the overhead stayed large. Rebuilding was the remaining option.

Anthropic Rust rewrite image 1
Image: newsletter.pragmaticengineer.com

Rust without Rust experts

A year earlier, the same team had picked Go for new services because people on it could already read and write it. By 2026 they judged that Claude was good enough at Rust to change that call for the Anthropic Rust rewrite, and Claude also helped the engineers learn the language as they went.

The team skipped strict line-by-line code review. Lesse estimates engineers looked closely at only about 20% of the generated code. What made that workable was the old Python API, which served as a ready-made test suite.

Shadow traffic as the safety net

The new Rust API ran in shadow mode next to the live one, receiving production traffic. The team kept iterating until the responses from both were identical.

Lesse’s view is that once a result can be reduced to something verifiable, “you don’t have to look at every single line of Rust code” the model writes.

How the work around the code is changing

Lesse described several other shifts inside Anthropic’s engineering teams:

  • A Claude classifier runs on every pull request. It decides whether a human needs to review it, how many reviewers it needs, and which team should look. Low-risk changes such as an SDK version bump or a flaky-test fix can be reviewed and merged by another Claude with no human involved.
  • For API oncall, a Claude agent now sees an incoming alert before a human does and sorts it as real or noise. Claude shadowed the rotation for months first. The long-term goal is to handle real incidents without waking anyone, but the team isn’t there yet.
  • New engineers learn systems by asking Claude, which is connected to the codebase and internal tools and can build interactive tutorials.
  • Engineers spend more time building their own tooling. One engineer on her team set up a Slack channel that runs a multi-agent team toward a single goal, even though no one assigned it.

What hasn’t changed

Planning still takes about as long as it did before AI. Lesse’s team works with the inference, research, safety and app teams, and she says the average engineer spends more time coordinating than implementing. Teams are still two-pizza size, around five to eight people, which she considers right for understanding a complex system and covering an oncall rotation. A team, not an individual, owns each system.

Interviews and promotions

Hiring is changing too. Strong candidates kept failing the coding interview because they no longer write code by hand, so Lesse’s team phased it out. It is experimenting with exercises where the candidate works alongside a coding agent. The architecture and project deep-dive interviews stay as they were.

Promotions have shifted as well. A year-long project can now take days or weeks, so completion time no longer says much. Anthropic still has levels, and it now looks at impact: CPU saved, latency cut, incidents avoided.

What to watch next

The Anthropic Rust rewrite gives other teams a pattern to copy: pick a system with a trustworthy reference implementation, run the new version in shadow, and review less by hand because the comparison does the checking. The harder open question is the oncall goal, where Claude would resolve incidents on its own. Lesse says that isn’t done yet.

Her advice for engineers worried about their place in all this is that agent infrastructure is a wide-open problem area with plenty left to solve.

Source: newsletter.pragmaticengineer.com

Written by

Saksham Bhargava

Saksham Bhargava runs Alteroid and has been writing about consumer technology for over five years, covering iPhone, Android, Windows, AI tools and gaming. With an MCA and six years of hands-on web development experience, he tests the features he writes about on his own devices and focuses on clear, practical guides that solve real problems. Away from the screen, he enjoys travelling to places most tourists skip.