Lab 32: Deploying the Customer Support Agent Challenge
Goal
In this lab, you will take the multi-agent customer support system you built in Module 15 and deploy it to Google Cloud Run. This will make your agent accessible via a public URL, transforming it from a local project into a shareable, cloud-hosted service.
Prerequisites
- A Google Cloud Project with billing enabled.
- You have completed Module 2 and have the Google Cloud CLI installed and authenticated (
gcloud auth loginandgcloud auth application-default login). - You have been granted the
OwnerorEditorIAM role in your GCP project, which is necessary for the deployment command to enable APIs and set permissions. - Required APIs: Ensure the following APIs are enabled in your project:
- Cloud Run API
- Cloud Build API
- Artifact Registry API
- Vertex AI API
- Set GCP Project: Before starting, ensure your
gcloudCLI is configured to the correct project:gcloud config set project YOUR_PROJECT_ID
Step 1: Prepare Your Project for Deployment
The adk deploy cloud_run command is a powerful tool that automates most of the deployment process. Let's prepare our project and then use the command.
-
Navigate to your training directory:
cd /path/to/your/adk-training -
Create a new project for this lab: We'll use the multi-agent customer support system from Module 15. Let's create a fresh copy to ensure it's set up correctly.
# Create the main project directory
mkdir customer-support-cloud
cd customer-support-cloud
# Create the agent subdirectory
adk create --type=config support_agent
cd support_agent -
Re-create the agent files: Inside the
support_agentdirectory, create the three YAML files from Module 15.-
billing_agent.yaml:name: billing_agent
model: gemini-2.5-flash
description: "Handles questions about billing, invoices, and payments."
instruction: "You are a billing support agent. Politely answer questions about billing and payment issues." -
tech_support_agent.yaml:name: tech_support_agent
model: gemini-2.5-flash
description: "Handles technical support questions and troubleshooting."
instruction: "You are a technical support agent. Help users troubleshoot technical issues and provide clear solutions." -
root_agent.yaml:name: router_agent
model: gemini-2.5-flash
description: "The main customer support router."
instruction: |
You are the customer support router.
Your job is to understand the user's request and delegate it to the correct specialist agent.
- If the user has a question about billing, delegate to the `billing_agent`.
- If the user has a technical problem, delegate to the `tech_support_agent`.
sub_agents:
- config_path: billing_agent.yaml
- config_path: tech_support_agent.yaml
-
-
Configure the
.envfile for Vertex AI: Cloud Run deployments work best with Vertex AI. Open the.envfile and configure it for your project.GOOGLE_GENAI_USE_VERTEXAI=1
GOOGLE_CLOUD_PROJECT=<your_gcp_project>
GOOGLE_CLOUD_LOCATION=us-central1Replace
<your_gcp_project>with your actual Google Cloud Project ID.
Step 2: Deploy the Agent to Cloud Run
Now for the main event. We will use a single command to package, containerize, and deploy our agent.
-
Navigate back to the project root: Make sure you are in the
customer-support-clouddirectory (the parent ofsupport_agent).cd .. -
Run the deployment command:
Execute the following command, replacing
YOUR_PROJECT_IDwith your Google Cloud Project ID.adk deploy cloud_run \
--project=YOUR_PROJECT_ID \
--region=us-central1 \
--with_ui \
support_agent/Command Breakdown:
adk deploy cloud_run: The main command.--project=YOUR_PROJECT_ID: Specifies which Google Cloud project to deploy to.--region=us-central1: Specifies the geographical region for the deployment.--with_ui: This crucial flag tells the command to include the ADK Developer UI in the deployment, so we can interact with it in a browser.support_agent/: The path to the directory containing our agent's configuration.
-
Follow the Prompts:
- The command may ask you to enable certain APIs if they are not already enabled. Type
yand press Enter to approve. - It will eventually ask:
Allow unauthenticated invocations to [service-name] (y/N)?. For this lab, typeyand press Enter. This makes your deployed agent publicly accessible.
- The command may ask you to enable certain APIs if they are not already enabled. Type
The deployment process will take several minutes as it builds and uploads the container. Once complete, it will print the Service URL.
Step 3: Test Your Deployed Agent
-
Open the Service URL: Copy the URL from the terminal output and paste it into your web browser.
-
Interact with the Agent: You should see the familiar ADK Dev UI, but this time it's being served from the cloud, not your local machine!
- Test the routing logic:
- User: "I have a question about my invoice." (Should be handled by the billing agent).
- User: "My app keeps crashing." (Should be handled by the tech support agent).
Your multi-agent system is now live on the internet.
- Test the routing logic:
Lab Summary
Congratulations! You have successfully deployed a multi-agent system to a scalable, serverless environment. This is the final step in taking an agent from a local prototype to a real-world application.
You have learned to:
- Prepare a multi-agent project for deployment.
- Use the
adk deploy cloud_runcommand to automate the containerization and deployment process. - Include the Dev UI in a deployment using the
--with_uiflag. - Access and test your agent running live on a public URL.
In the next module, you will learn about an alternative deployment target, Google Kubernetes Engine (GKE), for when you need more control over your agent's infrastructure.
Self-Reflection Questions
- The
adk deploy cloud_runcommand automates many steps. What are these steps, and what would you have to do manually if this command didn't exist? - We deployed with the
--with_uiflag. In a real production scenario where your agent is being called by another application (not a human in a browser), why would you omit this flag? - Cloud Run can scale down to zero instances. What are the cost and performance implications of this feature for an agent that receives infrequent traffic?
🕵️ Hidden Solution 🕵️
Looking for the solution? Here's a hint (Base64 decode me):
L2RvYy1hZGstdHJhaW5pbmcvbW9kdWxlMzItZGVwbG95bWVudC1jbG91ZC1ydW4vbGFiLXNvbHV0aW9u
The direct link is: Lab Solution