Anthropic says Claude helped migrate its Messages API from Python to Rust, with CPU use per request falling by about 70% in one measured region. In a November 25 announcement, the company shared an engineering account of how it used the running Python service to check the rewrite. Writing the code was apparently the easier assignment. SourceSource
The Messages API is the software interface through which customers and Anthropic’s own apps, including Claude Code and Cowork, reach Claude. This migration covered the processing around the model call, not a rewrite of Claude’s model. According to the account, public traffic moved to Rust in September 2026 without the company taking the service offline or freezing feature development. Source
Anthropic also reports about a 20% reduction in median time to first token—the wait before a response starts arriving. That measurement covered customer Claude Code requests over a shorter period than the CPU comparison. That doesn’t mean every Claude answer now finishes 20% sooner. Source
The tests looked happier than production
Claude wrote an initial version of the API’s core request path in about a week, Anthropic says. That was not the duration of the migration. In April, the Rust version passed about 98% of its tests, yet its input processing matched Python’s on only about a quarter of the production requests compared. Source
The existing tests were both incomplete and tied to the Python implementation. Claude helped port the tests alongside the code, and an audit found more than 100 weakened assertions—the checks that determine whether a test passes. A passing result could therefore reflect a looser test rather than a faithful rewrite. Source
Those production mismatches did not mean three-quarters of customer requests failed. Some differences were tiny: Python escaped certain characters in JSON tool calls, while Rust wrote them directly, leaving prompts a few bytes apart. But a small prompt difference could change a model’s answer without producing an obvious error. Even an emoji’s encoding became part of the compatibility job. Source
Python became the answer key
Anthropic’s solution was to compare the new service against the old one on live traffic, a technique called shadowing. The Python version remained the behavioral reference, even as new features changed what Rust had to match. Source
There was another complication: Claude can produce different replies to the same input. Calling the model twice would make ordinary variation hard to distinguish from migration bugs. Instead, Anthropic ran the model once and replayed its output to Rust, comparing processing stages before and after the model call. The system also had to ensure each request counted only once toward customer limits and billing. Source
The company says engineers worked without reading customer request or reply text during these comparisons. Instead, they recorded where each mismatch occurred and the lengths of the Python and Rust prompt pieces being compared. Grouped records became bug “fingerprints” that Claude agents could investigate using synthetic requests they wrote themselves. Source
Agents reproduced suspected bugs in sandboxes, proposed fixes and added regression tests. Human engineers reviewed fixes before they entered the slower verification loop, which checked whether the corresponding mismatches disappeared on shadowed production traffic. Review lessons also became shared notes, tests and automated checks. Source
An agent fixed a missing web-search tool description by copying its text into files. The local checker passed it. An engineer rejected it: Rust still needed to retrieve the description from the internal service that supplied it. The checker got its matching text; the engineer still needed working plumbing. Source
“A verifier can tell an agent whether the outputs matched, but not whether the fix is good enough to ship,” Anthropic writes. A green checkmark still wasn’t a release manager. Source
Comments