╔══════════════════════════════════════╗
║ ⚡ ⚡ ║
║ 🤖 AI Agent Orchestration 🎭 ║
║ ⚡ ⚡ ║
║ ┌─────────────┐ ┌─────────────┐ ║
║ │ Image │ │ Story │ ║
║ │ Generator │ │ Teller │ ║
║ │ 🎨 │ │ 📖 │ ║
║ └─────────────┘ └─────────────┘ ║
║ │ │ ║
║ └──────┬─────────┘ ║
║ │ ║
║ ┌─────────────┐ ║
║ │ Orchestrator│ ║
║ │ 🎯 │ ║
║ └─────────────┘ ║
║ ⚡ ⚡ ║
╚══════════════════════════════════════╝
First, you need to set up Google Cloud CLI and authentication:
-
Install Google Cloud CLI: Follow the instructions from: https://cloud.google.com/sdk/docs/install-sdk
-
Authenticate with Google Cloud:
gcloud auth login gcloud auth application-default login
-
Set your project:
gcloud config set project <PROJECT_ID>
Before starting, you need to configure a couple of variables in config.py:
- Google Cloud Storage bucket for images 🗄️ - Update
GCS_IMAGE_BUCKETwith your workshop bucket - Toolbox endpoint 🔧 - Update
TOOLBOX_ENDPOINTwith the Cloud Run URL from thepar-devfest-sfeirGoogle Cloud Project
At the root of every agent directory, you need to create a .env file with the following environment variables:
GOOGLE_GENAI_USE_VERTEXAI=TRUE
GOOGLE_CLOUD_PROJECT=<PROJECT_ID>
GOOGLE_CLOUD_LOCATION=us-central1First, create and activate a virtual environment:
python3.11 -m venv .venv
source .venv/bin/activateTo activate it in future sessions:
source .venv/bin/activateEnsure you have the required dependencies:
pip install -r requirements.txtFrom the solution (or workshop) folder:
uv run a2a_image_generator_agent/From the solution (or workshop) folder:
uv run a2a_storyteller_agent/From the solution (or workshop) folder:
adk webADK documentation: https://google.github.io/adk-docs/agents/workflow-agents.
- Draft Writer Agent:
workshop/a2a_storyteller_agent/storyteller_agent/draft_writer_agent/agent.py- Implement the DraftWriterAgent that generates the initial draft of a story (4-8 sentences) based on search results.
- Refinement Loop:
workshop/a2a_storyteller_agent/storyteller_agent/refinement_loop/agent.py- Add critic_agent and editor_agent to the sub_agents list in the LoopAgent configuration.
- It might also be a good idea to limit the number of iterations 😉
In order to test this part of the workshop, start adk web from workshop/a2a_storyteller_agent/ folder.
Now let's add an A2A wrapper!
-
Agent Skill & Card:
workshop/a2a_storyteller_agent/__main__.py- Create AgentSkill for story creation with id, name, description, tags, and examples.
- Create AgentCard for storyteller agent with name, description, url, version, input/output modes, capabilities, and skills.
Need help? Get inspired by a2a_image_generator_agent implementation.
Curious how to test it? The
a2a-inspectorfrom the debugging section can come in handy!
- A2A Server URLs:
workshop/config.py- Add the URLs for the A2A servers (A2A_IMAGE_GENERATION_URL and A2A_STORYTELLER_URL).
- MCP ToolBox Connector:
workshop/orchestrator_agent/sub_agent/agent.py- Add the MCP Toolbox connector in order to save the story. If you need help, check the corresponding package: https://pypi.org/project/toolbox-core/ .
To test and debug individual agents, you can use the a2a-inspector tool, which provides a user-friendly interface for interacting with your agents.
# Clone the a2a-inspector repository
git clone https://github.com/a2aproject/a2a-inspector.git
cd a2a-inspector
# Follow the installation instructions in the repository- Start your agent server (e.g.,
uv run a2a_image_generator_agent/) - Launch a2a-inspector and connect to your agent's endpoint
- Send test messages to verify agent behavior and responses
- Monitor logs to troubleshoot any issues