Editorial illustration of Anthropic's Claude Messages API migrating from Python to Rust through verified production traffic
Anthropic's production Messages API migration from Python to Rust used staged verification and human review.

Anthropic Rewrites Claude’s Core API in Rust With AI Agents

BENGALURU, India — November 26, 2026, 7:54 p.m. IST — Anthropic has moved the production API that connects customers and its own applications to Claude from Python to Rust, using AI coding agents, shadow traffic and human review to verify that the rewritten service behaved like the system it replaced.

The company said the migration cut CPU use per request by about 70%, reduced memory use per request by more than 80% and lowered median time to first token by roughly 20% for the Claude Code traffic it measured. Claude produced an initial version of the core request path in about a week, but Anthropic’s account makes clear that generating the code was the easy part. Establishing production parity took months of instrumentation, controlled comparison and review.

That distinction matters for platform and DevOps teams evaluating AI-assisted modernization. Anthropic did not present the project as evidence that agents can safely rewrite critical services on their own. Its central finding was narrower: when code generation becomes faster, verification, rollout design and operational evidence become the limiting factors.

What Anthropic confirmed

Anthropic built the Messages API in 2023. The service validates requests, converts them into model prompts, tokenizes inputs, runs safety checks, streams model output and counts usage for limits and billing. Traffic grew by roughly 1,800 times from early 2024 to autumn 2026, according to the company’s engineering report published November 25.

An earlier partial rewrite moved only output parsing into Rust and reduced CPU use by about 8% to 10%. Anthropic said the hybrid design also forced each generated token to cross the Python-Rust boundary three times. The team then chose a broader rewrite in which Python handed off the request and Rust handled the remaining path around the model.

The new implementation initially looked stronger in conventional testing than it did against real traffic. In April, it passed about 98% of roughly 700 integration tests, but only about one-quarter of compared production inputs matched the Python service. Anthropic later found more than 100 weakened assertions in tests that had been ported with Claude’s help.

Diagram showing nested verification loops for an AI-assisted Python-to-Rust API migration
Anthropic’s migration used a fast sandbox loop, a slower production-shadow loop and a memory loop that turned review findings into reusable rules and checks.

Production traffic became the verifier

To close that gap, Anthropic used the existing Python service as an oracle. Requests were processed by both implementations, with checkpoints comparing each stage before and after the model call. Because model responses are nondeterministic, the system invoked Claude once and replayed the same output through Rust instead of making a second model call.

The comparison also had to avoid double-counting customer usage or billing. Anthropic said it did not read customer prompts or responses during this process. Instead, it recorded the location and shape of each mismatch, including the processing step, the size difference and the first differing byte. Similar records were grouped into fingerprints that agents could investigate without seeing customer content.

A coordinating agent checked for new mismatch patterns every 10 to 30 minutes and assigned worker agents to reproduce and fix them. Each worker used a sandbox containing both codebases and fast local checks. Proposed fixes then crossed a human review gate before deployment to a slower outer loop that tested them against shadowed production traffic.

The human gate was material, not ceremonial. Anthropic described one case in which an agent made prompts match by copying a web-search tool description into a file. The verifier rewarded the parity, but an engineer rejected the change because the production-ready design still needed to fetch the description from its source service.

Why this matters for DevOps and platform teams

The practical pattern is familiar to experienced reliability teams: run the legacy and candidate paths side by side, compare results, isolate mismatches and shift traffic gradually. GitHub documented a similar production-comparison approach in its Scientist framework, while warning that shadow execution is unsafe for operations with side effects unless those effects are carefully controlled.

AI agents change the economics of that pattern by making it cheaper to investigate many small differences and propose fixes. They do not remove the need for independent signals. Teams considering a comparable migration should focus first on deterministic checkpoints, replayable inputs, privacy-preserving mismatch records, reversible traffic shifts and review gates for changes that satisfy a metric while violating the intended architecture.

For CI/CD owners, the report also argues for separating agent-generated code from agent-generated evidence. A green test suite is weaker when the same agent has modified both the implementation and its tests. Independent contract tests, production shadowing, canary analysis and explicit approval policies provide stronger boundaries. GravityDevOps’ guides to CI/CD tool selection and LLMOps offer broader context for those controls.

The performance claims need context

Anthropic’s reported gains are substantial, but they are company measurements rather than an independent benchmark. The Next Web independently reported the migration, but the underlying performance figures still come from Anthropic. The CPU figure came from one region, the memory figure covered production more broadly, and the latency comparison focused on Claude Code requests over a shorter period. The report does not provide enough workload detail to generalize those percentages to other APIs or Python-to-Rust migrations.

The migration also highlights a trade-off in using a legacy service as the definition of correctness. Exact parity can preserve quirks or unintended behavior along with valid contracts. Human reviewers still had to decide whether a mismatch represented a defect in Rust, a deliberate change or behavior that should not be carried forward.

Anthropic says the public Messages API now runs on the Rust implementation without taking the service offline or freezing feature work. The current Messages API documentation continues to expose the same request-and-response interface to developers. For operators, that continuity is the key outcome: the language changed underneath, while the external contract remained stable enough to move live traffic.

Bottom line

Anthropic’s migration is a concrete production example of AI agents accelerating a large rewrite without eliminating engineering judgment. The reusable lesson is not that an agent can produce a new service quickly. It is that safe modernization depends on building verifiers, privacy controls, staged rollouts and human decision points that are stronger than the code generator.

Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply

    Your email address will not be published. Required fields are marked *