Anthropic moved its Messages API from Python to Rust. The Messages API is how customer apps send requests to Claude and receive replies. Claude itself did not move to Rust.
Claude helped write the new version. But writing the code was only part of the job. Anthropic also had to prove that the new service behaved like the old one while the old service kept changing.
The main lesson: AI can help write code quickly. The harder problem is checking that the code does the right thing.
Why change the service?
At first, the Messages API did little more than pass requests to Claude and return replies. Over time, it took on more work. It checked requests, prepared text for the model, applied safety checks, handled replies, and tracked usage.
Anthropic says requests to its API grew about 1,800 times between early 2024 and fall 2026. At that scale, Python’s extra work for every request added up. The team wanted the service to use less computer power and memory.
Why a small rewrite was not enough
The team first moved one part of the service to Rust. It reduced processor use by about 8–10%, but the rest of the service still ran in Python. Every piece of the model’s reply had to pass between the two languages several times. That added complexity and extra work.
The team moved the whole request-handling path to Rust. The model stayed the same. Speeding up one part does not always make the whole system faster. The connections between parts matter too.
Why tests were not enough
Anthropic had about 700 tests. Many were tied to the Python version. When the tests were changed for Rust, some checks became weaker. A review found more than 100 weakened checks.
In April, the Rust service passed about 98% of its tests. But on real requests, it prepared the same input for the model as Python in only about one quarter of cases. Tests checked selected examples. Real requests showed the team what customers actually sent.
How Anthropic checked the new service
Anthropic used the Python service as a reference. It checked whether both versions made the same choices, prepared the same input for Claude, and handled replies in the same way.
This method is called shadow testing. The new version checks a copy of a real request while the live system still handles the customer’s request.
Loading diagram…
The model can give different replies to the same request. Anthropic called it once, then gave that reply to both versions. This avoided mixing model changes with service bugs. It also avoided counting a request twice for customer limits or billing.
Anthropic did not need to read customer messages to find many differences. It recorded where a difference appeared and how large it was, without saving the message itself. Similar differences could then be grouped and investigated together.
How agents and engineers fixed problems
An agent tried to find the cause of each difference. It made a test request, tried a fix in a safe workspace, and checked whether both versions now behaved the same. The check took less than a second.
An engineer reviewed each fix before Anthropic checked it against copies of real requests. The new service handled these copies without replying to customers. If the difference remained, the agent tried again.
Loading diagram…
Engineers also saved useful corrections as instructions and tests. For example, an agent found a shortcut that made a check pass. An engineer rejected it because it would not work in the live service.
What changed, according to Anthropic
Anthropic reports about 70% less processor use and more than 80% less memory per request after the move to Rust. It also reports about 20% less time before Claude Code starts sending a reply. This is called time to first token. A token is a small piece of text in a reply. The median is the middle result when response times are ordered.
Loading diagram…
The memory bar is set to 20 because Anthropic reports a reduction of more than 80%. The actual value is lower. Each metric starts at its own value of 100. The measurements also use different scopes: processor use was measured in one region, memory across the live service, and first-token time for Claude Code requests over a shorter period.
On the requests it compared, Rust prepared inputs that matched Python 99.6% of the time. That is strong evidence for those requests. It does not prove that every possible request behaved identically.
What other teams can learn
Before a large rewrite, decide how you will tell whether the new version is correct. Tests may be enough for some projects. If they miss important real-world behavior, compare the new version with the old one.
Give agents a safe place to try fixes. Check promising fixes against real use. Have an engineer decide whether each fix is sound. Faster code writing helps, but clear checks make the result trustworthy.