A multi-agent system demonstration using Google's Agent Development Kit (ADK) with Comet Opik observability integration. This project showcases how to build intelligent, traceable AI agents for recipe suggestions and research with a beautiful CLI interface powered by Rich.
- 🤖 Multi-Agent Architecture: Sequential workflow with specialized agents
- 🔍 Recipe Research: Intelligent agents that suggest and research recipes
- 📊 Full Observability: Complete tracing and monitoring via Comet Opik
- 🛠️ Tool Integration: Custom tools for database search and nutritional analysis
- ⚡ Google Gemini: Powered by Google's latest Gemini 2.0 Flash model
- 🎨 Beautiful CLI: Rich-powered interface with colors, panels, and markdown rendering
The system consists of a sequential multi-agent workflow:
-
RecipePipeline (SequentialAgent)
- Ensures both agents run in order
- Passes state between agents
- Guarantees complete workflow execution
-
RecipeSuggester (Agent)
- Analyzes provided ingredients
- Generates creative recipe suggestions
- Provides cooking instructions and timing
- Outputs to
recipestate key
-
RecipeResearcher (Agent)
- Accesses suggested recipe from state
- Uses tools to gather nutritional information
- Researches recipe background and context
- Suggests variations and cooking tips
- Outputs to
researchstate key
-
RecipeMasterAgent (Root Agent)
- Delegates to RecipePipeline
- Synthesizes information from both agents
- Provides final formatted response
- Python 3.9 or higher
- Google API key (Get one here)
- Comet account for Opik (Sign up here)
-
Clone or download this repository
-
Install dependencies:
pip install -r requirements.txt
-
Configure environment variables:
cp .env.example .env
Edit
.envand add your API keys:GOOGLE_API_KEY=your_google_api_key_here -
Configure Opik (Optional - will prompt if not configured):
opik configure
Or set environment variables in
.env:OPIK_API_KEY=your_opik_api_key_here OPIK_WORKSPACE=your_workspace_name
Run the agent:
python recipe_agent.py╭───────────────────────────────────────────────────────────╮
│ Recipe Agent Demo │
│ Powered by Google ADK with Opik Observability │
╰───────────────────────────────────────────────────────────╯
Enter ingredients (comma-separated): chicken, garlic, lemon
╭─ 🍳 Recipe Suggester ─────────────────────────────────────╮
│ │
│ Recipe: Lemon Garlic Roasted Chicken │
│ │
│ Ingredients: │
│ • 1 whole chicken │
│ • 4 cloves garlic, minced │
│ • 2 lemons, juiced and zested │
│ ... │
╰───────────────────────────────────────────────────────────╯
╭─ 🔬 Recipe Researcher ────────────────────────────────────╮
│ │
│ Nutritional Information: │
│ • High in protein │
│ • Contains vitamin C from lemon │
│ │
│ Cultural Background: │
│ This classic preparation is common in Mediterranean... │
╰───────────────────────────────────────────────────────────╯
╭─ 📖 Final Recipe ─────────────────────────────────────────╮
│ │
│ [Complete synthesized recipe with all details] │
│ │
╰───────────────────────────────────────────────────────────╯
✅ Done! Check your Opik dashboard for detailed traces.
All agent interactions are automatically traced and logged to Comet Opik, providing:
- Agent execution traces: See exactly how agents delegate and communicate
- Token usage tracking: Monitor LLM API consumption and costs
- Performance metrics: Analyze response times and bottlenecks
- Error tracking: Debug issues with detailed error information
- Tool usage logs: Track when and how tools are called
View traces in your Opik dashboard at: https://www.comet.com/
google_adk_recipies/
├── recipe_agent.py # Main agent implementation
├── requirements.txt # Python dependencies
├── .env.example # Environment variable template
├── .env # Your local config (create this)
└── README.md # This file
The recipe researcher agent uses custom tools:
- search_recipe_database: Simulates database queries for recipe information
- get_nutritional_info: Provides nutritional analysis for ingredients
All agents are instrumented with Opik callbacks:
before_agent_callback/after_agent_callback: Track agent invocationsbefore_model_callback/after_model_callback: Monitor model callsbefore_tool_callback/after_tool_callback: Track tool usage
The agents use Google's Gemini model by default. You can modify the model in recipe_agent.py:
model="gemini-2.0-flash-exp"Available models:
gemini-2.0-flash-exp(default, fastest)gemini-2.0-flashgemini-1.5-progemini-1.5-flash
Each agent has a specialized system instruction that defines its role and behavior. You can customize these in recipe_agent.py to change agent behavior.
If you see authentication errors:
- Verify your
GOOGLE_API_KEYis set correctly in.env - Check that your API key is valid at https://ai.google.dev/
If traces aren't appearing in Opik:
- Run
opik configureto set up your credentials - Verify you're logged into the correct workspace
- Check that
opik_tracer.flush()is called at the end of execution
If you see import errors:
- Ensure you've installed all dependencies:
pip install -r requirements.txt - Verify you're using Python 3.9 or higher:
python --version - Consider using a virtual environment
To add new agents to the sequential workflow:
new_agent = Agent(
name="NewAgent",
model="gemini-2.0-flash-exp",
instruction="Your instructions here",
output_key="new_agent_output",
before_agent_callback=opik_tracer.before_agent_callback,
after_agent_callback=opik_tracer.after_agent_callback,
before_model_callback=opik_tracer.before_model_callback,
after_model_callback=opik_tracer.after_model_callback,
before_tool_callback=opik_tracer.before_tool_callback,
after_tool_callback=opik_tracer.after_tool_callback,
)
# Add to sequential pipeline
recipe_pipeline = SequentialAgent(
name="RecipePipeline",
sub_agents=[recipe_suggester, recipe_researcher, new_agent],
description="Extended pipeline with new agent."
)Define new tools as Python functions (no decorator needed):
def my_custom_tool(param: str) -> str:
"""
Tool description for the LLM.
Args:
param: Parameter description
Returns:
Result description
"""
# Your tool logic here
return result
# Add to agent's tools list
agent = Agent(
name="AgentWithTools",
model="gemini-2.0-flash-exp",
instruction="...",
tools=[my_custom_tool, another_tool]
)- Google ADK: Agent Development Kit for building multi-agent systems
- Comet Opik: Observability and tracing for AI agents
- Rich: Beautiful terminal formatting and output
- Google Gemini: Google's latest generative AI models
- Google ADK Documentation
- Google ADK Python API Reference
- Opik ADK Integration
- Google AI Studio
- Rich Documentation
- ✅ Multi-agent sequential workflow with SequentialAgent
- ✅ Custom tools for recipe research and nutrition
- ✅ Full Opik observability integration
- ✅ Beautiful Rich CLI interface
- ✅ State management between agents using output_key
- ✅ Error handling and graceful degradation
- ✅ Environment-based configuration
This project is provided as-is for demonstration purposes.
Feel free to submit issues, fork the repository, and create pull requests for any improvements.