# Anthropic moves its Messages API from Python to Rust

By Ivo Donker · 26 November 2026 — text: Claude (AI)
How did Anthropic migrate its Messages API to Rust? According to a November 25 engineering post, the company used the running Python service as the yardstick: live requests went through both versions, differences were recorded without reading their content, and teams of Claude agents tracked down and fixed the causes. Anthropic says the Rust version uses about 70 percent less CPU per request and cuts median time to first token by about 20 percent.

We read the post "Migrating our Messages API to Rust" on Anthropic's engineering page.

## What happened

The Messages API is the main way to reach Claude, including for Anthropic's own apps such as Claude Code and Cowork. Anthropic wrote the service in Python in 2023. The post says traffic grew roughly 1,800 times between early 2024 and fall 2026. An earlier partial rewrite, which moved only the parsing of model output into Rust, cut CPU use by 8 to 10 percent, but every token then crossed between Python and Rust three times. Anthropic then opted for a full migration. According to the post, Claude wrote a first version of the core request path in about a week. Public traffic moved to Rust in September 2026.

## How they verified it

Writing the code was not the hard part; verifying it was. The existing set of about 700 integration tests fell short: when Anthropic audited the ported tests, it found more than 100 weakened assertions. In April the Rust version passed about 98 percent of its tests, yet only about a quarter of inputs matched on real traffic. One example: Python wrote certain characters in JSON tool calls, such as emoji, as text codes, while Rust wrote them as is.

How they verified it
Part | How it worked | 

Shadow traffic | The model ran once and its output was replayed to Rust, so customers were not billed twice and model randomness did not get in the way. | 

Checkpoints | Both versions were compared step by step (accept the request, resolve settings, build the prompt); the first step that differed showed where to look. | 

Fingerprint | Each difference was recorded as step, prompt piece, first differing byte and lengths, without the text itself. One bug tends to leave the same fingerprint every time. | 

Inner loop | Agents in a sandbox guessed the cause, wrote their own request to reproduce the difference and edited the Rust code until both versions matched. | 

Outer loop | After review by an engineer, the fix went to production; shadow traffic showed whether the fingerprint disappeared. | 

Memory loop | Engineers' corrections became rules for later agents, along with tests, lints and a merge check. | 

## A rejected fix

The post also describes what went wrong. One agent proposed copying the web search tool's description into files so the prompts would match. The local check accepted it, but an engineer turned it down: Rust would eventually have to fetch that text from the proper internal service. Anthropic's conclusion is that a verifier can tell whether outputs match, but not whether a fix is good enough to ship. That is why human review stayed a fixed gate.

## What this means

The core message is that verification has become the bottleneck. The pattern is useful for your own migrations: keep the old service running as a reference, compare step by step, record differences in a form you can group, and let agents guess only inside a sandbox. We have seen the same idea of a strict checker in mathematics, where a proof assistant checks the work; see [our article on the VP and VNP proofs](https://nieuws.llmnet.nl/en/vp-vnp-anthropic-openai) and [our article on the Riemann proof in Lean](https://nieuws.llmnet.nl/en/riemann-hypothese-lean-geverifieerd). The memory loop echoes what Anthropic wrote earlier about [agent memory and "dreaming"](https://nieuws.llmnet.nl/en/anthropic-agentgeheugen-dreaming). Note that the figures come from Anthropic itself and concern its own infrastructure.

## What we did not check

We could not measure the performance figures ourselves; they come from the post. We did not investigate whether customers notice a difference in speed. The post does not mention any publicly available code or tooling.

Checked on November 26, 2026.

This article was written with AI (Claude) and checked against the sources below.

## Sources

- Anthropic, "Migrating our Messages API to Rust" (engineering blog, November 25, 2026): [anthropic.com](https://www.anthropic.com/engineering/migrating-api-to-rust)

- @AnthropicAI on the migration on X: [x.com](https://x.com/AnthropicAI/status/2125627317263466739)

- @ClaudeDevs on the migration on X: [x.com](https://x.com/ClaudeDevs/status/2125628717263372512)
