The Agents CLI adds application files and deployment configuration around an existing ADK agent. Here the docuctl docs assistant is the agent; the new work is its project manifest, generated serving code and deployment settings. The cloud output in this lesson is from a recorded deployment that was deleted after the exercise.
When you need this. Your team has a working Python agent but needs a repeatable project layout that another developer can run and deploy. Keep the agent’s instruction and tools separate from the CLI’s generated files, and inspect the resource defaults before turning a local prototype into a hosted process.
For the complete scaffold, evaluation and infrastructure workflow, use the Agents CLI course. This lesson covers one managed-runtime deployment, its resource defaults and what happens when the update target is stale.
Querying remote agent: https://us-central1-aiplatform.googleapis.com/v1/projects/913703049174/locations/us-central1/reasoningEngines/8806439701503279104 (mode: adk)
[user]: I run docuctl 2.x. How do I roll production back to r41?
[docs_helper]: In docuctl 2.x, run:
```bash
docuctl rollback --env production --to r41
```
This points traffic to `r41` without rebuilding and records the rollback as a new release. Note that database migrations are not automatically rolled back.
Session: 2730795903932694528
Resume with: agents-cli run "<message>" --url "https://us-central1-aiplatform.googleapis.com/v1/projects/913703049174/locations/us-central1/reasoningEngines/8806439701503279104" --mode adk --session-id 2730795903932694528Lab setup. Download the complete lab ZIP, extract it and open a terminal in adk-agents-cli/. Use the bundled lockfile for this generated project:
uv sync --frozen
uv tool install google-agents-cli==1.11.0Use Python 3.11–3.13 for this project. The bundled README lists the local project checks and the cloud deployment commands separately.
1. Inspect the project around the existing agent
The lab includes the generated runtime files, uv.lock and the manifest. It leaves out generic demo evals and placeholder tests; the local checks below test this docs-assistant project. In the recorded scaffold enhance run, the CLI finds docs_helper/agent.py, keeps root_agent and adds an App object. It creates a backup before it changes files. The CLI generates a project around the agent; it does not write a second agent.
name: "docs-helper"
acli_version: "1.11.0"
agent_directory: "docs_helper"
region: 'us-central1'
base_template: "local_docs-helper"
generated_at: "2026-10-22T01:45:52.584862+00:00"
language: "python"
framework: "google-adk"
create_params:
# The ADK name of the root agent, as rendered into the agent source. Rename
# the agent and you must change it in both places: telemetry reports this as
# gen_ai.agent.name, and it is what agents-cli reports for the project.
root_agent_name: "docs_helper"
deployment_target: "agent_runtime"
session_type: "in_memory"
cicd_runner: "skip"
is_a2a: true
agent_gateway: false
agent_guidance_filename: "GEMINI.md"
agent_runtime:
identity_default: "agent_identity"agent_directory identifies the Python package, and deployment_target: agent_runtime chooses the deployment adapter. This exercise skipped CI/CD: the project includes files for later automation, but no CI pipeline ran. The enhance output shows the full operation, and you can inspect the project offline.
2. Inspect defaults before choosing a deployment size
From the extracted lab directory, set GOOGLE_CLOUD_PROJECT to your project and configure Application Default Credentials (ADC). Preview the CLI’s create defaults with --dry-run; this validates Google Cloud access without creating the deployment:
agents-cli deploy --dry-run --project $GOOGLE_CLOUD_PROJECT --region us-central1cpu: 1
memory: 4Gi
min_instances: 0
max_instances: 10
container_concurrency: 8
(defaults apply on create; existing values preserved on update)On an update, the CLI keeps the existing value for each flag you leave out. On a create, it applies the defaults. Put the resource flags in the deploy command, so a create and an update apply the same settings. Read agents-cli deploy --help and the dry-run output for the installed release, then set the CPU, memory, instance bounds and identity choice deliberately. A low maximum limits simultaneous containers; it does not set a spending cap or prove that the application handles that workload.
3. Deploy the generated application
Deploy to Agent Runtime with explicit resource limits:
agents-cli deploy --project $GOOGLE_CLOUD_PROJECT --region us-central1 \
--cpu 1 --memory 1Gi --min-instances 0 --max-instances 1 --no-agent-identity --service-account $RUNTIME_SERVICE_ACCOUNTThe recorded service uses a dedicated runtime service account with roles/aiplatform.user; --no-agent-identity disables Agent Identity without disabling cloud IAM. Set --service-account to the identity approved for your deployment. The deployment output records the settings that were applied:
Project: vertex-ai-experminent
Location: us-central1
Display Name: docuctl-cli-c760a585
Min Instances: 0
Max Instances: 1
CPU: 1
Memory: 1Gi
Container Concurrency: 1
Agent Identity: Disabled
Agent Runtime ID: projects/913703049174/locations/us-central1/reasoningEngines/8806439701503279104Run the project README’s commands only in a project where deployment and its costs are approved. The download leaves out the generated deployment_metadata.json: its recorded engine ID would point another developer’s CLI at a stale deployment. An example file shows its shape.
Target engine: Agent Runtime 'projects/913703049174/locations/us-central1/reasoningEngines/8806439701503279104' not found.
The resource recorded in deployment_metadata.json may have been deleted.
Delete the metadata file to deploy a new engine, or check your permissions.
Error: Pre-deploy validation failed (1 of 3 checks): Target engine.
Fix the items above, then run the deploy.A downloaded stale deployment target. The download omits live deployment metadata, so it does not point at the deleted recorded instance. Configure your own deployment.
In this failure, the CLI could not find the engine that the metadata names. Before you update or replace the metadata, check the project, the region and whether the instance still exists. Do not delete the file only to clear the error: without it, the next operation is a create instead of an update.
Conflicting preview flags. Use --dry-run without --force. The CLI rejects the pair before any cloud check. In this saved check, it printed an error and still exited with code 0, so a script must read the output; an exit code of 0 does not mean the preview succeeded:
$ agents-cli scaffold enhance --dry-run --force --skip-checks --auto-approve
Agents CLI v1.11.0
Error: --dry-run is not compatible with --force mode.
exit 0test_a_new_invocation_has_its_own_call_budget (test_project.ScaffoldProject.test_a_new_invocation_has_its_own_call_budget) ... ok
test_conflicting_preview_flags_report_an_error_even_with_exit_zero (test_project.ScaffoldProject.test_conflicting_preview_flags_report_an_error_even_with_exit_zero) ... ok
test_documented_limits_and_identity_flags_exist (test_project.ScaffoldProject.test_documented_limits_and_identity_flags_exist) ... ok
test_download_does_not_target_the_recorded_deleted_deployment (test_project.ScaffoldProject.test_download_does_not_target_the_recorded_deleted_deployment) ... ok
test_manifest_selects_agent_runtime_and_the_existing_agent (test_project.ScaffoldProject.test_manifest_selects_agent_runtime_and_the_existing_agent) ... ok
test_model_call_budget_stops_before_the_fifth_request (test_project.ScaffoldProject.test_model_call_budget_stops_before_the_fifth_request) ... ok
----------------------------------------------------------------------
Ran 6 tests in 3.508s
OKThe local checks read files and CLI help; they do not redeploy or grade model answers. When you finish with your own instance, clean it up before you delete the metadata that identifies it.
4. Resume the remote session from the CLI
The first saved agents-cli run asked how to return production to a named release. The CLI printed a session ID and a continuation command. The next run reused that ID for “And on staging?”, and the answer retained the release and version from the conversation.
Querying remote agent: https://us-central1-aiplatform.googleapis.com/v1/projects/913703049174/locations/us-central1/reasoningEngines/8806439701503279104 (mode: adk)
[user]: And on staging?
[docs_helper]: To roll staging back to `r41`, specify `--env staging`:
```bash
docuctl rollback --env staging --to r41
```
If you just want to roll back to the previous release on staging, omit `--to`:
```bash
docuctl rollback --env staging
```
Session: 2730795903932694528
Resume with: agents-cli run "<message>" --url "https://us-central1-aiplatform.googleapis.com/v1/projects/913703049174/locations/us-central1/reasoningEngines/8806439701503279104" --mode adk --session-id 2730795903932694528The agent limits each invocation to four model calls and each response to 1,024 output tokens. This run checks one conversation path; it does not measure the accuracy of the agent’s commands in general. Keep the session ID with the authenticated user in the caller; a string typed into a CLI is not itself an authorization credential.
What’s next
Deploy an ADK agent to Agent Runtime uses ADK’s native deployment command and calls the runtime methods directly.
Read the docs assistant
"""The docs assistant on Gemini Enterprise Agent Platform: Gemini through Vertex, recall through Memory Bank."""
import os
from pathlib import Path
from google.adk import Agent
from google.adk.models.google_llm import Gemini
from google.adk.models.llm_response import LlmResponse
from google.adk.tools import load_memory
from google.genai import types
DOCS = Path(__file__).resolve().parent / "docs"
PAGES = sorted(p.stem for p in DOCS.glob("*.md"))
# The recorded run uses global for this model. Sessions and Memory Bank stay regional
# (GOOGLE_CLOUD_LOCATION), so the model client gets its own location.
MODEL_LOCATION = os.environ.get("DOCS_MODEL_LOCATION", "global")
def read_page(page: str) -> dict:
"""Read one page of the docuctl documentation: config, deploy, rollback or tokens."""
if page not in PAGES:
return {"error": f"No page {page!r}. Pages: {', '.join(PAGES)}."}
return {"page": page, "text": (DOCS / f"{page}.md").read_text(encoding="utf-8")}
INSTRUCTION = """You answer questions from developers about docuctl, the team's deploy CLI.
Read the relevant page with read_page before you answer. Answers depend on the developer's
docuctl major version (1.x or 2.x). If the developer has not said it in this conversation,
call load_memory to look for it in earlier conversations before you ask. Keep the answer
under 80 words."""
def bounded_model_calls(callback_context, llm_request):
"""Limit each invocation before making another hosted request."""
key = "temp:model_call_budget"
budget = callback_context.state.get(key, {})
if budget.get("invocation") != callback_context.invocation_id:
budget = {"invocation": callback_context.invocation_id, "calls": 0}
if budget["calls"] >= 4:
return LlmResponse(content=types.Content(role="model", parts=[types.Part(text="The model call limit was reached; please narrow the question.")]))
callback_context.state[key] = {**budget, "calls": budget["calls"] + 1}
return None
root_agent = Agent(
name="docs_helper",
before_model_callback=bounded_model_calls,
model=Gemini(model="gemini-3.8-flash", client_kwargs={"location": MODEL_LOCATION}),
instruction=INSTRUCTION,
tools=[read_page, load_memory],
generate_content_config=types.GenerateContentConfig(
temperature=0.2, max_output_tokens=1024, thinking_config=types.ThinkingConfig(thinking_level="low")),
)
from google.adk.apps import App
app = App(root_agent=root_agent, name="docs_helper")Check your understanding
Read the explanation
The target metadata selects an existing deployment. Removing it changes the operation; it does not repair the old resource lookup.
References
Official documentation, installed Agents CLI help/source and ADK APIs checked October 22, 2026.