AI Engineering
#Anthropic
#Rust
#AI agents
#API migration

Anthropic Says Rust Rewrite Cut API Compute Use

Makzit AI News·Source: anthropic.com··4 min read
A conceptual editorial scene illustrating "Anthropic Says Rust Rewrite Cut API Compute Use" (AI Engineering) — Anthropic reports that production comparisons helped verify a Rust rewrite of its Messages API, which the com

Anthropic reports that production comparisons helped verify a Rust rewrite of its Messages API, which the company says reduced CPU use and first-token latency.

What happened

Anthropic says it replaced the core request-handling path of its Messages API, moving it from Python to Rust. The service carries requests from customers and Anthropic products, including Claude Code and Cowork. The company says API traffic on its platform increased roughly 1,800-fold from early 2024 to fall 2026, creating pressure to make the service more efficient. Anthropic

The company’s account says Claude produced an initial implementation in about a week, but proving that it matched the live service took longer. The Python system continued to evolve during the project, model responses could vary, and Anthropic says it could not inspect customer requests to diagnose differences. Its existing integration tests were also imperfect: an audit found more than 100 assertions had been weakened during the port. In April, Anthropic says the Rust version passed about 98% of tests, while only around one-quarter of compared production inputs matched. Anthropic

To compare behavior without examining request or response text, Anthropic recorded characteristics such as where a discrepancy arose and its size. It grouped recurring patterns so agents could investigate distinct issues rather than process repeated records individually. Agents explored fixes in isolated workspaces; engineers reviewed proposed changes before they moved into a slower production-shadowing check. The company also says it replayed a single model output through both versions, avoiding a second model call and preventing duplicate effects on billing or usage limits. Anthropic

Anthropic reports that the completed Rust service used about 70% less CPU per request and lowered median time to first token by about 20%. These performance figures come from the company and are not independently verified in the source material. Anthropic

Why it matters

The account highlights that producing replacement code and establishing its correctness are separate tasks. A test suite can miss real-world combinations, and tests changed alongside a rewrite may no longer provide an independent check. Anthropic’s reported difference between test performance and production comparisons illustrates why a high pass rate alone may not demonstrate equivalent behavior in a live service. Anthropic

The company’s approach treats verification as a continuing part of agent-assisted development: compare implementations, group failures, test proposed remedies away from users, and retain human judgment at review points. That distinction is relevant to teams considering coding agents for infrastructure work. Automation can speed investigation, but a matching output does not by itself establish that a proposed change is appropriate to ship. Anthropic

Practical impact

For API users, the reported reductions could mean lower computing overhead for Anthropic and less time waiting for a response to begin. Anthropic says it completed the move without taking the service offline or pausing feature work. For developers maintaining other services, the described method offers a practical pattern: compare old and new implementations against live requests, keep diagnostic records that omit sensitive content, and isolate agent experiments until people review the proposed changes. Anthropic

Limitations

This report relies on a single source: Anthropic’s engineering post. Its account of the migration, rollout and performance results therefore cannot be independently corroborated here. The source does not provide underlying CPU or latency measurements, absolute values, or enough detail to judge variation across request types. Privacy-preserving diagnostics also limited what agents could see; Anthropic says they had to devise their own examples to reproduce discrepancies. The post describes one internal service, so it does not establish that the same process or gains would apply elsewhere. Anthropic

Sources

Automated Report: This article was drafted with AI assistance based on the sources below. There is no human review step.

Sources & Citations

Comments

Sign in to join the conversation.

Loading comments…