google-agents-cli-deploy
Original:🇺🇸 English
Translated
This skill should be used when the user wants to "deploy an agent", "deploy my ADK agent", "set up CI/CD", "configure secrets", "troubleshoot a deployment", or needs guidance on Agent Runtime, Cloud Run, or GKE deployment targets. Covers deployment workflows, service accounts, rollback, and production infrastructure. Part of the Google ADK (Agent Development Kit) skills suite. Do NOT use for API code patterns (use google-agents-cli-adk-code), evaluation (use google-agents-cli-eval), or project scaffolding (use google-agents-cli-scaffold).
516.7kinstalls
Sourcegoogle/agents-cli
Added on
NPX Install
npx skill4agent add google/agents-cli google-agents-cli-deployTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →ADK Deployment Guide
Prefer using thecommands throughout this guide — they wrap Terraform, Docker, and deployment into a tested pipeline. If your project isn't scaffolded yet, seeagents-clito add deployment support first./google-agents-cli-scaffold
Reference Files
For deeper details, consult these reference files in :
references/- — Scaling defaults, Dockerfile, session types, networking
cloud-run.md - — deploy.py CLI, AdkApp pattern, Terraform resource, deployment metadata, CI/CD differences
agent-runtime.md - — GKE Autopilot cluster, Kubernetes manifests, Workload Identity, session types, networking
gke.md - — Custom infrastructure, IAM, state management, importing resources
terraform-patterns.md - — BigQuery Remote Function trigger; for Pub/Sub / Eventarc see
batch-inference.md/google-agents-cli-adk-code - — Full CI/CD pipeline setup,
cicd-pipeline.mdflags, runner comparison, WIF auth, pipeline stagesinfra cicd - — Testing instructions per deployment target, curl examples, load tests
testing-deployed-agents.md
Observability: See theskill for Cloud Trace, prompt-response logging, BigQuery Analytics, and third-party integrations./google-agents-cli-observability
Deployment Target Decision Matrix
Choose the right deployment target based on your requirements:
| Criteria | Agent Runtime | Cloud Run | GKE |
|---|---|---|---|
| Languages | Python | Python | Python (+ others via custom containers) |
| Scaling | Managed auto-scaling (configurable min/max, concurrency) | Fully configurable (min/max instances, concurrency, CPU allocation) | Full Kubernetes scaling (HPA, VPA, node auto-provisioning) |
| Networking | VPC-SC and PSC supported | Full VPC support, direct VPC egress, IAP, ingress rules | Full Kubernetes networking |
| Session state | Native | In-memory (dev), Cloud SQL, or Agent Platform Sessions backend | In-memory (dev), Cloud SQL, or Agent Platform Sessions backend |
| Batch/event processing | Not supported | Native trigger endpoints (Pub/Sub, Eventarc); see | Custom (Kubernetes Jobs, Pub/Sub) |
| Cost model | vCPU-iours + memory-iours (not billed when idle) | Per-instance-second + min instance costs | Node pool costs (always-on or auto-provisioned) |
| Setup complexity | Lower (managed, purpose-built for agents) | Medium (Dockerfile, Terraform, networking) | Higher (Kubernetes expertise required) |
| Best for | Managed infrastructure, minimal ops | Custom infra, event-driven workloads | Full Kubernetes control |
Ask the user which deployment target fits their needs. Each is a valid production choice with different trade-offs.
Product name mapping: "Agent Engine" / "Vertex AI Agent Engine" is now Agent Runtime. Use.--deployment-target agent_runtime
Ambient / scheduled / event-driven agents: Agent Runtime does not support Pub/Sub, Eventarc, or Cloud Scheduler triggers. Use Cloud Run (recommended) or GKE for these workloads. SeeSection 12 for the/google-agents-cli-adk-codepattern.trigger_sources
OAuth / user consent agents: Use Agent Runtime with Gemini Enterprise for agents that need OAuth 2.0 user consent (e.g., accessing Google Drive, Calendar, or other user-scoped APIs). Cloud Run does not currently support managed OAuth flows. See thesample inadk-ae-oauthPhase 2./google-agents-cli-workflow
Deploying to Dev
Deploy Workflow
Task tracking: Deployment involves multiple sequential steps (infra setup, CI/CD configuration, deploy, verification). Use a task list to track progress through these steps — skipping one often causes failures in later steps that are hard to trace back.
- If prototype (no deployment target), first enhance:
agents-cli scaffold enhance . --deployment-target <target> - Notify the human: "Eval scores meet thresholds and tests pass. Ready to deploy to dev?"
- Wait for explicit approval
- Once approved:
agents-cli deploy
Agent Runtime timeout recovery: Agent Runtime deploys can take 5-10 minutes and may exceed command timeouts. If the deploy command is cancelled or times out, the deployment continues server-side. Runto check progress — poll every 60 seconds until it reports completion or failure.agents-cli deploy --status
IMPORTANT: Never run without explicit human approval.
agents-cli deployDo NOT runbefore deploying. It is not a prerequisite —agents-cli infra single-projectworks on its own. Run it separately if the user needs observability features (prompt-response logging, BigQuery analytics) — seeagents-cli deploy./google-agents-cli-observability
Single-Project Infrastructure Setup (Optional — Advanced)
agents-cli infra single-projectterraform applydeployment/terraform/single-project/bash
# Optional — provision infrastructure in a single GCP project
agents-cli infra single-projectNote:doesn't automatically use the Terraform-createdagents-cli deploy. Pass the service account viaapp_saoragents-cli deploy --service-account SA_EMAILfor Agent Runtime targets.uv run -m app.app_utils.deploy --service-account SA_EMAIL
Deploy Flag Reference
| Flag | Description | Targets |
|---|---|---|
| GCP project ID | All |
| GCP region | All |
| Service account email for the deployed agent | All |
| Comma-separated | Agent Runtime |
| Comma-separated | Agent Runtime, Cloud Run |
| Enable agent identity (Preview) | Agent Runtime |
| Memory limit (default: | Cloud Run |
| Container port | Cloud Run |
| Enable Identity-Aware Proxy | Cloud Run |
| Container image URI (skips source build) | Cloud Run, GKE |
| Start deployment and return immediately | Agent Runtime, Cloud Run |
| Check the status of a pending | Agent Runtime, Cloud Run |
| List existing deployments and exit | All |
| Print what would be executed without running it | All |
| Skip project confirmation prompt | All |
Run for the full flag reference. Cloud Run also accepts extra flags after (e.g., ).
agents-cli deploy --helpgcloud---- --timeout=600Project Confirmation: If the project is resolved automatically (not passed via), the command will prompt for confirmation in interactive mode. Since agents typically run in non-interactive mode, you MUST pass--projectto proceed if you are relying on automatic project resolution.--no-confirm-project
Production Deployment — CI/CD Pipeline
For the full CI/CD pipeline setup guide — prerequisites, flags, runner comparison, WIF authentication, pipeline stages, and production approval — see .
infra cicdreferences/cicd-pipeline.mdCloud Run Specifics
For detailed infrastructure configuration (scaling defaults, Dockerfile, FastAPI endpoints, session types, networking), see . For ADK docs on Cloud Run deployment, fetch .
references/cloud-run.mdhttps://adk.dev/deploy/cloud-run/index.mdFor event-driven / ambient agent deployment on Cloud Run, see the sample and for the pattern.
ambient-expense-agent/google-agents-cli-adk-codetrigger_sourcesAgent Runtime Specifics
Agent Runtime is a managed Vertex AI service for deploying Python ADK agents. Uses source-based deployment (no Dockerfile) via and the class.
deploy.pyAdkAppNoCLI exists for Agent Runtime. Deploy viagcloudoragents-cli deploy. Query via the Pythondeploy.pySDK.vertexai.Client
Deployments can take 5-10 minutes. Use to start a deployment and return immediately, then check on it later with :
--no-wait--statusbash
# Start deployment without blocking
agents-cli deploy --no-wait
# Check on progress later
agents-cli deploy --statusWhen detects the operation has completed, it writes and prints the same success output as a normal deploy.
--statusdeployment_metadata.jsonFor detailed infrastructure configuration (deploy.py flags, AdkApp pattern, Terraform resource, deployment metadata, session/artifact services, CI/CD differences), see . For ADK docs on Agent Runtime deployment, fetch .
references/agent-runtime.mdhttps://adk.dev/deploy/agent-engine/index.mdGKE Specifics
For detailed infrastructure configuration (Kubernetes manifests, Terraform resources, Workload Identity, session types, networking), see . For ADK docs on GKE deployment, fetch .
references/gke.mdhttps://adk.dev/deploy/gke/index.mdService Account Architecture
Scaffolded projects use two service accounts:
- (per environment) — Runtime identity for the deployed agent. Roles defined in
app_sa.deployment/terraform/iam.tf - (CI/CD project) — CI/CD pipeline identity (GitHub Actions / Cloud Build). Lives in the CI/CD project (defaults to prod project), needs permissions in both staging and prod projects.
cicd_runner_sa
Check for exact role bindings. Cross-project permissions (Cloud Run service agents, artifact registry access) are also configured there.
deployment/terraform/iam.tfCommon 403 errors:
- "Permission denied on Cloud Run" → missing deployment role in the target project
cicd_runner_sa - "Cannot act as service account" → Missing binding on
iam.serviceAccountUserapp_sa - "Secret access denied" → missing
app_sasecretmanager.secretAccessor - "Artifact Registry read denied" → Cloud Run service agent missing read access in CI/CD project
Required Permissions for CI/CD Setup
- granted to the Cloud Build service account (
roles/secretmanager.admin) in the CI/CD project. This allows Cloud Build to access the GitHub token stored in Secret Manager.service-<PROJECT_NUMBER>@gcp-sa-cloudbuild.iam.gserviceaccount.com
Required APIs
The following Google Cloud APIs must be enabled in your project for the skills and deployment to work:
- — Required for building container images and running CI/CD pipelines.
cloudbuild.googleapis.com - — Required for managing secrets and API keys.
secretmanager.googleapis.com - — Required for deploying to Cloud Run.
run.googleapis.com
Ensure these are enabled before running deployment or CI/CD setup commands:
bash
gcloud services enable cloudbuild.googleapis.com secretmanager.googleapis.com run.googleapis.com --project=YOUR_PROJECT_IDSecret Manager (for API Credentials)
Instead of passing sensitive keys as environment variables, use GCP Secret Manager.
bash
# Create a secret
echo -n "YOUR_API_KEY" | gcloud secrets create MY_SECRET_NAME --data-file=-
# Update an existing secret
echo -n "NEW_API_KEY" | gcloud secrets versions add MY_SECRET_NAME --data-file=-Grant access: For Cloud Run, grant to . For Agent Runtime, grant it to the platform-managed SA (). For GKE, grant to . Access secrets via Kubernetes Secrets or directly via the Secret Manager API with Workload Identity.
secretmanager.secretAccessorapp_saservice-PROJECT_NUMBER@gcp-sa-aiplatform-re.iam.gserviceaccount.comsecretmanager.secretAccessorapp_saPass secrets at deploy time (Agent Runtime):
bash
agents-cli deploy --secrets "API_KEY=my-api-key,DB_PASS=db-password:2"Format: or (defaults to latest). Access in code via .
ENV_VAR=SECRET_IDENV_VAR=SECRET_ID:VERSIONos.environ.get("API_KEY")Observability
See the agents-cli-observability skill for observability configuration (Cloud Trace, prompt-response logging, BigQuery Analytics, third-party integrations).
Testing Your Deployed Agent
The quickest way to test a deployed agent is — it handles auth, sessions, and streaming automatically (supports Agent Runtime and Cloud Run).
agents-cli run --url <service-url> --mode <a2a|adk> "your prompt"For advanced testing (custom headers, session reuse, scripting, load tests), see .
references/testing-deployed-agents.mdDeploying with a UI (IAP)
IAP (Identity-Aware Proxy) secures a Cloud Run service so only authorized Google accounts can access it. Support for IAP deployment via is planned for a future release.
agents-cli deployFor Agent Runtime with a custom frontend, use a decoupled deployment — deploy the frontend separately to Cloud Run or Cloud Storage, connecting to the Agent Runtime backend API.
For more information on IAP with Cloud Run, see the Cloud Console IAP settings.
Rollback & Recovery
The primary rollback mechanism is git-based: fix the issue, commit, and push to . The CI/CD pipeline will automatically build and deploy the new version through staging → production.
mainFor immediate Cloud Run rollback without a new commit, use revision traffic shifting:
bash
gcloud run revisions list --service=SERVICE_NAME --region=REGION
gcloud run services update-traffic SERVICE_NAME \
--to-revisions=REVISION_NAME=100 --region=REGIONAgent Runtime doesn't support revision-based rollback — fix and redeploy via .
agents-cli deployFor GKE rollback, use :
kubectl rollout undobash
kubectl rollout undo deployment/DEPLOYMENT_NAME -n NAMESPACE
kubectl rollout status deployment/DEPLOYMENT_NAME -n NAMESPACECustom Infrastructure (Terraform)
CRITICAL: When your agent requires custom infrastructure (Cloud SQL, Pub/Sub, Eventarc, BigQuery, etc.), you MUST define it in Terraform — never create resources manually via commands. Exception: quick experimentation is fine with or console, but production infrastructure must be in Terraform.
gcloudgcloudFor custom infrastructure patterns, consult for:
references/terraform-patterns.md- Where to put custom Terraform files (single-project vs CI/CD)
- Resource examples (Pub/Sub, BigQuery, Eventarc triggers)
- IAM bindings for custom resources
- Terraform state management (remote vs local, importing resources)
- Common infrastructure patterns
Troubleshooting
| Issue | Solution |
|---|---|
| Terraform state locked | |
| GitHub Actions auth failed | Re-run |
| Cloud Build authorization pending | Use |
| Resource already exists | |
| Agent Runtime deploy timeout / hangs | Deployments take 5-10 min; check if engine was created (see Agent Runtime Specifics) |
| Secret not available | Verify |
| 403 on deploy | Check |
| 403 when testing Cloud Run | Default is |
| Cold starts too slow | Set |
| Cloud Run 503 errors | Check resource limits (memory/CPU), increase |
| 403 right after granting IAM role | IAM propagation is not instant — wait a couple of minutes before retrying. Don't keep re-granting the same role |
| Resource seems missing but Terraform created it | Run |
| Deployment failed or agent not responding | Check Cloud Logging: |
| Agent returns errors after deploy | Open Cloud Logging in Console → filter by service name (Cloud Run) or reasoning engine resource (Agent Runtime) → look for Python tracebacks or permission errors in recent log entries |
Platform Registration
For registering deployed agents with Gemini Enterprise, see .
/google-agents-cli-publishRelated Skills
- — Development workflow, coding guidelines, and operational rules
/google-agents-cli-workflow - — ADK Python API quick reference for writing agent code
/google-agents-cli-adk-code - — Evaluation methodology, evalset schema, and the eval-fix loop
/google-agents-cli-eval - — Project creation and enhancement with
/google-agents-cli-scaffold/agents-cli scaffold createscaffold enhance - — Cloud Trace, logging, BigQuery Analytics, and third-party integrations
/google-agents-cli-observability - — Gemini Enterprise registration
/google-agents-cli-publish