Step by step guide to creating AI proxy with Google ADK

Agent Development Kit (ADK) is an open source Python framework that helps developers build, manage and deploy multi-agent systems. It is designed to be modular and flexible, making proxy-based applications easy to use.
In this tutorial, we will use the ADK to create a simple AI proxy. The agent will have access to two tools:
- get_company_overview
- get_earnings
Google API Key
To use Google’s AI services, you need an API key:
Alphavantage API keys
For accessing financial data, we will use the Alpha Vantage API:
- go
- Click “Get free API keys” Or visit this direct link
- Enter your email and follow the instructions
- After receiving the API key, please copy and save it safely. We will use it to verify the request to the financial endpoint.
Python Library
We only need one package:
Set up your project folder using the following structure:
parent_folder/
│
└───multi_agent/
├── __init__.py
├── agent.py
└── .env
__init__.py
Paste the following code into Multi_agent/__ Init__.py:
.env
Create the .ENV file in the Multi_agent folder and paste the following:
GOOGLE_GENAI_USE_VERTEXAI=FALSE
GOOGLE_API_KEY=""
ALPHA_VANTAGE_API_KEY="
replace Placeholder with actual API keys
agent.py
Paste the following code into the Agent.py file:
from google.adk.agents import Agent
import requests
import os
from typing import Optional
ALPHA_VANTAGE_API_KEY = os.getenv("ALPHA_VANTAGE_API_KEY")
def get_company_overview(symbol: str) -> dict:
"""
Get comprehensive company information and financial metrics
Args:
symbol: Stock ticker symbol (e.g., IBM)
Returns:
dict: Company overview data or error
"""
if not ALPHA_VANTAGE_API_KEY:
return {"status": "error", "error": "Missing API key"}
base_url = "query"
params = {
"function": "OVERVIEW",
"symbol": symbol,
"apikey": ALPHA_VANTAGE_API_KEY
}
try:
response = requests.get(base_url, params=params)
response.raise_for_status()
data = response.json()
if "Error Message" in data:
return {"status": "error", "error": data["Error Message"]}
# Filter key metrics
key_metrics = {
"Description": data.get("Description"),
"Sector": data.get("Sector"),
"MarketCap": data.get("MarketCapitalization"),
"PERatio": data.get("PERatio"),
"ProfitMargin": data.get("ProfitMargin"),
"52WeekHigh": data.get("52WeekHigh"),
"52WeekLow": data.get("52WeekLow")
}
return {
"status": "success",
"symbol": symbol,
"overview": key_metrics
}
except Exception as e:
return {"status": "error", "error": str(e)}
def get_earnings(symbol: str) -> dict:
"""
Get annual and quarterly earnings (EPS) data with analyst estimates and surprises
Args:
symbol: Stock ticker symbol (e.g., IBM)
Returns:
dict: Earnings data with estimates or error message
"""
if not ALPHA_VANTAGE_API_KEY:
return {"status": "error", "error": "Missing API key"}
base_url = "query"
params = {
"function": "EARNINGS",
"symbol": symbol,
"apikey": ALPHA_VANTAGE_API_KEY
}
try:
response = requests.get(base_url, params=params)
response.raise_for_status()
data = response.json()
if "Error Message" in data:
return {"status": "error", "error": data["Error Message"]}
# Process annual and quarterly earnings
annual_earnings = data.get("annualEarnings", [])[:5] # Last 5 years
quarterly_earnings = data.get("quarterlyEarnings", [])[:4] # Last 4 quarters
# Format surprise percentages
for q in quarterly_earnings:
if "surprisePercentage" in q:
q["surprise"] = f"{q['surprisePercentage']}%"
return {
"status": "success",
"symbol": symbol,
"annual_earnings": annual_earnings,
"quarterly_earnings": quarterly_earnings,
"metrics": {
"latest_eps": quarterly_earnings[0]["reportedEPS"] if quarterly_earnings else None
}
}
except Exception as e:
return {"status": "error", "error": str(e)}
root_agent = Agent(
name="Financial_analyst_agent",
model="gemini-2.0-flash",
description=(
"Agent to give company overviews with key financial metrics."
),
instruction=(
"You are a helpful AI agent that provides company overviews and earnings information"
),
tools=[get_company_overview, get_earnings],
)
In this script, we define the Financial Analytics Agent using the Google Agent Development Suite (ADK). The agent is designed to answer user queries via the Alpha Vantage API to access real-time financial data. Specifically, it reveals two tools: get_company_overview and get_earnings. GET_COMPANY_OVERVIEW feature retrieves detailed information for key companies such as industry, market cap, price-to-earnings ratio and 52-week high/low values. The GET_EARNINGS feature provides annual and quarterly earnings data including reported EPS and surprise percentages. To create a proxy, we use the proxy class of Google.Adk.Adk.Axents Module, giving it a name, model (e.g. Gemini 2.0 Flash), description, and directive prompts. The agent then comes with the two tools mentioned above, allowing it to answer questions related to the company’s finances.
To run the agent, navigate to the parent directory of your agent project (for example, using CD..)
parent_folder/ ← Navigate to this directory in your terminal
│
└───multi_agent/
├── __init__.py # Initializes the module
├── agent.py # Contains the agent logic and tools
└── .env # Stores your API keys securely
After navigating, run the following code:
Open the provided URL (usually directly in the browser. You will see a simple chat interface where you can interact with the proxy using the input text box.
Additionally, you can check every step of proxy inference by clicking action. This allows you to view:
- The so-called tool
- Input and output for each function
- Response generated by language models
You can find the entire code as well as the folder structure on this link:

I am a civil engineering graduate in Islamic Islam in Jamia Milia New Delhi (2022) and I am very interested in data science, especially neural networks and their applications in various fields.
🚨Build a Genai you can trust. ⭐️Parlant is your open source engine for controlled, compliance and purposeful AI conversations – Star Parlant on Github! (Promotion)