| [ Web Proxy ] |
| Viewing: https://adk.dev/integrations/../../live/../../observability/../../../a2a/../../get-started/migrate/ | [Back] [Original] |
[logo]
This guide shows you how to migrate an existing agent codebase to Agent Development Kit (ADK) using Agents CLI and your coding agent. Migrating to ADK lets you standardize your agent architecture across multiple languages, use built-in evaluation tools, and deploy directly to Google Cloud.
Instead of manually rewriting state objects, node graphs, and execution loops line by line, you can use Agents CLI to plan and execute the migration with your coding agent.
Agents CLI installs ADK development skills into coding agents such as Antigravity, Claude Code, Cursor, and Codex. When you open your coding agent in an existing project, it can:
For more information on using Agents CLI, see the Agents CLI documentation.
Before starting your migration, make sure you have the following installed:
uv package managerInstall Agents CLI and its ADK skills into your coding agent:
To verify the installation:
Follow this process to migrate an existing agent to ADK:
Open your terminal or IDE in the root directory of your existing agent project, and start your coding agent. Confirm that the agent detects the ADK skills installed by Agents CLI.
Ask your coding agent to inspect your current codebase and brainstorm the target ADK architecture. Since the agent has ADK Skills loaded through Agents CLI, it understands ADK state management, graph workflows, and orchestration patterns. Use a prompt in your coding agent similar to the following:
I want to migrate this existing agent codebase to Google Agent Development Kit (ADK).
Please inspect our current files, state schema, tools, and control flow.
Propose 2-3 target ADK architecture options with trade-offs, and recommend the cleanest approach.
Include an evaluation plan to verify behavior using agents-cli eval.
Your coding agent analyzes the following items:
Agent or Workflow, fit best.Once you review the proposed approaches, approve the architecture that matches your requirements.
ADK replaces custom dispatch loops and state handlers with declarative classes and graph workflows. Use the following mapping as a guide during migration:
| Existing pattern | ADK equivalent | Description |
|---|---|---|
| Custom tool schemas or wrappers | Native Python functions or FunctionTool |
Plain Python functions with type hints and docstrings. ADK automatically derives tool declarations. |
| Custom agent loops or runners | Agent |
Declarative agent definition specifying model, instructions, tools, and sub-agents. |
| Memory and retrieval | BaseMemoryService implementations and retrieval tools |
Built-in memory services (InMemoryMemoryService, VertexAiMemoryBankService, VertexAiRagMemoryService) plus retrieval tools for session and document grounding. |
| State dictionaries or scratchpads | session.state via ToolContext |
Shared, mutable session state accessible inside tools, callbacks, and agent instructions. |
| Multi-agent workflows and pipelines | google.adk.workflow.Workflow |
Explicit graph nodes with conditional routes, loops, and parallel branching. |
| Multi-agent handoffs | Agent(sub_agents=[...]) |
Hierarchical delegation where a coordinator agent delegates to specialized sub-agents. |
| Remote agent communication | A2A Protocol | Inter-agent communication over HTTP using the Agent-to-Agent standard. |
A reliable migration is test-driven. Your coding agent can set up evaluation datasets and test suites alongside the new ADK code to verify that the migrated agent produces the same outcomes as your original implementation.
eval/.Agent or Workflow.# agent.py
from google.adk.agents import Agent
from google.adk.tools import ToolContext
def lookup_customer(customer_id: str) -> str:
"""Retrieve account tier and status for a customer."""
return "Tier: Premium, Status: Active"
def calculate_discount(amount: float, rate: float = 0.1) -> float:
"""Calculate discounted total for a transaction."""
return amount * (1.0 - rate)
root_agent = Agent(
name="customer_support_agent",
model="gemini-flash-latest",
instruction="Assist customers with account inquiries and discounts using your tools.",
tools=[lookup_customer, calculate_discount],
)
Run the evaluation suite to compare the migrated agent against your baseline test cases:
You can also test queries directly or interactively:
# Test a single prompt
agents-cli run "Look up customer cust_101 and apply a 10% discount on $100."
# Start the interactive web UI
agents-cli playground
| Web Proxy Viewer | New URL | Original Page |