Software Engineering
AI-Powered API Migration Tool Shows 77% Success Rate with Complete Behavioral Contracts
Researchers evaluate GhostAPI-V, a system that guides code repair during API version transitions by combining human-audited contracts with AI-generated diagnostics.
When software libraries release new versions, developers must update their code to work with the latest APIs—a time-consuming process known as API migration. A new research study examines how well AI agents can automate this repair work when guided by explicit, audited specifications of what changes are required.
The Challenge of API Modernization#
Migrating to a new API version means more than simply updating a function call. Developers must understand which old patterns are no longer allowed, what new patterns are required, and how legacy code differs from target-version code. This manual process is error-prone and tedious, especially in large codebases.
GhostAPI-V: Structured Contracts for Code Repair#
Researchers developed GhostAPI-V, a system that frames API migration obligations as temporal contracts—human-audited specifications describing what must change. Rather than leaving AI agents to guess, the tool provides them with candidate-specific diagnostics and validates repairs against independent behavioral tests.
The team tested two AI code-generation models—Claude Code and Codex—on 48 internal API migrations from eight Python repositories. Each model attempted each migration twice, with five different revision scenarios that varied the feedback provided.
Measuring Success Through Test-Driven Validation#
The results showed clear improvement as the feedback became more comprehensive:
- Raw version-difference feedback alone: 62.5% success rate (120 of 192 attempts)
- Required-only contracts: 67.7% success (130 of 192)
- Full bidirectional contracts: 77.1% success (148 of 192)
Full bidirectional contracts—which specify both what must be removed and what must be added—outperformed raw version feedback by 14.6 percentage points and required-only contracts by 9.4 points. The improvement held consistently across all eight tested repositories.
What Remains Unclear#
Despite the gains, the research exposed tensions between symbolic and behavioral verification. The researchers note that human interpretation, how obligations are worded, and the checking process itself remain intertwined—suggesting that completely automating API migration may still require human judgment to handle edge cases and ambiguous specifications.