|
|
ADK Deployment with Cloud Run
Author: Venkata Sudhakar
Cloud Run is the recommended platform for deploying ADK agents in production. It provides fully managed, serverless container hosting with automatic scaling from zero to thousands of instances, built-in HTTPS, and pay-per-request pricing. ShopMax India deploys all its ADK agents on Cloud Run, serving customer queries across Mumbai, Bangalore, Hyderabad, and Delhi with sub-200ms response times. The deployment involves three steps: packaging the ADK agent as a FastAPI app, building a Docker container, and deploying to Cloud Run. Environment variables inject API keys and configuration at runtime. Cloud Run handles TLS, load balancing, and scaling automatically. The below example shows the FastAPI wrapper for an ADK agent and the Dockerfile for containerisation.
It gives the following output,
INFO: Started server process
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8080
The below example shows the Dockerfile and the gcloud commands to build and deploy the agent to Cloud Run.
It gives the following output,
Building and pushing image... done
Deploying container to Cloud Run service [shopmax-agent] in project [shopmax-india] region [asia-south1]
Service [shopmax-agent] revision [shopmax-agent-00001-abc] has been deployed
Service URL: https://shopmax-agent-xxxx-el.a.run.app
ShopMax India deploys agents to the asia-south1 (Mumbai) region to minimise latency for Indian customers. With min-instances set to 1, the first request never faces a cold start. Concurrency of 80 means each Cloud Run instance handles 80 simultaneous conversations, and the service scales to 10 instances automatically during peak hours - serving 800 concurrent users with no infrastructure management.
|
|