Loading video player...
ADK A2A MCP.
If you're trying to build an agent,
you've probably come across these
acronyms. So, let's cut through the
noise. In the next 15 minutes, we are
going to do three things. Create an MCP
tool and deploy it as a server. Create
an agent with ADK.
And expose the agent via A to A and test
it. If you follow every step in this
video, you will understand these
concepts and have a working AI agent by
the end of this tutorial.
First, we'll take a look at MCP or model
context protocol. You can think of this
as a reverse proxy or an API server for
API servers.
It's a standard way to connect your AI
model to the specific resources,
prompts, and tools it needs to get a job
done.
Next, we'll use agent development kit or
[music] ADK. This is our framework for
actually building and deploying the
agent.
It's designed to make creating complex
agents [music] feel straightforward,
like software development. And finally,
we'll use the agentto agent protocol or
A toce
our agent is built. A toa provides a
common language that allows it to
communicate and collaborate with other
[music] agents, no matter who built
them, where they are hosted, or what
framework or programming language they
use. By the end of this tutorial, you'll
have hands-on experience setting up a
local MCP server and deploying it to the
cloud. You'll build your own agent using
ADK and then use the Ato protocol to
test it. To follow along, you'll need a
browser and a Google Cloud project with
billing enabled. Ready? Let's get
started.
The first thing we need to do is set up
our Google Cloud environment. If you
don't have one already, go ahead and
create a new Google Cloud project and
make sure that billing is enabled.
We'll be doing all of our work today
inside CloudShell. To open it, just
click the activate CloudShell icon in
the console. Once it's open, you'll see
you can easily toggle between the
terminal, where we'll run our commands,
and the editor where we'll browse our
code. We will be using both throughout
this tutorial.
Now, in the terminal, let's make sure
you're authenticated correctly by
running our first command. Now this part
is important.
We need to set up our project ID so that
all the resources we create are
associated with our project. Find your
project ID from the console and run
these commands, replacing your project
ID with your actual ID. We'll export it
as an environment variable first, which
makes the next command a bit cleaner.
With our project set, we need to enable
the specific APIs that our agent will
rely on. This includes APIs for Cloud
Run, Cloud Build, Artifact Registry, and
Vertex AI. This single command will
enable all of them for us. Note that
this step can take a few minutes to
complete. And one [music] last check,
this project requires Python 3.10 or
newer.
This should be the default in your cloud
shell environment, but you can quickly
verify by running the command Python
[music] 3 version. Okay, our project and
APIs are all set. Now, working in that
same cloud shell terminal, we'll need to
download the project source code. It's
important to continue in the same
session so we still have access to the
project ID variable we configured in the
last step.
First, let's clone the project's
repository from GitHub.
And once that's downloaded, we'll change
into the new project directory.
This project uses a tool called UV to
manage its Python dependencies. We'll
install it by running the curl command
shown here. Just a quick heads up, if
you get a UV notfound error in the next
steps, you may need to open a new
terminal tab for the UV installation to
be recognized.
Don't forget to CD back into the
currency agent directory if you do. Now
we need to configure our applications
environment variables. This next command
creates an N file and populates it using
the project ID variable from the
previous step. Let's quickly check the
contents of the file to make sure it was
created correctly.
You should see three variables printed
out with your project ID filled in. With
the code downloaded and our environment
configured, we can now set up the MCP
server. Now, it's time to build our
first major component of our system, the
MCP server. This server's job is to
expose tools that our agent can use. In
our case, we need a tool that can fetch
currency exchange rates. We'll use a
Python package called FastMPP to build
[music] the server. FastmcP is a Python
framework that provides a fast and
intuitive way to build servers and
clients for MCP by using simple
decorators and Python [music] functions.
Let's take a look at the code which you
can find in the MCP server server.py
file using the cloud shell editor.
The key part of this file is the get
exchange rate function. The MCP tool
decorator above it is what registers
this function as a tool that our server
will expose. The function itself calls
an external API [music] to get the
exchange rate. Now let's run this server
in our cloud shell terminal. This will
start it on port 8080.
With the server running, we need to test
it. It's important to do this in a new
cloud shell tab so you don't have to
stop the [music] server. In the new tab,
make sure you are in the currency agent
directory and run the test script. The
test script just connects to our local
host client and makes a tool call. You
should see a success message in the
output [music] showing the current
exchange rate from US dollars to euros.
This confirms our MCP server is up
[music] and running.
Perfect. Go ahead and stop the server by
pressing control C in the first terminal
tab. In the next [music] step, we'll
deploy this server to the cloud. Our MCP
server works, but it's only running in
our interactive cloud shell session,
which is temporary.
To make it a permanent and reliable tool
for our agent, we actually need to
deploy it as a standalone service. We'll
use Cloud Run for this, which provides
benefits like automatic scaling and
built-in security. First, let's navigate
into the servers directory.
Now, we'll deploy it with a single
G-Cloud command. Pay attention to the no
allow unauthenticated flag.
This is critical for security as it
ensures that only authorized accounts
can access our server.
Once that finishes, our server will be
live. But because we made it secure, we
need a way to authenticate our test
calls.
We'll use the Cloud Run proxy to create
a secure authenticated tunnel from our
Cloud Shell environment to our live
service. You may be prompted to install
the proxy if you haven't done it
already.
Now leave this proxy running. To test
it, we need to open a new cloud shell
terminal. In the new tab, navigate back
to the project's root directory.
Now run the same test script we ran
earlier. This time it'll be routed
through the proxy to our Cloud Run
server. You should see the same success
message as before. To prove it really
worked, we can even check the logs of
our deployed service right from the
command line. And there you have it, a
live secure MCP server running on Cloud
Run. Now we're ready to build an agent
that can use it.
For this, we'll use the agent
development kit or ADK.
Using the Cloud Shell editor, let's look
at the agents code in the currency
agent- a.py file.
You'll see two key parts. First, [music]
a system instruction that tells the
agent its purpose and its rules. In this
case, to only answer questions about
currency. [music]
Second, you'll see the MCP tool set.
This is the critical piece that connects
our agent to the MCP server we've
deployed in the last step, giving it
access to the get exchange rate tool.
The ADK comes with a simple web
interface for testing. Let's start it
up. Remember to leave your Cloud Run
proxy from the last step running in its
own tab. In a new terminal tab, [music]
run the ADK web command. This starts a
new server on port 8000.
To access it, go to the web preview
button in your Cloud Shell toolbar. You
may need to change the port to 8000
before launching the preview tab.
In the web page that opens, make sure
the currency agent is selected [music]
in the top left dropdown. Now ask a
question like what is 250 Canadian
dollars to USD?
It works. The ADK agent correctly used
the tool from our deployed MCP server to
answer the question.
Now let's see how to make this agent
available to other agents. [music]
Our agent can now talk to us. But the
real power of AI agents come when they
can talk to each other. For that we'll
use the agentto agent protocol or A2A.
A2A is an open protocol that
standardizes how agents collaborate
across frameworks and vendors. It is
built on standards like [music] HTTP,
SSE, and JSON RPC while ensuring
enterprisegrade security. Designed to be
modality agnostic. A2A enables agents to
work together across text, audio, video,
and other unstructured formats. A2A
allows agents to discover each other's
capabilities and collaborate on tasks.
They do this by using something called
an agent card, which is like a digital
business card. The card advertises the
agents skills. In our case, [music] we
might define a skill for our get
exchange rate tool.
Then package that skill into an agent
card which includes the agents name,
description, and other details. [music]
Now that we understand the concepts,
let's put it all together and build our
A2A server. ADK provides a utility
function called 2 A to A that does most
of the heavy lifting for us. This
function takes our existing agent
[music] and converts it into an ATA
compatible application that can be
served through Unicorn.
Under the hood, it even generates an
agent card for us. You can see this
inside currency agent-agent.py.
With just two lines of code, we've
exposed the currency agent as an ATA
server. Now, let's launch our ATA
server. Make sure that your other
processes, the Cloud Run proxy and the
ADK web server, are still running in
their own tabs.
Open a new cloud shell terminal and run
the following command.
You'll see output indicating that the
server has started on port 10,000.
[music]
Our currency agent is now officially
running as [music] an AA compliant
server ready to be called by other
clients or agents. [music] Now let's
test the A2A server. The file currency
agent-estclient.py
Pi uses the A2A Python's SDK's [music]
A2A client class to connect the agent
and run through some tests.
You'll see output confirming the client
connected successfully, sent a request,
and received a response. For example,
asking how much is 100 USD in Canadian
dollars? Will return the conversion
using live exchange rate data. A
successful run means that other programs
and agents can now communicate with our
currency agent over A to A. But if you
want to access this ATA agent from
another agent, then define a remote A2A
agent sub agent and point it to the
public agent card. Nice. You've
successfully built a complete endtoend
agentic system. Before we wrap up, it's
very important to clean up the resources
we created to avoid any future charges
to your Google Cloud account. The
simplest way to do this is to delete the
entire project. Importantly, this
deletion step is only for the purpose of
following this demo. [music] In the
Google Cloud Console, navigate to the
manage resources page. From the list,
select the project you used for this
tutorial and click delete. You'll be
prompted to type in your project ID to
confirm. Congratulations. In this video,
we covered how to create and deploy an
MCP server on Cloud Run to provide tools
for an agent. We then built that agent
using ADK and finally exposed it to
other agents to use within the Ato
protocol. Thanks so much for following
along and we can't wait to see what you
build with these powerful tools for
creating AI agents.
Explore the powerful tools and protocols for AI agent development on Google Cloud. In this video, we dive into how to connect AI models to resources using Model Context Protocol (MCP), streamline agent creation with the Agent Development Kit (ADK), and enable seamless communication between agents with the Agent2Agent (A2A) protocol. By the end, you will have a working AI agent system, while understanding its underlying architecture. Resources: Getting Started with MCP, ADK and A2A → https://goo.gle/48scfNV Build with Vertex AI: Deploy Agents with Agent Development Kit (ADK), MCP, and A2A → https://goo.gle/48LAwjm ADK samples GitHub → https://goo.gle/3Y5OC96 Chapters: 0:00 - Introduction 0:38- Understanding ADK, A2A, and MCP 2:02 - Setting up your Google Cloud environment 3:09 - Enabling Google Cloud APIs 5:04 - Building the MCP server for tools 6:57 - Deploying the MCP server to Cloud Run 8:42 - Creating your AI agent with ADK 10:21 - Exposing your agent via A2A 12:28 - Testing the A2A communication 13:29 - Cleaning up your Google Cloud project 14:02 - Conclusion: building with AI agents Subscribe to Google for Developers → https://goo.gle/developers Speaker: Julia Wiesinger Products Mentioned: Google AI, Agent Development Kit (ADK)