← All transcripts

How to deploy an AI agent to Cloud Run (step by step) Transcript, AI Summary & Key Points

Google Cloud Tech · Jul 08, 2026 · Science & Technology · 13:44 · EN-US

💡 Answer

Set up a Python agent with ADK, configure its environment and service-account permissions, then use the ADK deploy command to build a container, push it to Artifact Registry, and create a Cloud Run service.

🧠 AI Summary

A Python AI agent built with the Agent Development Kit (ADK) can be deployed to Google Cloud Run using a container, a dedicated service account, and a single deploy command. Cloud Run automatically scales containers up during traffic spikes and down to zero when idle, while handling load balancing, TLS, logs, and identity. The demonstrated zoo tour guide agent uses a secure Model Context Protocol (MCP) server and a Wikipedia tool, with separate researcher and presenter agents connected through a sequential workflow.

🔑 Key Points

  • Cloud Run starts containers when requests arrive, adds more copies when traffic spikes, and scales to zero when nobody is using the agent.
  • Cloud Run handles scaling, load balancing, TLS, logs, and identity for the deployed container.
  • The project requires a Google Cloud account and Project IDX, followed by a Cloud Shell workspace.
  • The deployment depends on Cloud Run, Cloud Build, Artifact Registry, Vertex AI, and compute APIs.
  • A dedicated service account must be granted permission to call Vertex AI and, when protected, invoke the MCP server.
  • The agent uses an MCP server for zoo enclosure information and a Wikipedia tool for general facts.
  • The researcher agent chooses between the zoo MCP server and the Wikipedia tool, while the presenter agent turns the research into a friendly response.
  • A sequential workflow passes state from the researcher to the presenter, and a root agent serves as the entry point for new conversations.

💡 Business ideas

A publicly accessible AI zoo tour guide agent deployed on Cloud Run00:24

A domain-specific conversational agent that answers visitor questions by combining private zoo information from an MCP server with general facts from Wikipedia, then presents the research in a friendly response. Cloud Run provides a scalable, serverless home with a public URL.

For
Zoo visitors who want enclosure-specific information and general facts about animals.
Solves
Visitors need a conversational way to find zoo-specific details and broader animal information without manually searching multiple sources.
  • Zoo tour guide agent: answers a question about where polar bears are located by calling the zoo MCP server for enclosure details and Wikipedia for information about their diet.
Soon you can unlock the full business plan.

Behind this: 18 build steps · 11 tools and how each is used · how to validate demand · 7 things the video never answers.

Inquire for details

🤖 AI in practice

Used for

Deploy a Python zoo tour guide AI agent from source to Cloud Run so it is available through a public URL. 00:04
Connect the agent securely to an MCP server and invoke protected tools at runtime. 00:20
Use a general-knowledge lookup to retrieve facts that are not specific to the zoo. 07:16
Pass the visitor's initial prompt between the zoo tour guide agents. 06:53
Run the agent's model calls on Vertex AI after deployment. 04:54
Observe agent prints and warnings while testing the deployed service. 07:27

Agents

  • researcher agent — Answer visitor questions by researching zoo-specific information and general facts. 2 held 08:42
  • sequential workflow agent — Coordinate the research and response-formatting stages of the zoo tour guide. 2 held 09:31
  • root agent — Handle the start of a new visitor conversation and route it into the zoo tour guide workflow. 2 held 09:48

🔗 Links mentioned

The rest of this analysis is held back.

Behind this: 7 advice · 4 ai usage · 4 lessons · 4 limitations · 4 risks · 11 tools.

Inquire for details

From this video

1 product

LangChain

1 business idea

📄 Transcript

Searchable transcript of How to deploy an AI agent to Cloud Run (step by step) — Google Cloud Tech (13:44). Search for a phrase, then click its timestamp to jump straight to that moment in the video.

Captions sourced from the original video on YouTube, published by Google Cloud Tech. The video, its captions and all related intellectual property remain the property of their respective owners; AINotes claims no ownership. Provided for research, accessibility and search — see the Transcript Notice and Copyright Policy.

00:04 If your AI agent only runs on your laptop, this video will show you exactly how to deploy it to Cloud Run. In the next few minutes, we will take your local AI agent and put it on the internet in a clean, reliable way using Cloud Run. The Asian Development Genkit and a secure connection to an MCP server. By the end of this video, you will have a working zoo tour guide agent running on Cloud Run with a public URL that you can click on and play around with.

00:35 We'll also go step by step through the project, setup the code you need, the service account and permissions that make everything work, and also the single command that builds and deploys the container, as well as a quick test in the browser before we touch code. A quick mental model of how Cloud Run works. Think of it like a pop up shop. When a request arrives, it opens a container that runs your app when traffic spikes.

01:06 Cloud Run brings up more copies for you. When nobody is visiting your agent, it scales to 0 and you pay nothing for the idle time. You bring a container that listens on a port and Cloud Run handles the rest from scaling, load balancing, TLS logs, and identity. That's why it's a great fit for deploying AI agents. Your agents can sit quietly until somebody actually wants to use it, and at that point it wakes up, serves a request, and goes back to sleep.

01:39 Here's the plan. We'll create a simple Python project for the agent using SDK, and we will build tools. We'll point it to your MCP server. We'll set up a service account with the right permissions, and then run a single deploy command to deploy it. When it's done, you will have a URL which contains your agent. In order to follow along with this project, you need two things.

02:06 You need a Google Cloud account, and also you need a Project IDX to get your Google Cloud account. Head on over to cloud.google.com. There's also a link for it in the description box below, which will allow you to easily create a free account by clicking that. Once you've created your free account, you then want to go and create a Project IDX. The instructions to create a Project IDX can be found in step three of this codelab.

02:34 It's actually super easy to set up, and this codelab will walk you through exactly how you can do that. This codelab build and deploy an SDK agent that uses an MCP server on Cloud Run is the project that we are building in this video. And all of the steps that I'm going to be talking about in this video can also be found in all these steps in this codelab.

02:57 So this is a great reference for you. And the link for this codelab can also be found in the description box below. So once you've created your Google Cloud account and you have set up your Project IDX, the home page of your Google Cloud Console should look something like this. And what you now need to do is open up Cloud Shell. You can click this icon at the top right hand corner in order to do that.

03:20 Or you can type in Cloud Shell in the search bar at the very top. And that will also let you open that. Let's start off by confirming that you are on the right Google Cloud project. Open Cloud Shell in Google Cloud Console and run this one line to select your project. Next, enable the services that the deployment of our agent depends on. So Cloud Run needs the run API which helps to build containers using Cloud Build and Artifact Registry.

03:52 Your agent calls Vertex AI models and compute APIs are required under the hood. This is a one time step per project. When it finishes, you'll see a long operation string with finished successfully. Next, create a Workspace for the agent in Cloud Shell. Make a fresh folder and step into it. Then create a requirements.txt file. Keep dependencies really simple in your container so that it stays small and cold.

04:22 Starts are reasonable. For this lab, we'll be making use of ADK small Wikipedia helper as well as LangChain adapter. To keep the example really straightforward. Paste all of the libraries that are required, and make sure to pin the version so that you avoid any surprise. Breaking changes when libraries get updated. If you're following the codelab, use exactly the following commands.

04:48 Now set a few environment variables so that the scripts and code can discover your project and identity. You'll also create a dedicated service account that your Cloud Run service will use at runtime. That identity needs permission to call Vertex AI. And if your MCP server is protected, permissions to also invoke that server. Next, let's create a simple env file.

05:15 This is where you declare your model choice and save the MCP server URL. Using a env file keeps secrets and configuration out of your code. In Cloud Run, you'll still configure sensitive items with environment variables or Secret Manager, but for this lab, we'll keep it really simple by using a env file. Add 1 line for the model now and next give your new service account permission to invoke the MCP server.

05:46 This is the piece that many people forget, and it leads to a lot of 403 errors. So we need to bind the runt invoker role in your project so that your agent can call the MCP server securely. Now write the MCP server URL into the env file with configuration ready. Create a tiny package for your agent. The init.py file hints to Python that this directory is importable, and it also lets a.d.k know where your agent directory is located.

06:21 So next let's add one import so that the package exposes the agent module. After you're done, open the new agent py file. We'll start building the agent in small pieces in this file. At first step we have adding all of the imports and logging details. Then we will load environment variables, declare our model name and set up the tools. So first off, start copying this code and pasting it into your agent py file.

06:53 This agent will use three capabilities a simple function that stores the user's first prompt in a shared state so that it can be passed on to other agents, which are part of our zoo tour guide agent framework. And second, an MCP toolset that connects to the secure zoo MCP server, as well as the final tool, which is a Wikipedia lookup tool for looking up general facts.

07:20 So let's start off with the imports and environment setup. Cloud Logging here is not just meant for neatness. It means you'll see your agents prints and warnings show up in the Logs Explorer in Google Cloud Console, which is exactly what you want during testing. Next, add a tiny helper tool to store the visitor's first prompt. This becomes a glue between the greeter and the researcher.

07:45 It writes into the shared tool state dictionary so that the next agent in the chain can read it. So keep this really simple and explicit. After that, we'll be setting up the MCP tool. Next, you'll read the MCP server URL from the env file that we created previously. If your MCP server requires authentication, which it should in production, you will fetch a signed ID token for the Cloud Run audience and pass it as a bearer token on each call.

08:17 The adc's streamable HTTP connection params makes this straightforward. Finally, add a general knowledge tool which makes use of the LangChain adapter and wraps the Wikipedia query so that you can keep this file focused on orchestration rather than search client code. With tools ready, we'll next define two specialist agents. The first is the researcher agent.

08:44 It reads the user's prompts from the state and chooses between using the zoo MCP server or the Wikipedia tool that we've created. And if it requires it to use both. That's what it will do. In order to answer the question that you ask your agent. We're going to keep the instructions really short and concrete and focused on behavior rather than style.

09:05 We're also going to be giving it an output key so that the next agent can pick up the results. The second agent that we're going to be creating is the presenter agent. It doesn't call tools, but it takes a raw research and writes a friendly response that starts with what's specific to the zoo, and then adds interesting general facts. Next, we'll wrap both into a small workflow using a sequential workflow agent.

09:34 It runs a researcher and then the formatter, passing the state through each step. You can evolve this later into more complex patterns. If you want to make use of loop agents or parallel all agents. We'll finish off our agent file with something really important, which is called a root agent. This is the entry point for new conversations. And this is also what aidc expects.

09:58 It greets the visitor, uses your small helper tool to save their first message into the state. And then once that context into the workflow that we've created, keeping the greeting separate makes the flow easy to follow in the logs when you debug. So that's all for the code in our agent file. Now wire up permissions so that the deployed service can actually call models.

10:23 We'll first start off by sourcing our env file into the shell so that the model value is visible during build. And then we will grant Vertex AI user role to your service account. Without this role your service will start fine, but model calls will fail at runtime with permission errors. We're now ready to deploy the SDK. Ships a deploy command that does a lot for you.

10:48 It builds a container from your source, pushes it to Artifact Registry, and creates a Cloud Run service with sensible defaults. We'll also be making use of UX so that we don't have to install the CLI globally. Pass your project region the service name you want, along with a flag titled with UI so that you can get the SDK web UI up for quick testing.

11:15 Also tell it which service account to run as and tag the service with a label so you can find it later. You'll get a couple of prompts. Cloud Run will ask to create a repository named Cloud Run source deploy in your region. If you don't have one yet, so say yes. It may ask if you want to allow unauthenticated access for this lab. Say yes so you can click the link from anywhere in a production setup.

11:41 You want to keep the service private and fronted with an authenticated proxy or a back end integration. When the command finishes, it prints a URL that looks something like this. That's your live agent. Click it and start playing around with adc's web UI. You can start off by toggling token streaming in the right hand corner, so you can watch the model think in real time.

12:06 Type in hello and press Enter and see what you're greeted with. Then ask something like, where can I find the polar Bears here. And what do they eat in the wild. And watch the workflow happen. You'll see our researcher agent calling both our MCP server for the enclosure details, and also calling the Wikipedia tool for info on the polar bear's diet. When you're done testing, clean up so you don't keep resources around.

12:35 You can delete just the service, or you can also delete the build repository if you created it just for this lab. The two lines below remove the Cloud Run service and the default source deploy repository in the same region. Add the quiet flag if you want to skip prompts. And before we wrap up a final check on what we just did deployed an AI agent that knows how to use tools exposed by an NCP server, as well as the Wikipedia tool.

13:04 And you did it in a way that scales, sleeps, logs, and respects identity. Cloud Run gives that system a home without asking you to manage machines. And because you used MCP for tools, you can keep adding capabilities without rewriting the glue. The link for this lab will be in the description box below. I hope you found this video helpful and happy building.