What happens when an AI company asks its own AI to rebuild the software that keeps its business running?
Anthropic just gave us an answer. In a November 25 engineering report, the company revealed how it used Claude agents to rebuild its Messages API, the service that connects customers and applications like Claude Code and Cowork to its AI models.
Anthropic says the rewrite resulted in:
- Around 70% less CPU usage per request.
- Over 80% less memory usage per request.
- A 20% reduction in median time to first token (how long users wait before Claude starts responding) for customer Claude Code requests.
And throughout the migration, customers could continue using Claude while Anthropic kept releasing new features.
The really interesting part? Claude took about a week to write the first version of the API's core request path. Figuring out whether it actually worked took months.
Why did Anthropic need a new API?
When Anthropic built its Messages API in 2023, it used Python, a programming language its researchers were already familiar with. Back then, the API had a relatively simple job: send requests to Claude and return its responses.
But as Claude gained more capabilities, the API had more work to do. It had to process increasingly complex requests, run safety checks, and handle tool calls.
Meanwhile, API traffic grew roughly 1,800 times between early 2024 and fall 2026.
Anthropic turned to Rust, a programming language known for its performance and memory efficiency. The engineering team initially tried rewriting a small portion of the API in Rust, but the performance improvements weren't enough to justify the added complexity.
As Claude got better at coding, Anthropic began to reconsider whether it could pull off a full rewrite.
Claude passed 98% of its tests. So what went wrong?
Here's where things get interesting. By April 2026, the new Rust API was passing around 98% of its tests. You'd probably feel pretty confident about those results, right?
Well, when Anthropic compared how the old and new APIs processed real requests before they reached Claude's models, only about a quarter of the inputs matched.
Engineers also discovered that over 100 test assertions (the conditions that determine whether a test passes) had been weakened during the migration.
The team needed to find out how the new API behaved under real-world conditions.
Anthropic used a technique called traffic shadowing, where engineers run the same requests through an existing system and its potential replacement to compare their behavior. Software engineers have used similar approaches for years to reduce the risks of changing live systems.
Since Claude can give different answers to the same question, Anthropic ran the AI model only once and shared its output between the two API implementations. The team also recorded where differences occurred rather than examining customers' conversations.
Whenever the system discovered a new type of bug, a coordinating Claude agent assigned another agent to investigate. The agent could recreate the problem in a separate testing environment, experiment with fixes, and send its proposed solution to an engineer for review.
Claude still needed someone to tell it when a fix was a bad idea
At one point, an agent discovered that the new API was missing the description of Claude's web search tool. Its solution? Copy the missing text into local files.
The fix passed the verification check, but an engineer rejected it. The API needed to retrieve the description from an internal service, so the proposed workaround would eventually have to be replaced.
What Anthropic did next is worth paying attention to. The team saved the engineer's feedback as an instruction for future agents. When other agents encountered variations of the same problem, they recognized it and avoided proposing another temporary fix.
Over time, engineers spent less time chasing individual bugs and more time developing the rules and automated checks that guided Claude's work.
Could this make expensive software rewrites more affordable?
Think about how many businesses are still running software built a decade or two ago because replacing it would cost too much or disrupt their operations.
AI coding agents could give those companies more options.
Anthropic's API migration follows other ambitious projects, including the rewrite of the Bun JavaScript runtime from Zig to Rust. Anthropic has also published guidance for running large-scale code migrations with Claude.
Of course, companies would still need engineers who understand their existing software and can establish whether its replacement behaves as expected. Anthropic spent months developing ways for Claude to check its own work before the company could trust the new API with customer traffic.
We've previously covered how Claude Code can build its own workflows around a task. Anthropic's API migration gives us a glimpse of how far companies could take this approach.
For businesses that have spent years putting off expensive software upgrades, the prospect of handing much of the coding work to AI agents could finally put those projects back on the table.