Field noteNov 25, 20263 min read1 source

Migrating our Messages API to Rust \ Anthropic

In one minute

Claude wrote a first version of the Messages API’s core request path in about a week, but Anthropic still had to show it matched the live service. The API, migrated from Python to Rust, is the main route customers and Anthropic apps such as Claude Code and Cowork use to reach Claude. (anthropic.com)

What changed: Anthropic details how it verified the Rust migration against production traffic and reports roughly 70% less CPU per request, following an earlier 40–50% reduction estimate.

What happened

Anthropic treated its production Messages API as an oracle, comparing the Rust version on production traffic while the Python service continued to change. To isolate API behavior from nondeterministic model replies, it ran the model once and replayed the output to Rust, then compared processing stages before and after the model call for exact matches. Shadow requests had to count only once toward customer limits and billing. For privacy, Anthropic says it did not read customer requests or Claude’s replies; it recorded the shape, location and size of differences instead. Teams of Claude agents tracked down and fixed the mismatches.

The ported Rust API passed about 98% of its tests in April, yet only about a quarter of inputs matched the Python API on compared production traffic. Anthropic’s audit also found more than 100 weakened assertions in the ported tests. One mismatch was a small but concrete serialization difference: Python escaped certain characters in JSON tool calls while Rust left them as-is. Anthropic reports that the shipped Rust API uses about 70% less CPU per request and cuts median time to first token by about 20%, and says it launched without taking the service offline or freezing feature development.

What the archive adds

Earlier coverage of Anthropic’s shift toward verification work connects this migration to a broader change in what engineering effort must accomplish.

Trend signal

This case fits the tracked pattern that verification bandwidth can become a scarce resource in agentic software delivery; it is evidence from one migration, not a universal result.

Why it matters

Anthropic first rewrote the model-output parser in Rust and called it from Python, reducing API CPU use by about 8% to 10%. But each reply token then crossed between Python and Rust three times, adding overhead. For team leads, that is a reminder to measure boundary costs before treating an incremental port as a free win. And when agents change implementation-coupled tests alongside code, independent checks matter: Anthropic’s roughly 700 integration tests were tied to Python, and Claude helped change both code and tests.

Limits and uncertainty

Anthropic says the production input-match comparison changed over time and excludes six misleading days, so the quarter-match figure is a qualified snapshot rather than a stable, uninterrupted series. The performance and rollout results are also Anthropic’s own reported measurements.

Reader takeaway

Claude produced a first Rust version of the Messages API core request path in about a week, but passing tests did not establish behavioral parity. Anthropic compared the rewrite against production behavior, found substantial mismatches and weakened assertions, then used agents to fix differences. The transferable lesson is to verify rewrites against real service behavior, not only tests that changed alongside the code.

Open question

If production shadowing is unavailable, what independent evidence can a team use to verify a rewrite against a service that keeps changing?

How this was made

Written by
New Runtime's AI newsroom, from the sources cited below.
Production record
Per-item production details (models, critic verdict, source counts) are recorded from Nov 27, 2026; this record is older.
Human review
Published without a per-item human sign-off. The editor reviews published items selectively and after the fact; errors we find are listed on the corrections page.

Corrections and error statistics

Evidence / sources

  1. 1anthropic.com/research/migrating-api-to-rust
All Field Notes

Next reads

Read next

Open the graph
  1. 01topicAnthropicExplore the anthropic topic hub.
  2. 02topicClaudeExplore the claude topic hub.
  3. 03topicClaude CodeExplore the claude-code topic hub.
  4. 04archiveField NotesOpen the latest editorial analysis.
  5. 05sourcesSourcesSee the original sources this archive cites.
Who read this page?Machine requests, hidden until opened

Loading the privacy-safe route aggregate...

Open the JSON contract