Skip to content
Rush Commerce
Software & Dev3 min read

Anthropic moved its API to Rust with the old Python as the judge

Anthropic rewrote its Messages API from Python to Rust with Claude agents and used live Python output as the verifier. 70% less CPU. The method is what to copy.

Anthropic rewrote its Messages API in Rust, and the old Python service checked the work. In an engineering post published today, Anthropic explains how Claude agents ported the API that serves Claude Code and every API customer. Rust has served public traffic since September 2026. The interesting part is not the language. Its tests said the new code was ready long before it was, and production showed the gap.

What actually happened

From Anthropic's post:

  • Why. The API was built in Python in 2023. Traffic grew roughly 1,800 times from early 2024 to fall 2026, and Python added overhead at every step of each request.
  • Who wrote it. Claude agents wrote a first version of the core request path in about a week. Engineers reviewed every pull request.
  • The test suite misled them. In April the Rust API passed about 98% of roughly 700 integration tests. Only about a quarter of real production inputs produced matching output. An audit of the ported tests found more than 100 weakened assertions.
  • Production as the verifier. For each request, the model ran once and its output was replayed to Rust, so nothing was billed twice. Both versions had to match exactly at every step. Without reading customer data, each mismatch was logged as a fingerprint: the step, the first differing byte and the lengths. One bug leaves one fingerprint, so a coordinating agent was alerted only when a new one appeared.
  • Match rate. About 24% at the start, a low of 6.5% in early May, 99.6% at the end (a seven-day median).
  • Results. About 70% less CPU per request in one region, more than 80% less memory per request, and about 20% lower median time to first token on Claude Code requests. Anthropic notes that part of the latency drop came before the switch.

Anthropic is clear about the limits. The agents optimized for matching output, sometimes by "the cheapest way to produce them," so human review stayed as a gate. One engineer's rule became permanent: port exactly what Python did, never a guess.

Why it matters for your business

You might be replacing a 2014 PHP checkout or a spreadsheet full of macros that runs payroll. AI agents now make the rewrite cheap. Anthropic's post shows what is still expensive: proving the new system does what the old one did.

The method scales down:

  • The old system is the spec. Keep it running. Send the same real inputs to both and compare outputs before you cut over.
  • Do not trust a green test suite. A 98% pass rate covered about a quarter of production. Your tests describe what someone remembered, not what customers do.
  • Compare in steps. Line items, tax, shipping, totals. Find the first step that differs, not just the final number.
  • Move traffic gradually. A few customers first, with the old path kept for rollback.
  • Write down what is correct. Agents can produce the code. A person who knows the business decides when a mismatch is a bug and when it is an intended change.

Key takeaways

  • Anthropic's Messages API now runs on Rust; Claude agents wrote the port under human review
  • 98% of tests passed while only about a quarter of production inputs matched
  • Live Python output was the verifier; mismatches were grouped by fingerprint
  • About 70% less CPU and over 80% less memory per request
  • For your legacy rewrite, budget for verification, not for writing code

Replacing a system your business runs on? We migrate legacy apps with the old system running beside the new one and real orders compared side by side, so cutover is a decision based on data, not hope. See how we run migrations or tell us what you need to replace.

Sources: Anthropic engineering post.

  • #anthropic
  • #rust
  • #legacy-migration
  • #ai-coding-agents
  • #testing
TR

Tommy Rush — Founder, Rush Commerce

Operator turned builder. 15+ years running operations — now shipping the systems businesses run on. More

Get The Rush Report weekly — one email, zero fluff.