Wink Pings

No One on the Team Knew Rust, and Claude Rewrote Anthropic's Messages API

Anthropic migrated the Messages API from Python to Rust, and the team initially had no Rust developers. Claude did most of the implementation, cutting CPU usage by 40% to 50% and improving time to first token by 10% to 20%. More noteworthy is the migration discipline: running both versions in parallel, comparing shadow traffic, and gradually shifting traffic, with no new features added during the rewrite.

Anthropic Messages API从Python迁移到Rust的示意图

Anthropic migrated the Messages API from Python to Rust. The team initially had no Rust developers; Claude handled most of the implementation work, while engineers were responsible for system design, migration planning, and validating the results.

Messages API is the interface service Anthropic provides for developers to call Claude. Rust is a systems programming language with strong performance and memory safety, but a steep learning curve. Moving a production API from Python to Rust usually means dealing with performance, concurrency, and stability issues.

Katelyn Lesse, head of platform engineering at Anthropic, reported the results: CPU usage for the API service dropped by roughly 40% to 50%, and time to first token improved by 10% to 20%. Lower CPU usage means the same machines can handle more requests, or costs go down. Time to first token affects how long after a user sends a request they see the first piece of output, which is noticeable in both chat and generation scenarios.

The migration method is more worth examining than the numbers. They did not directly replace the old service. Instead, they built the Rust version in parallel, ran real requests through shadow traffic, compared the outputs from the old and new versions, and then gradually shifted real traffic over. They deliberately added no new features during the rewrite. Shadow traffic can be understood as copying real requests to the new service and comparing results without directly affecting users. Gradual traffic shifting means slowly moving production traffic from the old version to the new version.

A comment from a user named Marco was blunt: rewriting a production API in a language no one on the team knows sounds reckless; shadow traffic, gradual traffic shifting, and zero new features make it boring, and boring is exactly how you ship safely. Another user, Emilio, noted that adding no new features during the rewrite is the real flex. Victor focused on discipline: running two versions in parallel and freezing features is what lets you trust code you didn't write yourself. Marius added that shadow traffic is only meaningful when the old and new versions are supposed to give the same answers.

In his reply, Mark Kretschmann said Rust is becoming the standard language for agents. That judgment is debatable. This migration at least shows that the language barrier can be partially filled in by tools. How many lines Claude wrote is not the point. Shadow traffic and gradual traffic shifting are. AI fills in the language implementation, while engineers fill in the boundaries, validation, and cutover strategy; this looks more like a reusable production migration sample.

For readers with a development background, this process is not novel; the hard part is resisting the temptation of a rewrite to freeze features and minimize variables. For ordinary users, the significance is simple too: AI can help you write in a language you're unfamiliar with, but before code goes live, you still need validation mechanisms and a cutover plan. Without those, the faster the generation, the greater the risk.

发布时间: 2026-11-02 04:40