{"slug": "anthropic-moved-the-messages-api-to-rust-using-shadow-traffic-and-claude-agents", "title": "Anthropic Moved the Messages API to Rust Using Shadow Traffic and Claude Agents", "summary": "Anthropic published on November 25, 2026 that it moved the Messages API — the path behind Claude API, Claude Code, and Cowork traffic — from Python to Rust with no maintenance window, reporting about 70% less CPU per request and roughly 20% lower median time to first token on charted Claude Code traffic. Public traffic cut over in September 2026, and Anthropic verified parity using shadow traffic, checkpoint diffs, fingerprints, and model-output replay, with Claude agents in inner, outer, and memory loops plus engineer review fixing mismatches. Anthropic said more than 80% of merged code was written by Claude by May 2026, shifting the bottleneck from generation to verification: about 700 integration tests were coupled to Python mocks, and only about a quarter of production inputs matched at first even when 98% of tests passed in April.", "body_md": "Anthropic published on **November 25, 2026** how it moved the **[Messages API](https://docs.anthropic.com/en/api/messages?ref=explainx)** — the path behind Claude API, **Claude Code**, and **Cowork** traffic — from Python to **Rust** without a maintenance window. The company says the live Rust stack uses **about 70% less CPU per request** and cuts **median time to first token by about 20%** on charted Claude Code traffic, while feature work on Python continued through the migration. The hard part was not generating Rust code with **Claude**; it was **proving parity** on a moving target.\n\nThis article explains what [Anthropic’s research post](https://www.anthropic.com/research/migrating-api-to-rust?ref=explainx) says about **shadow traffic**, **fingerprints**, and **Claude agent verification loops**, how those numbers compare to earlier **interview claims** explainx.ai tracked in October, and what builders can reuse when they plan their own **Python-to-Rust** cutovers.\n\n| Question | Short answer | \n|---|---|\n| Is the Messages API on Rust now? | Yes — public traffic moved in **September 2026** , per Anthropic | \n| How much CPU dropped? | **~70% less CPU per request** (Anthropic production charts) | \n| Latency impact? | **~20% lower median time to first token** on charted Claude Code requests | \n| How was parity checked? | **Shadow traffic** , checkpoint diffs,**fingerprints** , model-output replay | \n| Who fixed mismatches? | **Claude agents** in inner/outer/memory loops plus engineer review | \n| Relation to Oct interview? | Same project; **official post confirms higher CPU savings** and method detail | \n\n## Why Anthropic rewrote the Messages API at all\n\nAnthropic built the Messages API in **2023** as a thin Python forwarder. By **late 2025**, each call traversed validation, prompt conversion, tokenization, safety classifiers, streaming, tool-call parsing, and billing hooks — work Python paid for on every object allocation and handoff. Internal platform traffic grew sharply; Anthropic’s post includes a chart of **monthly average API requests per day** climbing through **2026** before the Rust cutover.\n\nBar chart of Anthropic Messages API requests per day climbing through 2026 as traffic grew before the Rust migration\n*Image: [Anthropic](https://www.anthropic.com/research/migrating-api-to-rust?ref=explainx)*\n\nAn incremental fix — parsing model output in Rust but calling it from Python — trimmed only **about 8–10% CPU**, Anthropic writes, while making each token cross the language boundary **three times**. That mirrors lessons from other large **Python-to-Rust** stories explainx.ai has covered, including [OpenAI’s Habitat rewrite](https://explainx.ai/blog/openai-habitat-python-rust-rewrite-two-engineers-2026) and [GitHub Copilot’s runtime move to Rust](https://explainx.ai/blog/github-copilot-runtime-rust-migration-2026).\n\nBy **May 2026**, Anthropic says **more than 80% of merged code** was written by Claude, which reframed the bottleneck: generation got cheap, but **verification** did not.\n\n## Shadow traffic when tests cannot define “correct”\n\nAnthropic lists three sources of correctness: fixed rules (like a proof assistant), examples (test suites), or **the existing production system as an oracle**. The Messages API kept shipping new models and features, so the oracle moved. About **700 integration tests** existed, but Anthropic reports they were **coupled to Python mocks** and **incomplete across feature combinations** — only about **a quarter of production inputs matched** at first, even when **98% of tests passed** in April.\n\n**Shadowing** means running real requests through old and new code and comparing structured results. For Claude, two blockers appear immediately:\n\n1. **Billing and rate limits** — you cannot execute the model twice per customer request.\n2. **Nondeterminism** — identical prompts can yield different text, so naïve diff tools would treat model creativity as API bugs.\n\nAnthropic’s fix: **run the model once**, then **replay its output** through Python and Rust on the API path. The team compared **every stage before and after** the model call so a subtle prompt bug could not hide inside a still-plausible answer.\n\n### Privacy-preserving diffs\n\nBecause Anthropic would not read customer prompts or replies for this workflow, it logged **shapes** of differences — step names, prompt piece indexes, byte offsets, lengths — not raw text. **Checkpointing** found the first pipeline stage where Python and Rust diverged. **Fingerprints** combined step, piece, offset, and length deltas so one bug class produced the same signature across thousands of requests.\n\nThose records fed **Claude agents** without exposing user content — a pattern any regulated API team should study before copying wholesale.\n\n## Verification loops: inner, outer, and memory\n\nDiagram of Anthropic Claude agent verification loops for Messages API Rust shadow migration\n*Image: [Anthropic](https://www.anthropic.com/research/migrating-api-to-rust?ref=explainx)*\n\nAnthropic describes three nested loops:\n\n### Inner loop (seconds)\n\nAgents work in **cloud sandboxes** with both codebases. Local checks build prompts or replay scripted model replies in **under a second** without calling Claude. An agent guesses a root cause from a fingerprint, writes a reproducing request, edits Rust until outputs match, and adds a test that fails on old code.\n\n### Outer loop (hours to days)\n\nAfter human **pull request review**, fixes deploy to staging and production. **Shadow traffic** tracks whether each fingerprint disappears on new builds. When sandbox fixes pass but production shadowing still shows the signature, work returns to the inner loop.\n\n### Memory loop (rules that persist)\n\nWhen engineers reject a shortcut — Anthropic’s example is **hard-coding a web search tool description** instead of calling the live internal service — the decision becomes a **rule every later agent reads**, a repo search for the same mistake, and often a lint or test. Review comments were also distilled into **CLAUDE.md** guidance and merge gates requiring Python changes to be mirrored in Rust.\n\nAnthropic’s Slack excerpt shows the tension plainly: a verifier can prove **output match** while humans still judge **ship quality**.\n\n## What shipped: CPU, memory, and time to first token\n\nCharts showing Anthropic Messages API Rust migration cutting CPU about 70 percent and median time to first token about 20 percent\n*Image: [Anthropic](https://www.anthropic.com/research/migrating-api-to-rust?ref=explainx)*\n\nAnthropic charts three production metrics as traffic shifted from Python (gray) to Rust (blue) between **August and October 2026**:\n\n- **CPU per request** — about**70% reduction** at the measured region.\n- **Memory per request** — more than**80% reduction** across production in the charted window.\n- **Median time to first token** — about**20% reduction** on Claude Code requests in the labeled interval.\n\nThose numbers supersede the **40–50% CPU** range [Katelyn Lesse relayed on Latent Space](https://explainx.ai/blog/anthropic-messages-api-rust-rewrite-claude-wrote-code-cpu-40-50-percent-claimed-vs-verified-2026) before Anthropic’s engineering write-up. They still measure **API orchestration**, not GPU inference — your **Claude** bill is dominated by tokens, but Anthropic’s own serving cost per token dropped on the CPU side.\n\nAnthropic also notes **~1,800× growth** in API traffic from early **2024** through fall **2026** on its platform chart — context for why Python overhead became existential, similar in spirit to [OpenAI’s scale narrative on Habitat](https://explainx.ai/blog/openai-habitat-part-two-azure-cosmos-db-multi-tenancy-20m-qps-12x-faster-reads-2026).\n\n## What developers are saying\n\nThe [Hacker News thread](https://news.ycombinator.com/item?id=50644162&ref=explainx) on Anthropic’s post is small but technical:\n\n- **[hopfenspergerj](https://news.ycombinator.com/item?id=50644581&ref=explainx)** argues prompt-building is a**pure, fuzzable function** and that including live LLM generation in migration tests would be a category error — aligned with Anthropic’s replay design, though the commenter frames it as obvious systems hygiene.\n- **[lordnacho](https://news.ycombinator.com/item?id=50644599&ref=explainx)** says externalized testing against whatever AI outputs is believable coming from the lab that built the models.\n- **[hobofan](https://news.ycombinator.com/item?id=50644538&ref=explainx)** calls the headline misleading because the article does not claim**zero Rust developers** — fair critique of syndicated titles, not of the engineering content.\n\nUse those reactions as peer review prompts, not as verified metrics.\n\n## Lessons for teams planning AI-assisted rewrites\n\nAnthropic closes with principles that generalize beyond its stack:\n\n1. **Verification is the new bottleneck** when Claude or other agents write most lines.\n2. **Design the verifier signal deliberately** — checkpoints and fingerprints beat a single pass/fail bit.\n3. **Keep loops simple** — agents choose hypotheses; verifiers judge outcomes; humans own product decisions.\n4. **Move humans toward outer loops** as confidence rises — from hands-on debugging to rule-writing and architecture.\n\nIf you are comparing **agent harness** investments, pair this story with [Anthropic’s MCP download milestones](https://explainx.ai/blog/anthropic-mcp-700-million-downloads-skills-over-mcp-tasks-november-2026) and [Claude Code workshop patterns](https://explainx.ai/blog/top-claude-live-workshops-2026): the platform team is optimizing **marginal cost per API call** while developer surfaces push **faster first tokens**.\n\n### Practical checklist before you shadow production\n\n| Step | Why it matters | \n|---|---|\n| Map input and output path checkpoints | Catches prompt drift before streaming bugs surface | \n| Replay model output when LLMs are in path | Stops nondeterminism from masking API regressions | \n| Fingerprint bug classes | Keeps agent fleets from chasing duplicate diffs | \n| Reject verifier-friendly shortcuts in review | Prevents throwaway fixes that fail at launch | \n| Mirror rule changes into memory for agents | Stops repeating the same human correction | \n\n## How this fits explainx.ai’s earlier claimed-vs-verified coverage\n\nIn **October 2026** explainx.ai published [what Lesse claimed on a podcast versus what was documented](https://explainx.ai/blog/anthropic-messages-api-rust-rewrite-claude-wrote-code-cpu-40-50-percent-claimed-vs-verified-2026). The **November 25 research post** is the primary engineering source many readers were waiting for: it confirms a **larger CPU win**, documents **agent operations**, and shows **parity methodology** in enough depth to copy selectively.\n\nNothing in the post changes **Claude model cards**, **safety policy**, or **public pricing tables** on its own. Builders should read it as **infrastructure evidence** — evidence that Anthropic expects **Claude agents** to maintain **mission-critical services**, not only greenfield repos.\n\n## Related on explainx.ai\n\nOfficial docs: [Messages API reference](https://docs.anthropic.com/en/api/messages?ref=explainx) · [Anthropic research post](https://www.anthropic.com/research/migrating-api-to-rust?ref=explainx)\n\n*Specifications and deployment figures reflect Anthropic’s November 25, 2026 publication date. Re-check Anthropic’s docs and status pages before planning production cutovers.*", "url": "https://wpnews.pro/news/anthropic-moved-the-messages-api-to-rust-using-shadow-traffic-and-claude-agents", "canonical_source": "https://explainx.ai/blog/anthropic-messages-api-rust-shadowing-claude-agents-november-2026?utm_source=rss&utm_medium=feed&utm_campaign=blog", "published_at": "2026-11-25 00:00:00+00:00", "updated_at": "2026-11-26 06:14:17.644608+00:00", "lang": "en", "topics": ["artificial-intelligence", "ai-agents", "ai-infrastructure", "large-language-models", "ai-tools"], "entities": ["Anthropic", "Messages API", "Claude", "Claude Code", "Cowork", "Rust", "Python"], "also_reported_by": [], "takeaway": "Anthropic cut Messages API CPU per request by about 70% and median time to first token by about 20% by running the model once and replaying its output through shadow traffic instead of executing each request twice, after an incremental Rust-parsing fix saved only 8–10% CPU while crossing the languag", "recommendation": {"advice": "When migrating a live API to a new language, run shadow traffic with the model executed once and its output replayed, and diff fingerprints rather than raw text so nondeterminism isn't mistaken for regressions.", "playbook": "production-ops", "playbook_url": "https://wpnews.pro/playbooks/production-ops"}, "alternates": {"html": "https://wpnews.pro/news/anthropic-moved-the-messages-api-to-rust-using-shadow-traffic-and-claude-agents", "markdown": "https://wpnews.pro/news/anthropic-moved-the-messages-api-to-rust-using-shadow-traffic-and-claude-agents.md", "text": "https://wpnews.pro/news/anthropic-moved-the-messages-api-to-rust-using-shadow-traffic-and-claude-agents.txt", "jsonld": "https://wpnews.pro/news/anthropic-moved-the-messages-api-to-rust-using-shadow-traffic-and-claude-agents.jsonld"}}