Anthropic’s engineering team has published an account of moving the Claude Messages API from Python to Rust. Its 25 November report centres on a problem that will be familiar to anyone who has replaced a widely used service: the contract includes behaviour that never made it into the documentation. Claude could produce substantial parts of a port, but engineers still had to establish that the new implementation understood and answered real requests the way the old one did.

The company divided that problem into checks it could run repeatedly. Existing tests provided a starting point. Comparisons with the Python service exposed differences in behaviour that those tests did not cover. The production implementation also kept changing as Anthropic released models and shipped features. Every new change was another reason for the two versions to drift while the migration was underway.

When the tests move with the code

Anthropic had about 700 integration tests. The tests could send requests, inspect replies and check what the API passed to services such as billing and rate limiting. Some were coupled to the Python process and used in-memory substitutes for services. Porting those tests meant changing the machinery that judged the work as well as the work being judged.

An audit found more than 100 assertions that had become weaker in the port, according to Anthropic. A test may still have the same name and report success after it stops checking an important detail. That failure is easy to miss if reviewers focus on whether the suite is green. It is especially relevant when the tool translating the service also helps translate the tests. Both changes can carry the same misunderstanding.

A second issue was coverage. Features can interact in production in combinations no one thought to write down. A few options for response streaming, tool definitions and model configuration can quickly produce more cases than a team has time to exercise systematically. A test suite can show that expected behaviours are present, while traffic comparisons can reveal behaviours that callers depend on without explicitly documenting them.

Comparing the request before inference

Anthropic says the Messages API validates the incoming request, prepares the input that a model will see and applies related checks. On the way out it assembles the stream into elements such as text, thinking or tool calls and accounts for usage. A difference before inference can quietly change what the model is being asked. A difference afterwards can leave a client with a stream it reads differently, even if it originated with the same model output.

The team compared results from the old and new versions in a practice often called shadowing. The production service remained a reference while engineers observed where the replacement disagreed. For output handling, sharing the underlying model result gives a comparison a much firmer basis than making two independent calls and comparing free-form text. It also focuses attention on the API’s responsibilities instead of attributing every difference to the service migration.

Anthropic describes differences small enough to escape a casual demonstration, including parts of a prompt that were left out, whitespace changes and missing usage fields. Anyone maintaining a client library will recognise why those details matter. An application could rely on a field for cost reconciliation or assemble fragments of a response in a particular order. A human reading the finished answer might never notice the integration has lost something.

The reference service was still being built

A rewrite is simpler when the team can decide what behaviour it intends to preserve and freeze the old system while it works. Anthropic did not have a static reference. The Python implementation remained responsible for a platform that was adding features. New behaviour could arrive while the migration team was still working through earlier discrepancies.

That is a useful reason to keep a comparison running through the migration. One successful parity review can say that particular inputs agreed at a particular point in time. Continuous comparisons can expose new gaps as the reference changes. The team still needs someone who can decide whether a difference is a defect, an intentional correction or an ambiguity in the existing contract.

The part of the job to plan first

The report offers a practical prompt for teams considering an AI-assisted rewrite. Before committing to a new implementation, decide which parts of the system have an independent definition of correctness. A stable protocol or canonical examples may cover some of the service. For other parts, the old implementation and the experience of the people operating it may be the best available record. Those checks take engineering effort regardless of how much code an assistant can write.

A credible migration plan can also name the differences a team will inspect directly. Whether a request is accepted, what goes into the model, what a streaming client receives and how usage is counted are separate questions. Answering them at the right layer makes failures easier to locate. Anthropic’s account is useful because it describes the verification work in enough detail to make that division visible.