<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Huey Bai</title>
    <description>The latest articles on DEV Community by Huey Bai (@shvlev9cywkk).</description>
    <link>https://dev.to/shvlev9cywkk</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3278592%2Fdefffd5b-e228-4e2b-a5dd-3b61e85b98c6.jpeg</url>
      <title>DEV Community: Huey Bai</title>
      <link>https://dev.to/shvlev9cywkk</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shvlev9cywkk"/>
    <language>en</language>
    <item>
      <title>🚀One-Click Deployment of Your Multi-Agent System to Cloud Run with Google ADK</title>
      <dc:creator>Huey Bai</dc:creator>
      <pubDate>Fri, 20 Jun 2025 06:04:19 +0000</pubDate>
      <link>https://dev.to/shvlev9cywkk/one-click-deployment-of-your-multi-agent-system-to-cloud-run-with-google-adk-2l50</link>
      <guid>https://dev.to/shvlev9cywkk/one-click-deployment-of-your-multi-agent-system-to-cloud-run-with-google-adk-2l50</guid>
      <description>&lt;p&gt;Are you exploring Google's &lt;strong&gt;Agent Development Kit (ADK)&lt;/strong&gt; to build powerful multi-agent systems? Do you want to quickly bring your hard-built agents online but feel intimidated by complex containerization and deployment processes? Don't worry! This article will guide you step-by-step on how to use the &lt;code&gt;adk deploy&lt;/code&gt; command to seamlessly deploy your ADK project to Google Cloud Run, all without writing a single line of Dockerfile!&lt;/p&gt;

&lt;p&gt;Ready? Let's unlock the superpower of agent deployment!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This blog was created while participating in the Agent Development Kit Hackathon.&lt;/strong&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  📘 What is Google ADK?
&lt;/h3&gt;

&lt;p&gt;Before diving into deployment, let's briefly understand ADK. The &lt;strong&gt;ADK (Agent Development Kit)&lt;/strong&gt; is a powerful open-source framework from Google, designed for building, testing, and deploying multi-agent systems based on Large Language Models (LLMs). It provides a core set of capabilities that allow you to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Define LLM Agents with reasoning and task capabilities:&lt;/strong&gt; Easily create agents that can understand instructions and execute tasks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Extend Agent behavior with Tools:&lt;/strong&gt; Equip your agents with the ability to perform complex tasks by integrating custom tool functions (e.g., searching, calculating, calling external APIs).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Control flow with Workflow Agents:&lt;/strong&gt; Orchestrate multiple agents to implement complex business processes like sequences, parallel execution, or loops.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Persist context with State and Memory Systems:&lt;/strong&gt; Enable agents to maintain context across multiple turns of conversation, providing a more coherent interaction experience.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;ADK comes with deep integration for &lt;strong&gt;Gemini models&lt;/strong&gt; by default and also supports connecting to other major LLM models like OpenAI and Anthropic via &lt;strong&gt;LiteLLM&lt;/strong&gt;, giving you great flexibility.&lt;/p&gt;




&lt;h3&gt;
  
  
  🧭 Why Deploy to Cloud Run?
&lt;/h3&gt;

&lt;p&gt;Deploying your ADK project to &lt;strong&gt;Google Cloud Run&lt;/strong&gt; is an ideal choice for several reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fully Managed Serverless Platform:&lt;/strong&gt; You don't need to manage underlying servers, operating systems, or clusters; Google Cloud Run handles all the infrastructure for you.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;On-Demand Start / Auto-Scaling:&lt;/strong&gt; Services only start when requested and automatically scale down to zero when there's no traffic, significantly saving costs. During traffic peaks, it also auto-scales horizontally to ensure your service remains highly available.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Built-in HTTPS and IAM Security Controls:&lt;/strong&gt; Cloud Run automatically provides an HTTPS endpoint for your service and integrates deeply with Google Cloud IAM for easy, fine-grained access control.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Supports Containerized Applications (Perfect for ADK's API Server Mode):&lt;/strong&gt; ADK projects can run in API Server mode, which perfectly fits Cloud Run's containerized deployment environment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One-Click Deployment with &lt;code&gt;adk deploy&lt;/code&gt;:&lt;/strong&gt; Most importantly, ADK provides the &lt;code&gt;adk deploy&lt;/code&gt; command, allowing you to deploy your project to Cloud Run with minimal effort, skipping the tedious Docker build and push steps.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  📂 Project Structure (Must Follow Official Guidelines)
&lt;/h3&gt;

&lt;p&gt;For the &lt;code&gt;adk deploy&lt;/code&gt; command to correctly identify and deploy your project, your ADK project must follow a specific structure. For a Python project, your directory should look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;your-adk-project/
├── multi_tool_agent/            # Your agent project directory; this name will be the Cloud Run service name
│   ├── __init__.py              # Can be empty, but must exist to signify a Python package
│   └── agent.py                 # Your core agent logic file, must contain the root_agent definition
├── requirements.txt             # Your Python project dependencies; `adk deploy` will install these automatically
└── .env                         # (Optional) Environment variables for local testing or cloud deployment
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In your &lt;code&gt;agent.py&lt;/code&gt; file, you &lt;strong&gt;must&lt;/strong&gt; define an &lt;code&gt;Agent&lt;/code&gt; instance named &lt;code&gt;root_agent&lt;/code&gt;; this will be the default entry point that ADK automatically looks for:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;google.adk.agents&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Agent&lt;/span&gt;

&lt;span class="n"&gt;root_agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;weather_agent&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gemini-2.0-pro&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;instruction&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;You are a helpful assistant that provides weather information.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[],&lt;/span&gt;  &lt;span class="c1"&gt;# Define your tool functions here, like a tool to query a weather API
&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Important Note:&lt;/strong&gt; The variable name &lt;code&gt;root_agent&lt;/code&gt; is fixed and cannot be changed. The ADK deployment tool looks for this specific name to start your agent service.&lt;/p&gt;




&lt;h3&gt;
  
  
  🧪 Local Testing (Optional but Highly Recommended)
&lt;/h3&gt;

&lt;p&gt;Before deploying your project to the cloud, it's highly recommended to thoroughly test it locally to ensure everything works as expected. This helps you quickly identify and resolve issues, avoiding unnecessary deployment failures.&lt;/p&gt;

&lt;p&gt;First, create an &lt;strong&gt;&lt;code&gt;.env&lt;/code&gt;&lt;/strong&gt; file in your project's root directory (if it doesn't already exist) and configure it as follows to enable &lt;strong&gt;local&lt;/strong&gt; testing using a Gemini API Key:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# .env file for local testing
GOOGLE_GENAI_USE_VERTEXAI=False
GOOGLE_API_KEY= PASTE_YOUR_ACTUAL_API_KEY_HERE
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The &lt;code&gt;GOOGLE_API_KEY&lt;/code&gt; here is the API key you obtained from Google AI Studio.&lt;/p&gt;

&lt;p&gt;Then, from your project's root directory, run the following command to start ADK in local run mode:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;adk run multi_tool_agent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can immediately test conversations with your agent in the terminal. This will simulate how your agent behaves after deployment.&lt;/p&gt;




&lt;h3&gt;
  
  
  ☁️ Cloud Run Automatic Deployment
&lt;/h3&gt;

&lt;p&gt;Now, for the exciting part! Let's get your ADK project deployed to Cloud Run.&lt;/p&gt;

&lt;h4&gt;
  
  
  🔧 Step 1: Prepare Your Google Cloud Environment
&lt;/h4&gt;

&lt;p&gt;Before deploying, ensure you have the &lt;code&gt;gcloud CLI&lt;/code&gt; installed and configured:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Log in to your GCP account:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gcloud auth login
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;This will open your browser and guide you through the Google account login process.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Set your default project:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gcloud config &lt;span class="nb"&gt;set &lt;/span&gt;project YOUR_PROJECT_ID
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;Replace &lt;code&gt;YOUR_PROJECT_ID&lt;/code&gt; with your Google Cloud project ID. &lt;strong&gt;It's highly recommended to create a new, separate Cloud Project for testing your ADK project&lt;/strong&gt; to better manage resources and permissions.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Set your deployment region:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gcloud config &lt;span class="nb"&gt;set &lt;/span&gt;run/region us-central1
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;Choose a region closest to your users, such as &lt;code&gt;us-central1&lt;/code&gt; (Central US), &lt;code&gt;europe-west1&lt;/code&gt; (Western Europe), or &lt;code&gt;asia-southeast1&lt;/code&gt; (Southeast Asia).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Enable the Cloud Run API:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gcloud services &lt;span class="nb"&gt;enable &lt;/span&gt;run.googleapis.com
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;Ensure the Cloud Run API is enabled for your project; otherwise, deployment will fail.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  🚀 Step 2: Configure Your &lt;code&gt;.env&lt;/code&gt; File for Cloud Run Deployment
&lt;/h4&gt;

&lt;p&gt;Before deploying to Cloud Run, you need to &lt;strong&gt;modify&lt;/strong&gt; the &lt;strong&gt;&lt;code&gt;.env&lt;/code&gt; file&lt;/strong&gt; in your project's root directory to configure ADK to use the Gemini model on &lt;strong&gt;Vertex AI&lt;/strong&gt;. Change the file content to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# .env file for Cloud Run deployment
GOOGLE_GENAI_USE_VERTEXAI=TRUE
GOOGLE_CLOUD_PROJECT=YOUR_CLOUD_PROJECT_ID # Replace with your actual GCP Project ID
GOOGLE_CLOUD_LOCATION=global # Keep this as global
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Important Note:&lt;/strong&gt; &lt;code&gt;GOOGLE_CLOUD_PROJECT&lt;/code&gt; needs to be replaced with your GCP project ID, while &lt;code&gt;GOOGLE_CLOUD_LOCATION&lt;/code&gt; should remain &lt;code&gt;global&lt;/code&gt;. With this configuration, your Cloud Run service account will automatically gain permission to access Vertex AI, and you won't need a separate &lt;code&gt;GOOGLE_API_KEY&lt;/code&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  🚀 Step 3: Deploy with the &lt;code&gt;adk deploy&lt;/code&gt; Command
&lt;/h4&gt;

&lt;p&gt;Make sure you've saved your modified &lt;code&gt;.env&lt;/code&gt; file, then navigate to your ADK project's root directory (where &lt;code&gt;multi_tool_agent&lt;/code&gt; is located) and run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;adk deploy cloud_run &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--project&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;YOUR_CLOUD_PROJECT_ID &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--region&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;YOUR_CLOUD_LOCATION &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--service_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;multi-tool-agent-service &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--with_ui&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  ./multi_tool_agent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Again, replace &lt;code&gt;YOUR_CLOUD_PROJECT_ID&lt;/code&gt; and &lt;code&gt;YOUR_CLOUD_LOCATION&lt;/code&gt; with your actual GCP project ID and region (e.g., &lt;code&gt;us-central1&lt;/code&gt;). The &lt;code&gt;--service_name&lt;/code&gt; parameter allows you to specify the name of your Cloud Run service after deployment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here's the highlight: The &lt;code&gt;--with_ui&lt;/code&gt; parameter will deploy a Cloud Run service with an interactive UI.&lt;/strong&gt; This will greatly simplify interacting with and debugging your agent.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;adk deploy&lt;/code&gt; command will automatically handle these complex operations for you:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Package your project into a Docker image:&lt;/strong&gt; ADK intelligently analyzes your project's dependencies and structure to automatically generate a Docker image suitable for Cloud Run.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Push the image to Artifact Registry:&lt;/strong&gt; The generated Docker image will be pushed to your Google Cloud project's Artifact Registry, a secure and efficient image repository service.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Create and deploy the Cloud Run service:&lt;/strong&gt; Finally, ADK uses this image to create a new service on Cloud Run and completes the deployment.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Upon successful deployment, you'll see output in your terminal similar to this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Deployment successful!
Service URL: https://multi-tool-agent-service-xxxxx.a.run.app
UI URL: https://multi-tool-agent-service-xxxxx.a.run.app/ui
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;Service URL&lt;/strong&gt; is the API endpoint for your agent service.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;UI URL&lt;/strong&gt; is a browser-based interactive user interface where you can directly chat with your agent and view its thought process (Event Trace). This is incredibly useful for debugging and demonstrations!&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  📮 Interactive Interface and API Access
&lt;/h3&gt;

&lt;p&gt;Once deployed, you'll have two primary ways to interact with your agent:&lt;/p&gt;

&lt;h4&gt;
  
  
  🚀 Method 1: Experience Your Agent via the Interactive UI (Recommended!)
&lt;/h4&gt;

&lt;p&gt;Simply open the &lt;strong&gt;UI URL&lt;/strong&gt; (e.g., &lt;code&gt;https://multi-tool-agent-service-xxxxx.a.run.app/ui&lt;/code&gt;) directly in your browser.&lt;/p&gt;

&lt;p&gt;You'll see a chat-like console where you can directly type questions to interact with your agent. This UI not only provides a convenient way to interact but also often displays the agent's internal execution flow (such as tool calls, LLM calls, state changes), which is crucial for understanding and debugging agent behavior.&lt;/p&gt;

&lt;h4&gt;
  
  
  💻 Method 2: Programmatic Access via the API Interface
&lt;/h4&gt;

&lt;p&gt;Your Cloud Run service exposes a &lt;code&gt;/run&lt;/code&gt; endpoint that accepts JSON requests from clients. You can use &lt;code&gt;curl&lt;/code&gt; or other programming languages (like Python, JavaScript) to call this API.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;API Request Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST https://multi-tool-agent-service-xxxxx.a.run.app/run &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"query": "What’s the weather like in Tokyo?"}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If all goes well, you'll receive a response from your agent, such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"response"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"The weather in Tokyo is sunny and 23°C."&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  🛠️ Common Issues and Solutions
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Issue&lt;/th&gt;
&lt;th&gt;Solution&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;GOOGLE_API_KEY&lt;/code&gt; not set (local)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Ensure your &lt;strong&gt;&lt;code&gt;.env&lt;/code&gt; file&lt;/strong&gt; is correctly configured with &lt;code&gt;GOOGLE_GENAI_USE_VERTEXAI=False&lt;/code&gt; and your &lt;code&gt;GOOGLE_API_KEY&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;LLM authentication issues during Cloud Run deployment&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;When deploying to Cloud Run, ensure you have &lt;strong&gt;modified your &lt;code&gt;.env&lt;/code&gt; file&lt;/strong&gt; to include &lt;code&gt;GOOGLE_GENAI_USE_VERTEXAI=TRUE&lt;/code&gt;, &lt;code&gt;GOOGLE_CLOUD_PROJECT=YOUR_CLOUD_PROJECT_ID&lt;/code&gt;, and &lt;code&gt;GOOGLE_CLOUD_LOCATION=global&lt;/code&gt;. The Cloud Run service account typically automatically gets permissions to access Vertex AI, so a separate API Key isn't needed. If you still encounter issues, check if your Cloud Run service account has the necessary Vertex AI permissions (e.g., &lt;code&gt;Vertex AI User&lt;/code&gt; role).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Service deploys but returns 403 Forbidden&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;By default, Cloud Run services are private. If you want external access, ensure you add the &lt;code&gt;--allow-unauthenticated&lt;/code&gt; flag during deployment, e.g., &lt;code&gt;adk deploy cloud_run ... --allow-unauthenticated&lt;/code&gt;. Alternatively, check your Cloud IAM permissions to ensure the caller has the &lt;code&gt;Cloud Run Invoker&lt;/code&gt; role.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;root_agent&lt;/code&gt; not defined&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Your &lt;code&gt;agent.py&lt;/code&gt; file &lt;strong&gt;must&lt;/strong&gt; contain the definition &lt;code&gt;root_agent = Agent(...)&lt;/code&gt;. Double-check that the variable name is &lt;code&gt;root_agent&lt;/code&gt;, as this is the convention ADK uses to find the agent's entry point.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Need to pass multiple environment variables&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;ADK automatically reads environment variables from your &lt;strong&gt;&lt;code&gt;.env&lt;/code&gt; file&lt;/strong&gt; and passes them to the Cloud Run service. Therefore, you only need to add all required environment variables to your &lt;code&gt;.env&lt;/code&gt; file. For sensitive variables, it's highly recommended to use Secret Manager.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Deployment times out or fails with insufficient memory&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Your agent or tools might require more memory. Try specifying a larger memory limit in the &lt;code&gt;adk deploy&lt;/code&gt; command, e.g., &lt;code&gt;adk deploy cloud_run ... --memory=2Gi&lt;/code&gt;. The default memory is typically 512 MiB.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Deployment fails, missing dependencies&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Ensure your &lt;code&gt;requirements.txt&lt;/code&gt; file includes all necessary Python dependencies for your project. &lt;code&gt;adk deploy&lt;/code&gt; automatically reads and installs these dependencies. If deployment fails, check the build logs for any &lt;code&gt;pip install&lt;/code&gt; related errors.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;My tool functions need to access external services (e.g., database, other APIs) but can't after deployment&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Ensure your Cloud Run service has network access to these external services. For example, if you need to access Cloud SQL, ensure your Cloud Run service account has the appropriate Cloud SQL Client role, and the Cloud Run service is connected to a VPC Access Connector. If accessing external APIs, check firewall rules or proxy settings. &lt;strong&gt;Never hardcode sensitive credentials in your code.&lt;/strong&gt; Use Secret Manager or IAM credentials to securely manage these access tokens.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h3&gt;
  
  
  🧠 Advanced Tips
&lt;/h3&gt;

&lt;p&gt;Once you've mastered basic deployment, consider these advanced tips to make your ADK development and debugging even more efficient:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;adk web&lt;/code&gt;:&lt;/strong&gt; Launch a local development UI that supports real-time agent debugging and event tracing, giving you a visual understanding of your agent's thought process and tool calls.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;adk api_server&lt;/code&gt;:&lt;/strong&gt; Start a local API service similar to the Cloud Run service for REST API integration testing, allowing you to simulate the cloud environment locally.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use &lt;code&gt;.adkignore&lt;/code&gt;:&lt;/strong&gt; Similar to &lt;code&gt;.gitignore&lt;/code&gt;, you can create an &lt;code&gt;.adkignore&lt;/code&gt; file to exclude unnecessary files or directories during packaging, which speeds up image build times and reduces image size. For example, you can ignore local test logs or virtual environment directories.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  📌 Best Practices
&lt;/h3&gt;

&lt;p&gt;To build robust, efficient, and maintainable ADK agent systems, consider the following best practices:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Clear Tool Function Docstrings:&lt;/strong&gt; Write clear and accurate &lt;code&gt;docstring&lt;/code&gt;s for your tool functions. LLMs use these docs to understand the tool's functionality, enabling them to call it correctly when needed. Good documentation is the foundation of agent reliability.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Strategic Use of &lt;code&gt;output_key&lt;/code&gt;:&lt;/strong&gt; Save key outputs from your agents to the &lt;code&gt;state&lt;/code&gt; using &lt;code&gt;output_key&lt;/code&gt; for naming. This helps persist context across multi-turn conversations and makes state information accessible to subsequent agents or workflows.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Organize Workflows with &lt;code&gt;SequentialAgent&lt;/code&gt;:&lt;/strong&gt; For complex business logic, use &lt;code&gt;SequentialAgent&lt;/code&gt; to chain multiple agents. This creates a clear, logical structure for your agent pipeline and makes each step easier to test independently.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security First:&lt;/strong&gt; Avoid hardcoding API keys or sensitive information directly in your code. For production environments, it's highly recommended to use &lt;strong&gt;Google Cloud Secret Manager&lt;/strong&gt; to securely store and manage these credentials and mount them as environment variables in your Cloud Run service.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Logging and Monitoring:&lt;/strong&gt; After deployment, closely monitor your Cloud Run logs and metrics. Google Cloud Logging and Monitoring provide powerful tools to help you debug issues and analyze performance.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  ✅ Summary
&lt;/h3&gt;

&lt;p&gt;In just a few simple steps, you should now be able to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Build a well-structured ADK project.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Flexibly configure your &lt;code&gt;.env&lt;/code&gt; file based on your deployment target (local or cloud).&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Deploy with a single &lt;code&gt;adk deploy&lt;/code&gt; command.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Get a fully functional Cloud Run service online!&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This greatly simplifies the deployment process for multi-agent systems, allowing you to bring your agent systems online quickly without needing to master complex container packaging, Kubernetes, or other low-level knowledge. Your agent is now ready to serve the world from the cloud!&lt;/p&gt;




</description>
      <category>adkhackathon</category>
      <category>googleadk</category>
      <category>googlecloud</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
