Get the app

Anthropic moves Messages API from Python to Rust with AI help

Covered by 2 sources
Read onAnthropic News· 20 min
Anthropic migrated its Messages API from Python to Rust using Claude AI agents, cutting CPU use by 70% and speeding response times by 20%. They ensured the new Rust API matched the evolving Python version by testing with live production traffic and automated fixes, all without service interruptions.

What happened

Anthropic migrated its Messages API from Python to Rust to accommodate a sharp rise in usage, with traffic increasing by 1,800 times between early 2024 and fall 2026. The transition was carried out using Anthropic's Claude AI agents, which assisted in rewriting the API. To ensure the new Rust version matched the behavior of the evolving Python system, Anthropic developed a method to compare outputs using live production traffic and automated fixes. The migration was completed without service interruptions or halting feature development.

Key details

  • API traffic increased 1,800 times from early 2024 to fall 2026.
  • The Rust rewrite resulted in approximately 70% lower CPU usage per request.
  • Median response times improved by about 20% after the migration.
  • Claude AI agents generated the majority of the new Rust code.
  • A custom verification system compared outputs from both Python and Rust APIs using production data.

Why it matters

Anthropic customers and internal users now experience faster and more efficient API responses, with lower resource consumption on Anthropic's infrastructure. The migration allows Anthropic to handle much higher traffic volumes without increasing hardware costs or causing service downtime. Developers at Anthropic can continue to update and improve the API without being constrained by the limitations of the previous Python implementation.

Also covered by 1 source


More in Dev