API Version Migration
This loop automates the migration of API endpoints from legacy versions (e.g., v1) to the latest supported version (e.g., v2) within a codebase. It systematically identifies outdated endpoints, updates them, and validates changes through automated testing.
Goal
Upgrade all endpoints to the latest version
How to Run
Run this loop in a prompt-only environment to automatically upgrade API endpoints from v1 to v2. The agent will iterate until all v1 references are removed.
- 01
Initiate Loop Execution
Start the loop by running the kickoff prompt in your chosen coding agent environment.
- 02
Automated Endpoint Updates
The agent will scan for v1 endpoints, replace them with v2 equivalents, and run tests to validate changes.
- 03
Verify Completion
Once the check command returns no results, the loop exits successfully. Review changes if needed.
Workflow Steps
- 01
Scan Codebase
Execute grep command to identify all files containing 'v1/' API endpoints
- 02
Prioritize Changes
Create a list of files to update, prioritizing those with highest usage or complexity
- 03
Upgrade Endpoints
Systematically replace v1 endpoint references with v2 equivalents in each file
- 04
Validate Changes
Run automated tests to ensure updated endpoints function correctly
- 05
Log Modifications
Document all changes made including file paths, old/new endpoints, and test results
- 06
Repeat Until Clean
Continue scanning and updating until the exit condition is met (no v1 references found)
Kickoff Prompt
Start the "API Version Migration" loop. Goal: Upgrade all endpoints to the latest version Max iterations: 10 Between iterations run: grep -r 'v1/' src/ Exit when: No deprecated versions remain (grep command returns empty result) Please begin migrating all API endpoints from v1 to v2. First, scan the codebase for any occurrences of 'v1/' in the src/ directory. For each file found, update the endpoints to use the corresponding v2 paths while preserving functionality. After making changes, run the test suite to verify everything still works. Log your changes and continue this process until the grep check returns no results. Self-pace this loop. After each iteration, run `grep -r 'v1/' src/` and evaluate the output, and only continue if the exit condition is not met (No deprecated versions remain (grep command returns empty result)). Stop when the exit condition passes or 10 iterations are reached. Give a short status update each pass.
Guardrails
hardcoded- ·Only modify files containing 'v1' in their API paths - do not touch other versions
- ·Preserve backward compatibility by maintaining existing functionality during migration
- ·Run full test suite after each change to ensure no regressions
- ·Log all changes made for audit trail purposes
- ·Do not commit changes automatically - require manual review before finalizing
Flow Diagram
Related loops — API
API
Resolve API Error Responses
This loop standardizes API error responses across the application to improve client-side error handling and debugging. It ensures all error responses follow a consistent structure (e.g., RFC 7807 Problem Details format) with appropriate HTTP status codes and machine-readable error codes.
API
Fix Failing Integration Endpoints
Automatically detects and resolves issues in failing API integration endpoints through iterative testing and code modifications.
API
API Performance Budget
A coding loop focused on optimizing API performance to ensure P95 latency stays under a defined target threshold. This loop iteratively runs load tests, analyzes bottlenecks, and implements optimizations until the goal is achieved or maximum iterations are reached.