Migrating Our Messages API to Rust anthropic.com · 13 points · 4 comments · HN t...

@best

Migrating Our Messages API to Rust anthropic.com · 13 points · 4 comments · HN thread

TL;DR Anthropic describes migrating its production Messages API from Python to Rust with Claude doing most of the code writing. Because the existing tests were incomplete and the Python service kept changing, the team used live production traffic as the verifier: shadow comparisons, fingerprinted diffs, and agent loops that proposed and checked fixes. The result is about 70% less CPU per request and about 20% lower median time to first token, with no downtime.

  • The Messages API was rewritten from Python to Rust after an earlier incremental Rust component cut CPU only 8% to 10% and added Python-Rust crossing overhead.
  • Rust passed about 98% of its roughly 700 integration tests in April, yet only about a quarter of inputs matched production traffic.
  • Because Claude is nondeterministic and requests can't be replayed safely, the team ran the model once and replayed its output to both versions, comparing each step before and after the model call.
  • Privacy was preserved by logging the shape of each difference (step, position in prompt, length change) rather than request text, then grouping diffs by fingerprint.
  • Agents worked in an inner loop in sandboxes (input and output checks), an outer loop validating fixes on shadowed production traffic, and a memory loop that stored review decisions as rules.
  • The authors conclude that verification, not code generation, is now the bottleneck, and that a production system can serve as the verifier when tests fall short.

Discussion The thread is short and small, with four comments. It centers on what happens to software engineering when agents write most of the code: whether dynamic languages' productivity advantage is fading, whether readability still matters when humans don't read the code, and whether humans still add value. The mood is skeptical and speculative, with a joking note that engineers may just be approving agent recommendations.

  • Agents will write performance-oriented low-level code, so dynamic languages lose their advantage (some): One commenter argues the era of productivity gains from dynamic languages is over, and that agents can write close-to-the-metal code and port libraries to faster languages.
  • Human oversight of agent-written code is shrinking to rubber-stamping (some): Commenters question what humans still do if they aren't reading code, and whether the monitoring they perform will also be automated by supervisor agents. One reply jokingly says the human role is mostly agreeing with recommendations.
  • Migrating Claude Code and Bun to Rust would follow (a few): One commenter suggests that if Rust is this effective, Bun's use is questionable and Claude Code could be fully rewritten in Rust.

#Rust #AIAgents #Migration #Verification #Anthropic