Google ADK — Deployment
Deployment Targets
| Target | Best For | Managed |
|---|---|---|
| Cloud Run | Serverless, auto-scaling | Semi-managed |
| Vertex AI Agent Engine | Fully managed, enterprise | Fully managed |
| GKE | Custom infrastructure | Self-managed |
Deploy to Cloud Run
Using ADK CLI
# Deploy directly (builds and deploys)
adk deploy cloud_run \
--project my-gcp-project \
--region us-central1 \
--service_name my-agent-service \
my_agent/
Manual Dockerfile
FROM python:3.11-slim
WORKDIR /app
COPY pyproject.toml .
COPY my_agent/ ./my_agent/
RUN pip install google-adk
EXPOSE 8080
CMD ["adk", "api_server", "--port", "8080", "my_agent/"]
Build and Deploy
# Build container
gcloud builds submit --tag gcr.io/my-project/my-agent
# Deploy to Cloud Run
gcloud run deploy my-agent-service \
--image gcr.io/my-project/my-agent \
--region us-central1 \
--allow-unauthenticated \
--set-env-vars "GOOGLE_API_KEY=your-key"
Deploy to Vertex AI Agent Engine
Using ADK CLI
adk deploy agent_engine \
--project my-gcp-project \
--region us-central1 \
--display-name "My Agent" \
my_agent/
Programmatic Deployment
For programmatic Vertex AI deployment, use the Google Cloud AI Platform SDK:
from google.cloud import aiplatform
aiplatform.init(project="my-gcp-project", location="us-central1")
# Use the ADK CLI for the actual deployment
# Programmatic deployment is handled via adk deploy CLI
Deploy to GKE
Dockerfile
FROM python:3.11-slim
WORKDIR /app
COPY . .
RUN pip install google-adk
EXPOSE 8080
CMD ["adk", "api_server", "--host", "0.0.0.0", "--port", "8080", "."]
Kubernetes Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: adk-agent
spec:
replicas: 3
selector:
matchLabels:
app: adk-agent
template:
metadata:
labels:
app: adk-agent
spec:
containers:
- name: agent
image: gcr.io/my-project/my-agent:latest
ports:
- containerPort: 8080
env:
- name: GOOGLE_API_KEY
valueFrom:
secretKeyRef:
name: agent-secrets
key: api-key
resources:
requests:
memory: "512Mi"
cpu: "250m"
---
apiVersion: v1
kind: Service
metadata:
name: adk-agent-service
spec:
selector:
app: adk-agent
ports:
- port: 80
targetPort: 8080
type: LoadBalancer
API Server (Production Mode)
The adk api_server command starts a FastAPI server:
# Local testing
adk api_server my_agent/ --port 8080
# Production (in container)
adk api_server --host 0.0.0.0 --port 8080 my_agent/
API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/apps/{app}/users/{user}/sessions |
POST | Create session |
/apps/{app}/users/{user}/sessions/{session} |
GET | Get session |
/run |
POST | Run agent (single turn) |
/run_sse |
POST | Run agent (streaming SSE) |
Environment Variables for Deployment
# Gemini API (simple)
GOOGLE_API_KEY=your-api-key
# Vertex AI (service account)
GOOGLE_CLOUD_PROJECT=my-project
GOOGLE_CLOUD_LOCATION=us-central1
GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json
Production Checklist
- Use
DatabaseSessionServiceorVertexAiSessionService(not InMemory) - Set up proper authentication (API keys, IAM)
- Configure memory service for cross-session recall
- Set resource limits (CPU, memory)
- Enable health checks
- Set up logging/monitoring (OpenTelemetry)
- Use secrets manager for API keys (not env vars in plain text)
- Configure auto-scaling rules
Key Rules
adk api_serveris the production entry point (FastAPI-based)- Cloud Run is simplest for serverless deployment
- Vertex AI Agent Engine is fully managed but less customizable
- Always use persistent session services in production
- Never expose
GOOGLE_API_KEYin container images — use secrets
Related Skills
google-adk-app— App pattern (production configuration)google-adk-scaffold— Project structuregoogle-adk-a2a— Deploying A2A-compatible agents