From Python to Rust: Using AI Agents to Verify API Migration

Team uses multiple Claude agents with the old Python service as oracle to parallel-track and fix Rust migration differences.
The article describes an engineering team's practice of migrating the Messages API from Python to Rust, whose highlight isn't the language conversion itself but the verification method: instead of relying on traditional test suites, the team used the existing Python service as a live oracle, having multiple Claude agent teams call old and new services in parallel, compare outputs, flag inconsistencies, and participate in fixes, with humans reviewing fix proposals. The author believes this approach delegates highly repetitive difference analysis to machines, providing a reusable human-AI collaboration paradigm for migration scenarios with clear interface contracts and automatically comparable inputs and outputs. The article also notes limitations: agent fix quality depends on prompt design and verification loops, and the tweet didn't disclose quantitative data such as migration scale, time consumed, or defect rates, making it difficult to assess efficiency gains relative to traditional testing.
From Python to Rust: A New Approach to API Migration
A engineering team recently shared on their blog their experience migrating the Messages API from Python to Rust. What makes this migration notable isn't the language conversion itself, but the verification method: instead of relying on traditional test suites, they assembled multiple Claude agent teams to compare responses between the old and new services, automatically locate and fix discrepancies.
This approach breaks away from the conventional "migration equals rewrite plus regression testing" playbook. In traditional migrations, engineers must manually write extensive test cases to cover edge conditions, whereas AI agents' parallel working mode can expose hidden differences faster. From an engineering management perspective, this essentially delegates the highly repetitive work of "difference analysis" to machines, with humans only needing to review the fix proposals submitted by agents.
According to the original tweet, the team used the existing Python service as an oracle, having the new Rust service compare against it under identical inputs. This approach isn't new in contract testing, but introducing AI agents to "trace and fix differences" represents a relatively novel practice.
How Agents Participate in Migration Verification
Parallel Comparison and Difference Localization
According to the tweet, multiple Claude agent teams were used to track differences between the two versions. Each agent team could independently handle a set of endpoints or a category of scenarios, continuously calling both old and new services and comparing outputs to flag inconsistencies. This division of labor allows difference discovery to proceed in parallel rather than waiting for serial manual investigation.
Contract Testing is a testing method oriented toward service boundaries: it establishes an executable "contract" for the interaction agreement between consumers and providers (request structure, response fields, status codes, error semantics, etc.), with both parties verifying against the contract independently, thereby discovering incompatibilities without launching a full end-to-end environment. The "using the old service as a live oracle" mentioned in the original text is essentially a Differential Testing approach: feeding the same batch of inputs to both old and new implementations simultaneously, treating any output inconsistency as a suspicious difference. Compared to manually writing test cases, differential testing's advantage is that the input space can be automatically generated or replayed from real traffic, providing broader coverage; the challenge lies in handling non-deterministic outputs (timestamps, random IDs, floating-point errors, field ordering) and establishing a set of difference normalization and priority determination rules, otherwise agents would be overwhelmed by noise differences.
Automated Fixes and Human Review
After discovering differences, agents not only report problems but also participate in fixing them. The tweet mentions they "trace and fix differences," but doesn't disclose the degree of automation in fixes or the proportion of human review. It's reasonable to infer that the team still needs to set fix boundaries to prevent agents from introducing new problems. This "AI proposes, human gatekeeps" model is relatively pragmatic in code migration.
In the "AI proposes, human gatekeeps" workflow, the key is to establish a verifiable fix loop for agents: after each modification, re-run the difference comparison, and only patches where the number of differences monotonically decreases without introducing new inconsistencies enter the human review queue. Engineering-wise, several supporting constraints are typically needed—limiting the files and functions agents can modify, requiring each patch to include difference reproduction test cases, performing static checks and formatting validation on patches (clippy, rustfmt), and maintaining complete agent operation traces in version control for traceability. This "generate—verify—filter" cycle aligns with the research paradigm in the Automated Program Repair field, and its effectiveness depends heavily on the quality of failure signals: the more precise and reproducible the difference reports, the higher the hit rate of agents locating root causes.
Implications for API Migration Practice
This migration case offers a reusable approach: when a system has a stable and reliable old version, it can serve as a live oracle, with AI agents accelerating difference convergence. This method is particularly applicable to scenarios with clear interface contracts and automatically comparable inputs and outputs. However, the quality of agent fixes still depends on prompt design and verification loops, and blindly trusting automation may introduce risks.
Based on the limited information in the tweet, the team didn't publish quantitative data such as migration scale, time consumed, or defect rates, making it difficult to assess the efficiency gains relative to traditional testing. But the strategy of "using the existing service to verify the new service" itself is worth referencing for teams planning multi-language rewrites.
Summary
The case of migrating the Messages API from Python to Rust—its highlight isn't the language choice, but the automation of the verification process. Claude agent teams took on difference tracking and fixing work, providing a new human-AI collaboration paradigm for API migration. If the team discloses more details in the future, it will help determine the applicability and practical benefits of this method.
Background Supplement
From a language perspective, migrating from Python to Rust isn't syntax translation but involves realigning several semantic models: Python's exception mechanism, dynamic typing, and garbage collection correspond in Rust to Result error propagation, compile-time type checking, and deterministic destruction under the ownership/borrowing model; Python's dictionaries and lists in Rust often require choosing different representations like HashMap, Vec, serde_json::Value, and serialization field ordering and null handling can also produce subtle deviations. Additionally, Python's GIL and async model (asyncio) differ from Rust's tokio runtime in concurrency semantics, backpressure, and cancellation behavior—these differences often don't manifest as obvious errors but appear in boundary behaviors like timeouts, retries, and ordering guarantees—precisely the areas most easily missed by differential comparison and most in need of targeted input construction.
Related articles

Cursor Renamed to Grok Build: The AI Coding Shakeup After SpaceX's Acquisition
Cursor is officially renamed GrokBuild following SpaceX's over $40 billion all-stock acquisition and product rewrite. This article covers the reasons, performance gains, naming conflicts, and impact on developers.

Free Alternatives to Paid AI Tools: An Open-Source Substitute Guide for Claude, Cursor, and ElevenLabs
Introducing GoFreeAuls, a site cataloging free open-source alternatives to paid AI tools like Claude, Cursor, and ElevenLabs, including OpenCode, ComfyUI, and Voice Studio, plus a look at the real barriers to local deployment and who it suits.

Open-Source Plugin Superpowers: Turn Claude Code and Cursor into Senior Engineers
Discover the free GitHub plugin Superpowers, which makes Claude Code and Cursor work like senior engineers: spec first, five-minute tasks, and enforced red-green TDD.