⚠️ DISCLAIMER: THIS IS NOT AN OFFICIALLY SUPPORTED GOOGLE PRODUCT. THIS PROJECT IS INTENDED FOR DEMONSTRATION PURPOSES ONLY. IT IS NOT INTENDED FOR USE IN A PRODUCTION ENVIRONMENT.
This demo shows how to enable A2A (Agent2Agent) protocol communication between purchasing concierge agent with the remote pizza and burger seller agents using A2A Python SDK. Burger and Pizza seller agents is a independent agent that can be run on different server with different frameworks, in this demo example we, burger agent is built on top of Crew AI and pizza agent is built on top of LangGraph.
Detailed tutorial about this repo: Getting Started with Agent2Agent (A2A) Protocol: A Purchasing Concierge and Remote Seller Agent Interactions with Gemini on Cloud Run
-
If you are executing this project from your local IDE, Login to Gcloud using CLI with the following command :
gcloud auth application-default login
-
Enable the following APIs
gcloud services enable aiplatform.googleapis.com -
Install uv dependencies and prepare the python env
curl -LsSf https://astral.sh/uv/install.sh | sh uv python install 3.12 uv sync --frozen
First, we need to run the remote seller agents. We have two remote seller agents, one is burger agent and the other is pizza agent. We need to run them separately. These agents will serve the A2A Server
-
Copy the
remote_seller_agents/burger_agent/.env.exampletoremote_seller_agents/burger_agent/.env. -
Fill in the required environment variables in the
.envfile. SubstituteGOOGLE_CLOUD_PROJECTwith your Google Cloud Project ID.GOOGLE_CLOUD_LOCATION=us-central1 GOOGLE_CLOUD_PROJECT={your-project-id} -
Run the burger agent.
cd remote_seller_agents/burger_agent uv sync --frozen uv run .
-
It will run on
http://localhost:10001
-
Copy the
remote_seller_agents/pizza_agent/.env.exampletoremote_seller_agents/pizza_agent/.env. -
Fill in the required environment variables in the
.envfile. SubstituteGOOGLE_CLOUD_PROJECTwith your Google Cloud Project ID.GOOGLE_CLOUD_LOCATION=us-central1 GOOGLE_CLOUD_PROJECT={your-project-id} -
Run the pizza agent.
cd remote_seller_agents/pizza_agent uv sync --frozen uv run .
-
It will run on
http://localhost:10000
Finally, we can run our A2A client capabilities owned by purchasing concierge agent.
-
Go back to demo root directory ( where
purchasing_conciergedirectory is located ) -
Copy the
purchasing_concierge/.env.exampletopurchasing_concierge/.env. -
Fill in the required environment variables in the
.envfile. SubstituteGOOGLE_CLOUD_PROJECTwith your Google Cloud Project ID. And fill in thePIZZA_SELLER_AGENT_URLandBURGER_SELLER_AGENT_URLwith the URL of the remote seller agents.PIZZA_SELLER_AGENT_URL=http://localhost:10000 BURGER_SELLER_AGENT_URL=http://localhost:10001 GOOGLE_GENAI_USE_VERTEXAI=TRUE GOOGLE_CLOUD_PROJECT={your-project-id} GOOGLE_CLOUD_LOCATION=us-central1 -
Run the purchasing concierge agent with the adk web dev UI
uv sync --frozen uv run adk web
Run the following command
gcloud run deploy burger-agent \
--source remote_seller_agents/burger_agent \
--port=8080 \
--allow-unauthenticated \
--min 1 \
--region us-central1 \
--update-env-vars GOOGLE_CLOUD_LOCATION=us-central1 \
--update-env-vars GOOGLE_CLOUD_PROJECT={your-project-id}Run the following command
gcloud run deploy pizza-agent \
--source remote_seller_agents/pizza_agent \
--port=8080 \
--allow-unauthenticated \
--min 1 \
--region us-central1 \
--update-env-vars GOOGLE_CLOUD_PROJECT={your-project-id} \
--update-env-vars GOOGLE_CLOUD_LOCATION=us-central1-
Create the staging bucket first
gcloud storage buckets create gs://purchasing-concierge-{your-project-id} --location=us-central1 -
Copy the
.env.exampleto.env. -
Fill in the required environment variables in the
.envfile. SubstituteGOOGLE_CLOUD_PROJECTwith your Google Cloud Project ID.GOOGLE_GENAI_USE_VERTEXAI=TRUE GOOGLE_CLOUD_PROJECT={your-project-id} GOOGLE_CLOUD_LOCATION=us-central1 STAGING_BUCKET=gs://purchasing-concierge-{your-project-id} PIZZA_SELLER_AGENT_URL={your-pizza-agent-url} BURGER_SELLER_AGENT_URL={your-burger-agent-url} -
Deploy the purchasing concierge agent to agent engine
uv sync --frozen uv run deploy_to_agent_engine.py
-
Update the
.envfile with theAGENT_ENGINE_RESOURCE_NAMEwhich obtained from the previous step. -
Run the Gradio app
uv sync --frozen
uv run purchasing_concierge_ui.py