Module 30.1: Spec-Driven AgentOps, Coding Skills & Scaffolding
Theoryโ
Figure: Spec-driven Enterprise AgentOps blueprint with google-agents-cli v1.10 โ from .agents-cli-spec.md and coding-agent skills to reference recipes, prototype scaffolding, and built-in A2A serving.
Welcome to Part 6: Enterprise AgentOps with Google Agents CLIโ
Across Parts 1โ5, you mastered the ADK 2.0 cognitive runtime: designing Agent personas, stateful ToolContext functions, deterministic @node workflows, BasePlugin interceptors, MCP integrations, and real-time streaming with zero infrastructure clutter.
Shipping an agent to production, however, demands a second engineering discipline: Enterprise AgentOps. Production systems require an explicit architectural specification, reproducible uv dependency locks, built-in Agent-to-Agent (A2A) protocol endpoints, rubric-driven evaluation gates, GitOps CI/CD pipelines, OpenTelemetry tracing, and strict token cost controls.
Throughout Part 6 (Modules 30.1โ30.4) and Part 7 (Modules 31โ36), you will engineer, evaluate, govern, and deploy a single canonical enterprise application โ support-ops-agent, powered by gemini-3.8-flash โ using the Google Agents CLI (google-agents-cli ~= 1.10.0).
The agents-cli v1.10 Lifecycle (Phases 0โ7)โ
Rather than bolting Dockerfiles, FastAPI servers, A2A routers, and Terraform onto a script at the eleventh hour, agents-cli v1.10 structures engineering around an 8-phase spec-driven, prototype-first lifecycle:
| Lifecycle Phase | Core Commands / Artifacts | Curriculum Coverage & Purpose |
|---|---|---|
| Phase 0: Understand & Specify | .agents-cli-spec.md | Module 30.1: Pin mission, tools, session state keys, safety non-goals, and measurable evaluation criteria before scaffolding. |
| Phase 1: Study Reference Recipes | Sparse-clone google/adk-samples (core/python/<recipe>/AGENTS.md) | Module 30.1: Study curated reference implementations for RAG, sandboxes, memory, or HITL instead of using rigid generator flags. |
| Phase 2: Prototype Scaffold | agents-cli create support-ops-agent --agent adk --prototype | Module 30.1: Generate a clean ADK + FastAPI + A2A + eval repository without premature Terraform or CI/CD noise (create and scaffold create are equivalent). |
| Phase 3: Build & Smoke Test | agents-cli install ยท agents-cli lintagents-cli run "..." -v --start-serveragents-cli playground | Module 30.1: Implement app/agent.py, run fast multi-turn smoke tests against a warm local server, and inspect JSON event payloads. |
| Phase 4: Evaluate & Optimize | agents-cli eval run ยท eval dataset synthesizeeval analyze ยท eval optimize (GEPA) ยท eval compare | Module 30.2: Validate behavior on EvaluationDataset cases, synthesize multi-turn user personas, and optimize instructions with GEPA. |
| Extensions & GitOps CI/CD | agents-cli-extension.yamlagents-cli scaffold enhance . ยท infra cicd | Module 30.3: Enforce org-wide CLI guardrails, explore polyglot templates (--agent adk_go), and wire GitHub Actions / Cloud Build + Terraform. |
| Phases 5โ6: Deploy & Publish | agents-cli deployagents-cli publish gemini | Part 7 (Modules 31โ36): Roll out containers to Cloud Run, GKE Autopilot, or Agent Runtime with Agent Identity, and register with Gemini Enterprise. |
| Phase 7: Observe & Control Cost | playground --otel-to-cloud ยท --bq-analyticsContextCacheConfig ยท EventsCompactionConfig | Module 30.4: Inspect Cloud Trace span trees, query BigQuery Agent Analytics (v_llm_response), and govern token and compute spend. |
Installing agents-cli & Syncing the 7 Coding-Agent Skillsโ
Install google-agents-cli once as an isolated global CLI tool via uv, then run agents-cli setup to equip your AI coding assistant with up-to-date operational knowledge:
# 1. Install google-agents-cli (~= 1.10.0) globally via uv
uv tool install google-agents-cli
# 2. Preview which coding agents are detected on your machine
agents-cli setup --dry-run
# 3. Sync the 7 official AgentOps skills without triggering cloud login prompts
agents-cli setup --skip-auth
# Optional: scope skills strictly to the current repository (.gemini/skills/, .claude/skills/, .agents/skills/)
# agents-cli setup --workspace --skip-auth
agents-cli setup detects your active coding environments (Antigravity, Gemini CLI, Claude Code, Cursor, Codex, Windsurf) and installs seven phase-specific google-agents-cli-* developer skills into .gemini/skills/, .claude/skills/, or .agents/skills/:
| Installed Coding-Agent Skill | When Your Coding Assistant Loads It | What It Enforces |
|---|---|---|
google-agents-cli-workflow | Always active (Phase 0 entrypoint) | 8-phase lifecycle discipline, code-preservation rules, model preservation, and systematic 5-step debugging. |
google-agents-cli-scaffold | Phase 2 (create, enhance, upgrade) | Strict programmatic flags, naming constraints (<= 26 chars), --prototype workflow, and built-in A2A rules. |
google-agents-cli-adk-code | Phases 1 & 3 (Design & Build) | ADK 2.0 Python/Go API patterns, ToolContext, graph Workflow syntax, and the Reference Recipes topic index. |
google-agents-cli-eval | Phase 4 (Quality Flywheel) | EvaluationDataset JSON shapes, rubric metrics, user simulation, GEPA prompt optimization, and eval compare. |
google-agents-cli-deploy | Phase 5 (Cloud Rollout) | Runtime target selection (agent_runtime, cloud_run, gke), IAM/403 troubleshooting, and Secret Manager wiring. |
google-agents-cli-publish | Phase 6 (Enterprise Catalog) | Registering deployed agents and MCP servers with Gemini Enterprise and Agent Registry (ADK vs A2A modes). |
google-agents-cli-observability | Phase 7 (Production Telemetry) | Cloud Trace span hierarchy, two-tier prompt/response logging, and BigQuery Agent Analytics SQL views. |
Coding-Agent Dev Skills vs. Runtime ADK Skills: Do not confuse the 7
google-agents-cli-*skills installed byagents-cli setup(which guide your IDE coding agent while you write and deploy code) with ADK's runtimeSkillToolset(covered in Module 39.5, which equips your deployedroot_agentto loadSKILL.mddomain instructions at runtime).
Phase 0 & Phase 1: .agents-cli-spec.md and Clone-and-Study Recipesโ
Phase 0: Pinning Intent in .agents-cli-spec.mdโ
Before running agents-cli create or writing a single tool, Phase 0 captures a concise contract in .agents-cli-spec.md at the project root. If a coding agent or teammate opens the repository later, .agents-cli-spec.md serves as the single source of truth for:
- Overview & Mission: What operational problem the agent solves (and explicit Non-Goals).
- Tools & State Keys: Exact function signatures, external APIs, and
Session.statekeys (such asuser:customer_tier,active_ticket_id, andescalated_tickets). - Constraints & Safety Rules: Guardrails the agent must never violate (for example, never fabricating ticket IDs or escalating unverified tickets).
- Success Criteria: Measurable behavioral outcomes that directly seed Phase 4 evaluation rubrics.
- Reference Samples: Relevant recipes to inspect in Phase 1 before writing custom infrastructure.
Phase 1: Why agents-cli v1.10 Retired --datastore and agentic_ragโ
In earlier releases, scaffolding tools bundled monolithic RAG templates (--agent agentic_rag, --datastore, agents-cli infra datastore, agents-cli data-ingestion). In real enterprise teams, baking opinionated chunking pipelines and Terraform datastores into a rigid CLI flag made projects brittle and hard to customize.
agents-cli v1.10 officially retired --datastore, agentic_rag, and data-ingestion in favor of the Clone-and-Study Reference Recipe model:
- Scaffold a clean, minimal foundation: Always start your own repository with
--agent adk --prototypeso you own a lean, upgradeable codebase. - Clone and study curated reference recipes: When your spec requires retrieval over private documents, sandboxed execution, cross-session Memory Bank, OAuth user consent, or runner-wide safety plugins, sparse-clone the matching canonical recipe (such as
rag-agent-search,rag-vector-search,long-horizon-harness,cross-session-memory, or catalog samples such asadk@data-scienceandagentic-rag-vertex-ai-search), read itsAGENTS.mdarchitectural tour first, and lift only the exact pattern (app/,infra/terraform/, orMakefiletarget) your spec requires:
# Phase 1 pattern: sparse-clone a curated recipe to /tmp, study AGENTS.md, and adapt cleanly
git clone --filter=blob:none --depth 1 --sparse \
https://github.com/google/adk-samples /tmp/adk-samples
cd /tmp/adk-samples
git sparse-checkout add core/python/rag-agent-search
cat core/python/rag-agent-search/AGENTS.md
Phase 2: Prototype Scaffolding & Complete Project Anatomyโ
Once .agents-cli-spec.md is approved, scaffold support-ops-agent in prototype mode. Note that agents-cli create and agents-cli scaffold create are exact aliases, and agents-cli runs in strict programmatic mode by default (raising a UsageError if required flags are omitted rather than hanging in non-interactive shells):
# Equivalent to: agents-cli scaffold create support-ops-agent ...
agents-cli create support-ops-agent \
--agent adk \
--prototype \
--agent-guidance-filename GEMINI.md
This generates a standardized, production-grade repository without premature cloud infrastructure files:
support-ops-agent/
โโโ .agents-cli-spec.md # Phase 0 architectural contract (mission, tools, state, metrics)
โโโ agents-cli-manifest.yaml # Canonical project metadata read by info, enhance, deploy & upgrade
โโโ GEMINI.md # IDE coding-agent guidance & safe-edit boundaries
โโโ pyproject.toml # uv project dependencies (google-adk, fastapi, uvicorn, a2a-sdk)
โโโ Dockerfile # Production container serving uvicorn app.fast_api_app:app
โโโ .env # Gemini platform (GCP project/location) or AI Studio API key
โโโ app/
โ โโโ __init__.py
โ โโโ agent.py # YOUR CODE: tools, root_agent (gemini-3.8-flash) & App(name="app")
โ โโโ fast_api_app.py # Unified FastAPI server (/run_sse + built-in /a2a/app lifespan)
โ โโโ app_utils/
โ โโโ a2a.py # Dynamic AgentCardBuilder & JSON-RPC attach_a2a_routes()
โ โโโ services.py # Process-wide shared://session & shared://artifact registry
โโโ tests/
โโโ eval/
โ โโโ eval_config.yaml # Metric suite configuration (Module 30.2)
โ โโโ datasets/
โ โโโ basic-dataset.json # EvaluationDataset cases (Module 30.2)
โโโ integration/ # Smoke tests verifying FastAPI & Runner wiring
โโโ unit/ # Deterministic pure-Python unit tests (never LLM wording checks!)
Inside the Generated Serving Harness (fast_api_app.py, a2a.py, services.py)โ
- Built-in A2A Protocol Surface (
app/fast_api_app.py&app/app_utils/a2a.py): During FastAPIlifespanstartup,fast_api_app.pyinstantiates a sharedRunnerand callsawait attach_a2a_routes(app, agent=root_agent, runner=runner, task_store=InMemoryTaskStore(), rpc_path="/a2a/app"). Your agent automatically serves both ADK's native/run_sseendpoint and a standards-compliant A2A JSON-RPC endpoint plus discovery card at/a2a/app/.well-known/agent-card.jsonโ with v0.3 Gemini registration compatibility out of the box. Never hand-write custom A2A server boilerplate in anagents-cliproject. - Unified
shared://Session & Artifact Registry (app/app_utils/services.py): Registersshared://sessionandshared://artifactprocess-wide so sessions created via ADK SSE, the Web Playground, or A2A share one backing store (InMemorySessionServicelocally, upgrading cleanly to Cloud SQL orVertexAiSessionServicein cloud deployments).
The 4 Critical agents-cli Rulesโ
Violating any of these four invariants is the top cause of scaffolding failures or runtime "Session not found" errors:
- Project name
<= 26characters ([a-z0-9-]only): Names must use only lowercase letters, digits, and hyphens (e.g.,support-ops-agent, 17 characters). Cloud IAM service accounts and Terraform resource identifiers append suffixes that hit GCP's 30-character limit if the project name exceeds 26 characters. - NEVER
mkdirbeforeagents-cli create: Always runcreate(orscaffold create) from the parent workspace directory. If you pre-create an emptysupport-ops-agent/folder,agents-clirefuses to overwrite it or misinterprets the directory state. App(root_agent=root_agent, name="app")MUST matchagent_directory: "app": ADK's FastAPI router andagents-cli evalresolve/apps/{app_name}from the package folder name (app). SettingApp(..., name="support_ops_agent")while code lives inapp/agent.pycauses"Session not found"failures.Agent(name="support_ops_agent")MUST matchcreate_params.root_agent_nameinagents-cli-manifest.yaml:agents-clicoercessupport-ops-agentto the Python identifiersupport_ops_agentinsidecreate_params.root_agent_nameinagents-cli-manifest.yaml. KeepAgent(name=...)andcreate_params.root_agent_nameidentical so OpenTelemetrygen_ai.agent.nameattributes, eval runners, and your A2AAgentCardstay aligned.
Phase 3 Smoke Testing, scaffold enhance, and scaffold upgradeโ
Fast Local Iteration (install, lint, run -v --start-server, playground)โ
During Phase 3, keep feedback loops tight from the terminal:
# Sync uv virtual environment & run ruff / static checks
agents-cli install
agents-cli lint
# Start a persistent background server, stream full JSON event payloads (-v), and keep session state alive
agents-cli run "Investigate ticket TCK-1042 and check its SLA." -v --start-server --session-id demo-1
agents-cli run "Was TCK-1042 escalated in this session?" --session-id demo-1
agents-cli run "Stop" --stop-server
# Or launch the browser-based ADK Web Playground
agents-cli playground
Code-Preservation Guarantee (scaffold enhance & scaffold upgrade)โ
When your prototype passes Phase 4 evaluations, you do not start a new repository. Instead:
- Adding Cloud Infrastructure (
agents-cli scaffold enhance .): Runningagents-cli scaffold enhance . --deployment-target cloud_run --cicd-runner github_actionslayers Terraform (deployment/terraform/), CI/CD workflows, and load tests in place while strictly preserving your customapp/agent.py,.agents-cli-spec.md,.env,GEMINI.md, andtests/eval/datasets. Pass--dry-runto preview additions first, or--prefer-newto resolve template conflicts in favor of the incoming scaffold. - Staying Current Across CLI Releases (
agents-cli scaffold upgrade): When a newergoogle-agents-cliversion ships updated FastAPI/A2A wiring or Terraform modules, runagents-cli scaffold upgrade --dry-runto preview a 3-way smart merge between the original template version recorded inagents-cli-manifest.yaml, the new CLI template, and your repository. Unmodified boilerplate updates automatically while your business logic inapp/agent.pyremains untouched (--auto-approveapplies clean merges;--forceresets scaffolding files if a manual conflict cannot be merged).
Your team is kicking off an enterprise ADK agent ('support-ops-agent') that will eventually need document retrieval (RAG) and A2A interoperability. Following Google Agents CLI v1.10 best practices, how should you initialize and structure the repository?
Key Takeawaysโ
- Spec-First Lifecycle (
Phase 0 โ Phase 7): Pin mission, tools, state keys, non-goals, and measurable evaluation criteria in.agents-cli-spec.mdbefore scaffolding or coding. - Clone-and-Study Recipes Replace Rigid Flags:
agents-cli v1.10retired--datastore,agentic_rag, anddata-ingestion. Scaffold a clean--agent adk --prototypeproject and sparse-clone curated recipes (rag-agent-search,long-horizon-harness,adk@data-science) to study theirAGENTS.mdpatterns. - 7 Coding-Agent Skills (
agents-cli setup): Syncsworkflow,scaffold,adk-code,eval,deploy,publish, andobservabilityskills directly into your IDE coding assistant. - Built-In A2A & Shared Services: Every scaffolded ADK app automatically mounts
/a2a/app/.well-known/agent-card.jsonand JSON-RPC task handling alongside/run_sseover a unifiedshared://sessionstore. - The 4 Non-Negotiable Rules & Non-Destructive Upgrades: Enforce
<= 26char[a-z0-9-]project names, nevermkdirbeforecreate, keepApp(..., name="app")matched toagent_directory: "app", keepAgent(name="support_ops_agent")matched toroot_agent_name, and evolve safely viascaffold enhanceandscaffold upgrade --dry-run.