
Theory is great, but let’s make this concrete. One of the best ways to understand A2A’s potential is to see it applied in a practical scenario. This Codelab, which illustrates these concepts on step-by-step basis. We will using this purchasing concierge scenario in which this assistant can help us to order pizza or burger
In this blog, let’s deploy all of these agents on the Cloud Run with public URLs, to simulate remote agent interactions without knowing anything about them except their published URL so that our concierge can do the very first step which is the agent card discovery and see the log when we interact with them
First, we clone the source code from this repository. You will find the remote seller agents inside remote_seller_agents
directory with the following structure
remote_seller_agents/
├── burger_agent/
└── pizza_agent/
Each of this directory will contain the necessary file to deploy each agents. Let’s start with the burger agent, go to the burger_agent
directory and run the following command to prepare the environment variable of burger agent
cp remote_seller_agents/burger_agent/.env.example remote_seller_agents/burger_agent/.env
Next, we will need to modify the .env
file and update the GCLOUD_PROJECT_ID
to our own GCP project id
AUTH_USERNAME=burgeruser123
AUTH_PASSWORD=burgerpass123
GCLOUD_LOCATION=us-central1
GCLOUD_PROJECT_ID={your-project-id}
After that we can deploy the burger agent with the following command
gcloud run deploy burger-agent \
--source remote_seller_agents/burger_agent \
--port=8080 \
--allow-unauthenticated \
--min 1 \
--region us-central1
Successful deployment will show you the following log
Service [burger-agent] revision [burger-agent-xxxxx-xxx] has been deployed and is serving 100 percent of traffic.
Service URL: https://burger-agent-xxxxxxxxx.us-central1.run.app
Now, we need to do the same with the pizza agent, copy the .env
file
cp remote_seller_agents/pizza_agent/.env.example remote_seller_agents/pizza_agent/.env
Open the copied .env
file and update the GCLOUD_PROJECT_ID
to our own GCP project id
API_KEY=pizza123
GCLOUD_LOCATION=us-central1
GCLOUD_PROJECT_ID={your-project-id}
Then deploy the pizza agent using the following command
gcloud run deploy pizza-agent \
--source remote_seller_agents/pizza_agent \
--port=8080 \
--allow-unauthenticated \
--min 1 \
--region us-central1
Successful deployment will show you the following log
Service [pizza-agent] revision [pizza-agent-xxxxx-xxx] has been deployed and is serving 100 percent of traffic.
Service URL: https://pizza-agent-xxxxxxxxx.us-central1.run.app
Inside the hood, you can inspect agent.py
to see that pizza agent is built on top of Langgraph and burger agent is built using CrewAI
# remote_seller_agents/pizza_agent/agent.py
from langchain_google_vertexai import ChatVertexAI
from langgraph.prebuilt import create_react_agent...
self.model = ChatVertexAI(
model="gemini-2.0-flash",
location=os.getenv("GCLOUD_LOCATION"),
project=os.getenv("GCLOUD_PROJECT_ID"),
)
self.tools = [create_pizza_order]
self.graph = create_react_agent(
self.model,
tools=self.tools,
checkpointer=memory,
prompt=self.SYSTEM_INSTRUCTION,
response_format=ResponseFormat,
)
...
# remote_seller_agents/burger_agent/agent.py
from crewai import Agent, Crew, LLM, Task, Process
from crewai.tools import tool
...
model = LLM(
model="vertex_ai/gemini-2.0-flash", # Use base model name without provider prefix
)
burger_agent = Agent(
role="Burger Seller Agent",
goal=(
"Help user to understand what is available on burger menu and price also handle order creation."
),
backstory=("You are an expert and helpful burger seller agent."),
verbose=False,
allow_delegation=False,
tools=[create_burger_order],
llm=model,
)
agent_task = Task(
description=self.TaskInstruction,
output_pydantic=ResponseFormat,
agent=burger_agent,
expected_output=(
"A JSON object with 'status' and 'message' fields."
"Set response status to input_required if asking for user order confirmation."
"Set response status to error if there is an error while processing the request."
"Set response status to completed if the request is complete."
),
)
crew = Crew(
tasks=[agent_task],
agents=[burger_agent],
verbose=False,
process=Process.sequential,
)
...
At this point, we should already have 2 deployed remote seller agents, and we can access their agent card at the .well-known/agent.json
route. For example:
Source Credit: https://medium.com/google-cloud/exploring-agent2agent-a2a-protocol-with-purchasing-concierge-use-case-on-cloud-run-36f4b896eadf?source=rss—-e52cf94d98af—4