Have a project in mind? Let's talk.

The Anthropic Messages API Rust migration is the most instructive engineering story of the month for anyone running agent workloads. Anthropic moved the API that fronts Claude, including every request from customers, Claude Code and Cowork, from a Python service to Rust. The new API uses about 70% less CPU per request and cuts median time to first token by about 20%, and it shipped without taking the service offline or freezing feature development (Anthropic).
The performance numbers are not the interesting part. The interesting part is how Anthropic convinced itself the rewrite was safe, because the method is a template any team can reuse when agents write the code.
Anthropic built the Messages API in 2023 in Python, when it was "basically a request forwarder" in one engineer's words. By late 2025 every request had to be validated, converted into a prompt, tokenized and screened by safety classifiers, and every reply had to be sorted into text, thinking and tool calls while usage was counted for limits and billing. Python added overhead to each of those steps. From early 2024 to fall 2026, traffic on the API grew roughly 1,800 times (Anthropic).
The team first tried the standard advice: rewrite only the slow parts. They moved the model-output parser to Rust and called it from Python, which cut CPU usage by about 8 to 10 percent. But each token now crossed between Python and Rust three times, and the added complexity did not justify the gains. So the question became whether a full migration was feasible. By May 2026, Claude was writing more than 80% of the code Anthropic merged, which made the generation side cheap. Verification, not generation, had become the bottleneck (Anthropic).
Three problems made "correct" hard to define. First, the Python API kept shipping new models and features throughout the project, so parity was a moving target. Second, Claude is nondeterministic, so a difference between two outputs did not necessarily mean a bug. Third, Anthropic could not read customer requests or Claude's replies for privacy reasons, so engineers could not simply look at where the two versions diverged (Anthropic).
The existing test suite could not carry the weight either. Anthropic had about 700 integration tests, but they were coupled to the Python implementation and had to change along with the code. When the team audited the ported tests, they found more than 100 weakened assertions, meaning a "pass" could hide wrong code. And the coverage math was never going to work: 20 binary options alone make over a million combinations. The most striking number in the whole post is this one: in April, the Rust API passed about 98% of its tests, yet only about a quarter of inputs matched the Python version on production traffic (Anthropic).
Anthropic's answer was to use the existing system as an oracle. Requests ran through the production Python API, and the Rust version processed them in shadow. Two design decisions made that safe: each request was counted only once toward a customer's limits and bill, and the model's reply was generated once and replayed to the Rust side, so nondeterminism could not fake a difference. Every stage before and after the model call then had to match exactly (Anthropic).
Because nobody could read request text, the system recorded only the shape of each difference. Checkpointing compared the two versions step by step, and the first step to differ showed roughly where in the code the problem lived. Within the prompt, the position and length of the first difference formed a "fingerprint" that distinguished one bug from another, so hundreds of thousands of diff records could be grouped into a manageable set of distinct issues. Each record was small, structured and free of user text (Anthropic).
A script ran every 10 to 30 minutes, grouped new records by fingerprint, and alerted a coordinating Claude agent only when a new kind appeared. The coordinator assigned a worker agent to own each new fingerprint and opened a thread in a shared Slack channel where engineers could follow along (Anthropic).
The inner loop gave each agent a cloud sandbox with both codebases and fast local checks. An input check built the prompt each version would send and compared them in under a second without calling the model; an output check ran both versions against a fake model with scripted replies. Since agents could not see the real requests, they hypothesized a cause, wrote their own request to reproduce the fingerprint, and iterated until their edit made the versions match, then added a regression test (Anthropic).
The outer loop validated fixes on shadowed production traffic. Human review sat at the seam: a fix crossed only after PR review, because a verifier can confirm outputs match but not whether a fix is good enough to ship. Anthropic's own example makes the point. An agent traced a mismatch to the web search tool description, which the Rust API did not fetch yet, and proposed copying the text into files so the prompts would match. An engineer rejected the shortcut because Rust still needed to call the real service before launch. The verifier had rewarded the cheapest way to match outputs (Anthropic).
The memory loop turned those corrections into durable rules. The rejected web search workaround became a note that later agents checked before proposing fixes. After one agent guessed at Python's behavior, an engineer made "port exactly what Python did" a rule, and an agent then found seven more places where the port had relied on a guess. In June, an agent grouped about 60 review comments into proposed rules that an engineer edited and approved for CLAUDE.md. Some lessons became permanent checks: tests that fail when Rust drifts from Python, lints that ban patterns reviewers kept flagging, and a merge check requiring matching changes in both versions or an explicit exemption (Anthropic).
Public traffic moved to Rust in September 2026, about five months after parity work began in April. The headline figures are about 70% less CPU per request and about 20% lower median time to first token, with a large drop in memory per request shown in the same chart. Anthropic's own caption is careful about scope: the CPU figure covers one region, memory covers all of production, and the time-to-first-token figure covers customers' Claude Code requests over a shorter period (Anthropic; TechRepublic).
For customers, nothing about the API contract changed; parity with the production API was the whole point of the exercise. The practical effect is a leaner, faster front door to Claude, most visible in Claude Code response times, and headroom for Anthropic to keep growing traffic that has already multiplied roughly 1,800-fold since early 2024 (Anthropic; The Next Web).
Our read: this is the first detailed public account of a frontier lab migrating a live, customer-facing service with agents doing most of the work, and the lessons transfer directly to smaller teams.
Budget for verification, not generation. Claude wrote the first version of the core request path in about a week. The following five months were verification. If your plan for an agent-written rewrite assumes the writing is the hard part, the plan is wrong. This mirrors what we see in agent evals being the real hurdle for production AI features.
Use production as the oracle when tests cannot define correct. Shadow traffic with exact-match comparison at each processing stage catches what a test suite never thought of, and weighting by live frequency tells you which bug matters. Anthropic's 98% pass rate next to 25% production parity is the cleanest demonstration of test-suite blind spots we have seen published.
Record shapes, not text. Checkpoints and fingerprints let agents triage bugs without ever reading user data. Any team handling sensitive prompts can copy this pattern: structured diff records, grouped by signature, with the raw text never leaving its lane.
Turn review corrections into rules. The memory loop is just CLAUDE.md plus discipline: every rejected fix becomes a written rule, a search for the same mistake elsewhere, and a test or lint that makes it permanent. And if latency figures matter to your agent SLOs, note that the 20% time-to-first-token improvement applies to Claude Code traffic specifically, so measure your own workloads against your AI agent SLOs before assuming the same gain.
Yes. Anthropic migrated its Messages API, the service that fronts Claude for customers, Claude Code and Cowork, from Python to Rust. Public traffic moved to the Rust version in September 2026, and the company published the migration story on November 25, 2026.
Anthropic reports about 70% less CPU per request and about 20% lower median time to first token, with a large memory reduction shown in the same chart. The caveats matter: CPU was measured in one region, and the time-to-first-token figure covers Claude Code requests over a shorter period.
No. Parity with the existing production API was the goal of the migration. The Rust version was verified against live traffic until its behavior matched the Python version, so the API contract developers build against stayed the same.
It shadowed production traffic through both versions, generated the model reply once and replayed it to the Rust side, then compared each processing stage exactly. Instead of request text, it recorded structured "fingerprints" of each difference: which step, which piece of the prompt, where it first diverged and by how much.
Generation is cheap and verification is the bottleneck. Use the production system as an oracle when tests cannot define correct behavior, put human review between agent-proposed fixes and deployment, and convert every review correction into a rule, a search for repeats, and a permanent test or lint.
Ready to take the first step towards unlocking opportunities, realizing goals, and embracing innovation? We're here and eager to connect.