Anthropic migrated Messages API to Rust with no Rust developers
The Messages API, which serves as the primary interface for customers and Anthropic's own applications, migrated from Python to Rust between early 2024 and fall 2026. The decision to rewrite the API in Rust aimed to achieve significant performance improvements, such as using 70% less CPU per request and cutting the median time to first token by about 20%.
However, the migration posed challenges in verifying the Rust API's performance and functionality compared to the Python version, as the Python API continued to evolve throughout the migration process. This made it difficult to establish a reliable method for ensuring the Rust API remained at parity with the production API. To address this challenge, Anthropic turned the production Messages API itself into a verifier, enabling them to test the new Rust version on production traffic and automatically dispatch agents to fix any discrepancies.
This approach allowed for the successful deployment of the Rust-based API without downtime or freezing feature development.
Rewritten by urgent.news; may contain errors — check the original.
Source: anthropic.com