When Anthropic decided to port its Messages API from Python to Rust, Claude wrote the code in about a week. But proving the new 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 new 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 company said.
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 said in a new blog post.
“Now that the hard part is no longer writing new code, we need to build sufficient confidence that the new system behaves like the old one,” they wrote.
Verification is the bottleneck
The Anthropic team launched 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.
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.
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 issue 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.
From testing to shadowing
This meant defining what “correct” actually meant. Because Anthropic was shipping new 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 new 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 said, 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.
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.
“The inner loop simulated production quickly 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.”
What engineers learned
In their post, the engineers outlined several key takeaways from the process:
- Verification, rather than migration complexity, is the new chokepoint: Large software projects previously were hard to justify, since they carried a lot of effort and risk. Now that writing code isn’t as complex or time consuming, the constraint is now in verifying results.
- Verification is how teams gain confidence in a system: Tests or formal verifications can determine whether every step Claude takes is valid. When these checks aren’t enough, a production system itself can be a verifier.
- Verification signals should be carefully designed: Signals can be calibrated to show Claude where things went wrong. While proof assistants point to failing tests or test names, production systems offer no signal by default, so the engineers focused on building a signal in which checkpoints located each difference in the code, and fingerprints helped them tell one bug from another.
- Loops should be built so that Claude can act autonomously, and should be simple, so they scale with Claude’s capability. The engineers put human judgment “only into what counted as correct.” Otherwise, Claude was given the freedom to determine how to proceed, choosing what hypotheses to test, and how to reproduce and fix each bug. Verifiers then judged the result.
- Humans should move to outer loops: Anthropic initially had its engineers working inside the inner loop, running Claude and “chasing differences themselves.” Later, they moved to the seam between loops, where they steered agents and reviewed fixes in Slack, but the system matured and they then moved to the edge, writing rules and checks.
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 important judgment calls.”
