When Anthropic decided to port its Messages API from Python to Rust, Claude wrote the code in about a week. But proving the newly introduced system worked as well as the old one, post-migration, was the real project.
Anthropic engineers addressed this validation problem by turning the production Messages API itself into a verifier. It tested the new Rust version on production traffic, identified where it differed, and automatically sent out agents to fix those differences.
The fresh Rust-based API now uses about 70% less CPU per request, 80% less memory, and cuts median time to first token by about 20%, a change achieved without ever taking the service offline or freezing feature development, the tech giant stated.
The project revealed that it’s feasible to migrate production systems with Claude without taking an API offline or slowing development, Anthropic’s engineering team noted in a latest blog post.
“Now that the hard part is no longer writing upcoming code, we need to build sufficient confidence that the new system behaves like the old one,” they wrote.
The Anthropic team released the Messages API in 2023 as a simple Python “request forwarder.” It is the primary way both customers and its own internal apps reach Claude.
It has been revealed that but Claude has subsequently experienced monumental growth; from early 2024 to fall 2026, API traffic grew by more than 1,800 times, according to the Anthropic engineers. As the model became more and more capable and further integrated with codebases, it also developed shared dependencies with Python libraries. By late 2025, every request had to be validated, converted into a prompt, tokenized, and screened by safety classifiers; tokens sent in reply had to be sorted into text, thinking, and tool calls. Python added overhead to each step.
“Traffic eventually grew far beyond what the initial Python service was built for, and we quickly needed to find a way to make the service much more efficient,” the engineers explained.
But full rewrites of production systems must be approached cautiously, so the team started by rewriting the parts slowing the system down, but incremental improvements in CPU usage didn’t justify the added complexity of rewriting code.
It has been revealed that however, by May 2026, Claude was essentially building itself, writing more than 80% of the code that Anthropic merged, lowering the barrier to undertaking a full migration. Claude itself could thus help improve the production system.
The biggest glitch with this, however, was verification. In live environments, Claude’s results can be difficult to check for a number of reasons, from constant Python changes to privacy limits to nondeterministic replies. Without a reliable way to check outputs, a fast AI-written migration was hard to trust.
“Verification, not generation, had become the bottleneck,” the Anthropic engineers wrote.
Recent findings suggest that this meant defining what “correct” actually meant. Because Anthropic was shipping upcoming models and features all the time, that definition was difficult to pin down.
The team had about 700 existing integration tests, but ultimately found them to be inadequate; they were incomplete and coupled with Python implementations, meaning some tests were incorrectly passed.
They then switched to shadowing, which involved running requests through both old and upcoming code and comparing the results. This eventually produced a small record of each Python/Rust difference that described what differed and where, and shared no customer content. That record was then passed to an agent to reconcile.
That noted, though, each request that differed left a record in their logs, and a single bug could produce hundreds of thousands of nearly identical “diff records” indicating what had changed, without compromising user privacy.
To tackle these bugs, the team set up verification loops: A fast inner loop giving agents a sandbox to test ideas, propose fixes, and fail safely; a slower outer loop to validate fixes in production; and a memory loop that recorded any mistakes along the way and saved them so agents could learn over time.
In a recent development, the inner loop received a request, debugged differences, and proposed fixes. This process took less than a second. The outer loop then caught problems the inner loop had missed, comparing Rust API deployments with and without each fix.
According to recent reports, “The inner loop simulated production rapidly but imperfectly: Agents could test a hypothesis in seconds, but only on requests they had written,” the Anthropic engineers wrote. “With a local verifier, that wasn’t always configured exactly like production.”.
In the memory loop, the results of human testers’ subsequent reviews and the agents’ work were then recorded and applied to every agent that followed. For instance, when an engineer turned down a web search shortcut, the agent saved a note to memory explaining the decision, the reason for it, and the correct fix.
“The inner and outer loops fixed one difference at a time,” the engineers explained. “The memory loop improved how agents made those fixes.”.
In their post, the engineers outlined several key takeaways from the process:.
The engineers explained: “As Claude grew more intelligent (and as we grew more intelligent at working with it), we evolved from directing Claude to Claude directing itself, relying on humans mainly for key judgment calls.”.
