Before you begin
- Labs create a Google Cloud project and resources for a fixed time
- Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
- On the top left of your screen, click Start lab to begin
Install ADK and set up your environment
/ 25
Explore the ADK agent
/ 25
Deploy the Agent as an A2A Server
/ 25
Enable another ADK agent to call the agent remotely
/ 25
The Agent2Agent (A2A) protocol addresses a critical challenge in the AI landscape: enabling Gen AI agents, built on diverse frameworks by different companies running on separate servers, to communicate and collaborate effectively - as agents, not just as tools. A2A aims to provide a common language for agents, fostering a more interconnected, powerful, and innovative AI ecosystem.
A2A is built around a few core concepts that make it powerful and flexible:
In this lab, you will:
Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources will be made available to you.
This Qwiklabs hands-on lab lets you do the lab activities yourself in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials that you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
Note: If you already have your own personal Google Cloud account or project, do not use it for this lab.
Note: If you are using a Pixelbook, open an Incognito window to run this lab.
Click the Start Lab button. If you need to pay for the lab, a dialog opens for you to select your payment method. On the left is the Lab Details pane with the following:
Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).
The lab spins up resources, and then opens another tab that shows the Sign in page.
Tip: Arrange the tabs in separate windows, side-by-side.
If necessary, copy the Username below and paste it into the Sign in dialog.
You can also find the Username in the Lab Details pane.
Click Next.
Copy the Password below and paste it into the Welcome dialog.
You can also find the Password in the Lab Details pane.
Click Next.
Click through the subsequent pages:
After a few moments, the Google Cloud console opens in this tab.
In this lab environment, the Vertex AI API and Cloud Run API have been enabled for you. If you were to follow these steps in your own project, you would enable them by navigating to Vertex AI and following the prompt to enable it.
Download code for this lab and install ADK and other requirements by running the following in the Cloud Shell Terminal:
Click Check my progress to verify the objective.
For the purposes of this lab, imagine you work for a stadium maintenance company: Cymbal Stadiums. As part of a recent project, you developed an image generation-agent that can create illustrations according to your brand guidelines. Now, several different teams in your organization want to use it too.
If you were to copy the code for use as a sub-agent by many agents, it would be very difficult to maintain and improve all of these copies.
Instead, you can deploy the agent once as an agent wrapped with an A2A server, and the other teams' agents can incorporate it by querying it remotely.
In the Cloud Shell Editor's file explorer pane, navigate to the adk_and_a2a/illustration_agent directory. This directory contains the ADK agent you will make available remotely. Click the directory to toggle it open.
Open the agent.py file on this directory and scroll to the section labeled # Tools.
Notice the generate_image() function, which will be used as a tool by this agent. It receives a prompt and performs a two-step process. First, it uses the Google Gen AI SDK to call generate_content(), which returns the raw image data directly in the response. Second, the function uses the Cloud Storage library to upload these image bytes to a GCS bucket. Finally, the tool returns a URL for the newly created image file.
Notice that the instruction provided to the root_agent provides specific instructions to the agent to use image-generation prompts that respect the company's brand guidelines. For example, it specifies:
To see it in action, you'll first need to write a .env file to set environment variables needed by ADK agents. Run the following in the Cloud Shell Terminal to write this file in this directory.
Run the following to copy the .env to another agent directory you'll use in this lab:
Now from the Cloud Shell Terminal, launch the ADK dev UI with:
Output
To view the web interface in a new tab, click the http://127.0.0.1:8000 link at the bottom of the Terminal output.
A new browser tab will open with the ADK Dev UI.
From the Select an agent dropdown on the left, select the illustration_agent from the dropdown.
Query the agent with some text that could be used in a recruitment slide deck:
After about 10 seconds, the agent should respond with the prompt it generated and a URL to preview the image. Click the image URL to preview the image, then click Back in your browser to return to the Dev UI.
authuser value at the end of the URL, for example changing it from authuser=0 to authuser=1. authuser=2, etc. In production you could handle this with a service account creating a Signed URL.
Example Output
Example Image
Notice that the prompt you provided to the agent didn't mention sports, stadiums, or maintenance work, but the agent took your text and the brand guidelines and combined them into a single prompt for the image generation model.
When you are finished exploring the base agent, close the browser tab.
Click on the Cloud Shell Terminal pane and press CTRL + C to stop the server.
Click Check my progress to verify the objective.
You'll now take the steps to deploy this agent as a remote A2A agent.
An A2A Agent identifies itself and its capabilities by serving an Agent Card. Run the following to create an agent.json file.
Open the agent.json file within the adk_and_a2a/illustration_agent directory and paste in the following contents:
Save the file.
Review the JSON in the agent.json file. Notice that it gives the agent a name and description and identifies some skills . It also indicates a url where the agent itself can be called.
The agent's url is constructed to be its Cloud Run service URL once you have deployed it following the instructions in this lab.
While similar in name to skills, the parameter capabilities here is reserved to indicate abilities like streaming.
Run the following to create a requirements.txt file in the illustration_agent directory.
Open the requirements.txt file, and paste the following into the file.
Save the file.
In the following command, you will use adk deploy cloud_run with the --a2a flag to deploy your agent to Cloud Run as an A2A server. You can learn more about deploying agents to Cloud Run by searching for the lab "Deploy ADK agents to Cloud Run". In this command:
--project and --region define the project and region in which your Cloud Run service will be deployed--service_name defines the name for the Cloud Run service--a2a flag indicates it should be hosted as an A2A agent. This means two things:
CLOUD_RUN_URL/a2a/AGENT_NAME/.well-known/agent.json. Note: While this version of the card will be usable soon, the dynamic rewriting of the agent's url currently does not work with Cloud Run, so we won't use it in this version of this lab.Deploy the agent to Cloud Run as an A2A server with the following command:
You will be prompted to allow unauthenticated responses for this container. For the sake of lab testing, enter Y into the Cloud Shell Terminal (for "yes") and press return.
PERMISSION_DENIED error, try running the above command again.
Expected output:
You will see steps relating to building a Dockerfile and deploying the container, then deploying the service, followed by:
Click Check my progress to verify the objective.
In this task, you will provide a second ADK agent the ability to identify your illustration agent's capabilities and call it remotely. This second agent will be an agent tasked with creating contents for slides. It will write a headline and a couple of sentences of body text, then transfer to the illustration agent to generate an image to illustrate that text.
In the Cloud Shell Terminal, run the following command to copy the Agent Card JSON file to your adk_and_a2a directory and change its name to indicate that it represents the illustration_agent.
In the Cloud Shell Editor's file explorer pane, navigate to the adk_and_a2a/slide_content_agent and open the agent.py file.
Review this agent's instruction to see that it will take a user's suggestion for a slide, use that to write a headline & body text, and then request that your A2A agent provides an illustration for the slide.
Paste the following code under the # Agents header to add the remote agent using the RemoteA2aAgent class from ADK:
Add the illustration_agent as a sub-agent of the root_agent by adding the following parameter to the root_agent:
Save the file.
Launch the UI from the Cloud Shell Terminal with:
Once again, click the http://127.0.0.1:8000 link in the Terminal output.
A new browser tab will open with the ADK Dev UI. From the Select an agent dropdown on the left, select the slide_content_agent from the dropdown.
Query the agent with an idea for a slide:
You should see the following output:
authuser value at the end of the URL, for example changing it from authuser=0 to authuser=1. authuser=2, etc. In production you could handle this with a service account creating a Signed URL.
Expected output:
Click Check my progress to verify the objective.
In this lab, you’ve deployed an ADK agent as an A2A Server, prepared a JSON Agent Card to describe an A2A agent's capabilities, and enabled another ADK agent to read the Agent Card of your deployed A2A agent and use it as a sub-agent
...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.
Manual Last Updated January 27, 2026
Lab Last Tested January 27, 2026
Copyright 2023 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.
This content is not currently available
We will notify you via email when it becomes available
Great!
We will contact you via email if it becomes available
One lab at a time
Confirm to end all existing labs and start this one