Inspiration
What it does
How I built it
Challenges I ran into
Accomplishments that I'm proud of
What I learned
What's next for Migration Agent
Inspiration
Every Python team that depends on web3.py and hasn't upgraded to v7 yet hits the same wall: twelve-plus breaking changes — renamed provider classes, snake-cased keyword arguments, ABI types moved out of web3.types, whole modules (ethpm, web3.geth.miner) removed. The work is mechanical, boring, and still done by humans on a Friday night. We wanted an agent that does the boring part and is honest about the parts it cannot do.
What it does
Migration Agent is a Gemini-powered agent that automates the web3.py v6 → v7 migration on a GitLab repository, end-to-end:
detect_framework— readsrequirements.txt/pyproject.toml/ imports to findweb3 >=6.0projects.run_codemod— invokes a deterministic AST codemod (codemod-web3py-v7, built onjssg) that handles 86% of the breaking changes with zero false positives and leavesTODO(web3py-v7)comments where it can't (e.g., removed modules).open_merge_request— branch + commit + push, then callscreate_merge_requeston the official GitLab Duo MCP server with a Gemini-authored title and description (including a "Manual Review and Further Steps Needed" section surfaced from the codemod's TODOs).
The whole agent loop fires off one shell command and walks away — the reviewer wakes up to a clean MR.
How we built it
- Agent loop:
agent/main.py(171 LOC), Gemini 2.5 Flash function calling. - Tools:
detect_framework,run_codemod(codemod jssg vianpx),open_merge_request(git push + GitLab Duo MCPcreate_merge_requestover HTTPS). - Partner MCP integration: official GitLab Duo MCP server at
https://gitlab.com/api/v4/mcp. OAuth Dynamic Client Registration handled bymcp-remote; bearer token cached locally and used in subsequent agent calls. - Hosted demo: Cloud Run (Python 3.12 + Node 20 image;
gunicornserves a Flask landing page with embedded video and a "Run again" button that re-triggers the agent on a live demo target). - Live demo target:
gitlab.com/run58669-maker/web3py-v6-sample— a realistic v6 dApp that exercises every codemod path.
Challenges we ran into
- GitLab Duo MCP server requires Premium/Ultimate tier + beta-features-on. Took a 30-day free trial activation and a settings cascade for the OAuth endpoint to start responding.
gemini-2.5-prois paid-tier-only; we ship the agent ongemini-2.5-flashwhich is free-tier covered.- Cloud Build default compute SA needed an explicit
storage.objectViewergrant before the first image push went through.
Accomplishments that we're proud of
- Three real, openable MRs on a real GitLab repo as proof — including one (MR #3) opened via the official GitLab Duo MCP
create_merge_requesttool. Not a screencast. - Honest output: the agent surfaces the codemod's TODOs as a
Manual Reviewsection in the MR body, so the reviewer sees both what was migrated and what they still need to handle.
What we learned
- Even with a tightly-scoped codemod, the value an LLM adds is summarizing what the codemod didn't do — a single MR comment can save 10 minutes of grep.
- MCP's "tool surface + bearer token" model fits agent loops well; we wired it in one short refactor of
tools/gitlab_mr.py.
What's next for Migration Agent
- More codemods:
requests→httpx,setup.py→pyproject.toml, FastAPI 0.95 → 0.115. - Multi-MR workflow: a single agent run that opens one MR per breaking-change family.
- GitLab CI pipeline integration: have the agent annotate the MR with pipeline results before it pings the human reviewer.
Built With
- cloud
- cloud-run
- codemod
- flask
- gemini
- gitlab
- google-cloud
- mcp
- python
- vertex
- web3.py
Log in or sign up for Devpost to join the conversation.