Google ADK (Agent Development Kit) Integration
Google Agent Development Kit (ADK) — framework for building multi-agent systems based on Google models (Gemini). ADK provides hierarchical agent model: orchestrators (LlmAgent) coordinate sub-agents, which can be LLM agents, sequential/parallel workflows or custom agents. Built-in integration with Vertex AI, Google Cloud and Search Grounding services.
Basic ADK Structure
# pip install google-adk
from google.adk.agents import LlmAgent, SequentialAgent, ParallelAgent
from google.adk.tools import google_search, FunctionTool
from google.adk.runners import Runner
from google.adk.sessions import InMemorySessionService
import asyncio
# Tool via FunctionTool
def get_stock_price(ticker: str) -> dict:
"""Get current stock price.
Args:
ticker: Stock ticker (e.g., GOOGL, AAPL)
Returns:
dict with price, change and volume
"""
data = finance_api.get_quote(ticker)
return {
"ticker": ticker,
"price": data["price"],
"change_percent": data["change_percent"],
"volume": data["volume"],
}
stock_tool = FunctionTool(func=get_stock_price)
# Basic LLM agent
research_agent = LlmAgent(
name="market_researcher",
model="gemini-2.0-flash",
instruction="""You are a financial market analyst.
Research market data and provide structured analysis.
Always use tools to get current data.""",
tools=[google_search, stock_tool],
output_key="research_result", # Key for passing result to next agent
)
# Run agent
session_service = InMemorySessionService()
runner = Runner(
agent=research_agent,
app_name="financial_analysis",
session_service=session_service,
)
SequentialAgent: Processing Pipeline
from google.adk.agents import SequentialAgent, LlmAgent
from google.adk.tools import FunctionTool
# Sequential pipeline: research → analysis → report
research_step = LlmAgent(
name="researcher",
model="gemini-2.0-flash",
instruction="Research the topic, gather facts and data.",
tools=[google_search, stock_tool],
output_key="raw_research",
)
analysis_step = LlmAgent(
name="analyst",
model="gemini-2.0-flash",
instruction="""Analyze the research data.
Input data available as: {raw_research}""",
output_key="analysis",
)
report_step = LlmAgent(
name="writer",
model="gemini-2.0-flash",
instruction="""Create final report based on analysis.
Analysis: {analysis}""",
output_key="final_report",
)
pipeline = SequentialAgent(
name="analysis_pipeline",
sub_agents=[research_step, analysis_step, report_step],
)
ParallelAgent: Parallel Execution
from google.adk.agents import ParallelAgent
# Parallel independent tasks
financial_analyzer = LlmAgent(
name="financial",
model="gemini-2.0-flash",
instruction="Analyze company financial metrics.",
tools=[get_financial_data],
output_key="financial_analysis",
)
market_analyzer = LlmAgent(
name="market",
model="gemini-2.0-flash",
instruction="Analyze market position and competitors.",
tools=[google_search, get_market_data],
output_key="market_analysis",
)
risk_analyzer = LlmAgent(
name="risk",
model="gemini-2.0-flash",
instruction="Assess risks and threats.",
tools=[google_search, get_regulatory_data],
output_key="risk_analysis",
)
# Parallel analysis of three areas
parallel_analysis = ParallelAgent(
name="due_diligence_parallel",
sub_agents=[financial_analyzer, market_analyzer, risk_analyzer],
)
# Synthesizer aggregates results
synthesizer = LlmAgent(
name="synthesizer",
model="gemini-2.0-pro",
instruction="""Synthesize parallel analysis results into unified report.
Financial: {financial_analysis}
Market: {market_analysis}
Risks: {risk_analysis}""",
output_key="dd_report",
)
# Full DD pipeline
dd_pipeline = SequentialAgent(
name="due_diligence",
sub_agents=[parallel_analysis, synthesizer],
)
Hierarchical Multi-Agent (Orchestrator)
from google.adk.agents import LlmAgent
# Orchestrator with sub-agents
orchestrator = LlmAgent(
name="coordinator",
model="gemini-2.0-flash",
instruction="""You are a task coordinator.
Delegate tasks to specialized agents by their purpose.
Do not execute tasks yourself — always use sub-agents.""",
# Sub-agents become orchestrator tools
sub_agents=[research_step, financial_analyzer, report_step],
)
# ADK automatically creates transfer_to_{agent_name} tools
# Orchestrator calls them via function calling
Search Grounding with Vertex AI
from google.adk.tools import GroundingTool
from google.adk.tools.grounding import GoogleSearchRetrieval, VertexAISearchRetrieval
# Grounding via Google Search (current data)
search_grounding = GroundingTool(
google_search_retrieval=GoogleSearchRetrieval()
)
# Grounding via Vertex AI Search (corporate documents)
enterprise_grounding = GroundingTool(
vertex_ai_search_retrieval=VertexAISearchRetrieval(
datastore="projects/my-project/locations/global/collections/default/dataStores/my-datastore"
)
)
grounded_agent = LlmAgent(
name="grounded_analyst",
model="gemini-2.0-flash",
instruction="Answer questions using current data from corporate database.",
tools=[enterprise_grounding],
)
Deployment to Vertex AI Agent Builder
# ADK agents deploy natively to Vertex AI
from google.adk.cli import deploy_to_vertex
# Project structure
# my_agent/
# __init__.py
# agent.py # contains root_agent = LlmAgent(...)
# tools.py
# agent.py
from google.adk.agents import LlmAgent
from .tools import get_data, process_data
root_agent = LlmAgent(
name="production_agent",
model="gemini-2.0-flash",
instruction="...",
tools=[get_data, process_data],
)
# Deploy: adk deploy --project my-gcp-project --region us-central1
Practical Case: Competitive Intelligence System
Company: FMCG, marketing analytics department. Monitoring 15 competitors required 3 full-time analysts.
ADK Architecture:
# Parallel data collection for each competitor
competitor_agents = [
LlmAgent(
name=f"monitor_{company}",
model="gemini-2.0-flash",
instruction=f"Monitor {company} activity: news, price changes, product launches.",
tools=[google_search, web_scraper, price_tracker],
output_key=f"data_{company}",
)
for company in competitors
]
parallel_monitor = ParallelAgent(name="parallel_monitor", sub_agents=competitor_agents)
trend_analyzer = LlmAgent(
name="trend_analyzer",
model="gemini-2.0-pro",
instruction="Analyze collected data, identify patterns and trends.",
output_key="trends",
)
report_generator = LlmAgent(
name="reporter",
model="gemini-2.0-flash",
instruction="Create weekly digest for CMO. Format: executive summary + details.",
output_key="weekly_report",
)
monitoring_pipeline = SequentialAgent(
name="competitive_intelligence",
sub_agents=[parallel_monitor, trend_analyzer, report_generator],
)
Results:
- Competitor coverage: 15 → 32 companies
- Weekly report preparation time: 3 days → 40 minutes
- Response speed to competitor pricing changes: 3 days → 2 hours
- Analysts refocused on strategic decisions
Timeline
- Basic LlmAgent with tools: 2–3 days
- Sequential/Parallel pipelines: 3–5 days
- Hierarchical orchestrator: 1–2 weeks
- Deployment to Vertex AI: 3–5 days
- Production-ready with monitoring: +1 week







