Cole Medin breaks down Anthropic’s account of moving its Messages API from Python to Rust with Claude Code. The first draft came quickly. Checking that it behaved like the old service took much longer.

Why the tests gave a false sense of parity

  • Anthropic says the early Rust API passed about 98% of its tests, yet only about a quarter of inputs matched on the production traffic it compared.
  • The tests changed along with the implementation. An audit found more than 100 weakened assertions in the ported suite.

Make the live system a verifier

  • Anthropic compared Python and Rust at checkpoints on either side of the model call. It ran the model once and replayed that output to Rust, keeping billing and limits single-counted.
  • Difference records used clues such as the affected step, lengths and first differing byte. Grouping those clues kept one common bug from flooding agents with duplicate work, without giving them raw customer text.

Check each fix twice

  • In a sandbox, agents wrote their own examples, reproduced the difference, proposed a fix and added a regression test.
  • Engineers reviewed the pull request before the fix reached shadowed traffic. With and without the fix, compare similar requests to see whether the difference is gone.
  • A fix can pass the verifier and still be wrong to ship. An engineer rejected a shortcut that copied a tool description into files when the production design required loading it from a service.

Turn repeated corrections into rules

  • The memory loop turned review decisions into guidance, lint rules and checks. An engineer edited and approved guidance proposed from about 60 review comments.
  • Medin’s smaller-scale version starts with direct user feedback or a reviewer’s test. Put it where the agent can act on it and keep human review at the point of release.
  • In the engineering write-up, Anthropic reports about 70% less CPU use per request and about 20% lower median time to first token for customer Claude Code requests over the window shown. These are results for this migration.

“Verification is the new bottleneck.”