Google Adk Financial Advisor
This notebook demonstrates how to use the Financial Advisor agent with full observability through Phoenix tracing. The agent provides comprehensive financial advice through a team of specialized AI sub-agents:
- Data Analyst Agent: Creates market analysis reports for specific stock tickers
- Trading Analyst Agent: Develops trading strategies based on risk tolerance and investment duration
- Execution Agent: Creates implementation plans for trading strategies
- Risk Evaluation Agent: Analyzes risks and provides mitigation strategies
🔍 Phoenix Tracing: All agent interactions, tool usage, and LLM calls are automatically traced and sent to Phoenix for observability, performance monitoring, and evaluation.
⚠️ Important Disclaimer: This is for educational purposes only and does not constitute financial advice.
✅ You will need a Google Cloud account with Vertex AI enabled and an optional Phoenix Cloud account to run this notebook.
Set Up Keys & Dependencies
Install Dependencies
Google Cloud Setup
The Financial Advisor agent requires Google Cloud setup because it uses:
- Vertex AI for Gemini 2.5 Pro model
- Google Search tools for market data analysis
-
Create a Google Cloud Project (if you don't have one)
-
Enable required APIs:
- Vertex AI API
- Generative AI API
-
Set up authentication:
gcloud auth application-default login gcloud auth application-default set-quota-project YOUR-PROJECT-ID
Environment Variables
Create a .env file in this directory with the following variables:
# Required for Google ADK
GOOGLE_GENAI_USE_VERTEXAI=1
GOOGLE_CLOUD_PROJECT=your-project-id
GOOGLE_CLOUD_LOCATION=your-project-location # e.g., us-central1
# Optional: Phoenix Cloud Configuration (for production use)
# PHOENIX_API_KEY=your-phoenix-api-key
# PHOENIX_COLLECTOR_ENDPOINT=your-phoenix-hostname
```.
Configure Tracing
Build Financial Advisor System
Here we define all the prompts and agents inline to make this notebook completely standalone.
Test the Financial Advisor Agent
The following helper functions allow you to interact with the financial advisor agent from within a Jupyter notebook. They handle agent initialization, session management, and provide async wrappers for querying the agent and displaying responses.
📊 Phoenix Tracing Dashboard
Once you start running the examples below, you can view the traces in Phoenix:
Local Phoenix Instance:
- Visit: http://localhost:6006
- View traces in real-time as agents execute
- Analyze performance metrics and token usage
Phoenix Cloud:
- Visit your Phoenix Cloud dashboard
- Access advanced analytics and collaboration features
What You'll See in Phoenix:
- 🔗 Trace Trees: Complete execution flows from user query to final response
- ⏱️ Timing Data: Latency for each agent and tool call
- 💰 Token Usage: Input/output tokens and cost tracking
- 🔍 Tool Calls: Detailed logs of Google Search and agent interactions
- 📊 Performance Metrics: Aggregate statistics across all runs
The traces provide invaluable insights for debugging, optimization, and understanding how your multi-agent system performs.