Anthropic is migrating the Messages API from Python to Rust
The story so far
Anthropic has rewritten the Messages API that carries all Claude tokens from Python to Rust. The new version reduces CPU usage per request by about 70% and shortens the median time for the first token by about 20%. During the migration, the service remained online, and feature development was not frozen. Katelyn Lesse, Anthropic's platform engineering lead, stated that the team completed the rewrite in about five months. The new system was tested against the old system with shadow traffic until the responses were consistent. Engineers only reviewed about 20% of the generation code. Anthropic said that since they could not read user requests and Claude's responses, the team could not directly see the differences between the Rust and Python versions. Therefore, they used the production environment's Messages API itself as a validator, testing the new version with production traffic, identifying differences, and automatically deploying proxy fixes. Fixes must be reviewed via PR before entering the outer process.
AI-written from the reports · Updated 8 days ago
Developments
2 developments
- 26 Nov, 01:31 · 1 reportsHow Anthropic builds software in 2026 with Katelyn LessePragmatic Engineer:How Anthropic builds software in 2026 with Katelyn Lesse
- 25 Nov, 08:00 · 1 reportsMigrating our Messages API to RustAnthropic Research:Migrating our Messages API to Rust
Coverage timeline
Follow the coverage to see every side of the story.
- Pragmatic EngineerFeaturedHow Anthropic builds software in 2026 with Katelyn Lesse
The Pragmatic Engineer podcast features a conversation with Katelyn Lesse, the Platform Engineering lead at Anthropic, introducing Anthropic's software engineering practices. She mentions that the team spent about five months rewriting the Messages API, which handles all Claude tokens, from a Python single unit to Rust, allowing the new system to run in shadow traffic against the old system until responses were consistent, with engineers only reviewing about 20% of the generation code.
- Anthropic ResearchFeaturedMigrating our Messages API to Rust
Anthropic has migrated the Messages API from Python to Rust. The new version reduces CPU usage per request by about 70% and shortens the median time for the first token by about 20%. The service remained online and feature development was not frozen during the migration.
Heat over time
- Now
- 3
- Peak
- 327 Nov, 17:00
- 24h change
- –
Hover or tap the chart to see each hour; use the arrow keys on a keyboard.