| name | google-agents-cli |
| description | CLI and skills for building, evaluating, and deploying AI agents on Google Cloud's Gemini Enterprise Agent Platform using ADK |
| triggers | ["build an agent with agents-cli","create a new ADK agent project","deploy my agent to Google Cloud","run evaluations on my agent","scaffold a new agents-cli project","publish my agent to Gemini Enterprise","set up CI/CD for my ADK agent","add RAG to my agent project"] |
google-agents-cli
Skill by ara.so — Devtools Skills collection.
agents-cli is the CLI and skills framework for building, evaluating, and deploying AI agents on Google Cloud's Gemini Enterprise Agent Platform. It works with ADK (Agent Development Kit) to provide end-to-end agent development workflows, from scaffolding to production deployment.
What It Does
- Scaffold agent projects: Create new ADK agent projects with best practices built-in
- Local development: Run and test agents locally with hot reload
- Evaluation: Run systematic evaluations with metrics, evalsets, and LLM-as-judge
- Deployment: Deploy to Google Cloud (Agent Runtime, Cloud Run, GKE)
- Publishing: Register agents with Gemini Enterprise
- Observability: Integrate Cloud Trace, logging, and third-party monitoring
- CI/CD: Set up staging/prod pipelines with automated testing
Installation
Prerequisites: Python 3.11+, uv, Node.js
uvx google-agents-cli setup
pip install google-agents-cli
agents-cli --version
Authentication
agents-cli login
agents-cli login --status
export GOOGLE_API_KEY=your_api_key_here
Core Commands
Project Scaffolding
agents-cli scaffold my-agent
agents-cli scaffold my-agent --template basic
agents-cli scaffold my-agent --template rag
agents-cli scaffold enhance --add deployment
agents-cli scaffold enhance --add cicd
agents-cli scaffold enhance --add rag
agents-cli scaffold upgrade
Local Development
agents-cli install
agents-cli run "What's the weather in San Francisco?"
agents-cli run --input-file prompt.txt
agents-cli run "Summarize this article" --stream
agents-cli lint
Evaluation
agents-cli eval run
agents-cli eval run --evalset evalsets/basic.yaml
agents-cli eval compare results/eval1.json results/eval2.json
agents-cli eval run --metrics accuracy,latency,cost
Deployment
agents-cli deploy
agents-cli deploy --config deploy.yaml
agents-cli deploy --env production
agents-cli infra single-project --project-id my-project
agents-cli infra cicd --project-id my-project
agents-cli infra datastore --project-id my-project
Publishing
agents-cli publish gemini-enterprise
agents-cli publish gemini-enterprise --name "My Agent" --description "Does X"
Data Ingestion (RAG)
agents-cli data-ingestion --source gs://my-bucket/docs
agents-cli data-ingestion --source ./local-docs --datastore my-datastore
Utilities
agents-cli info
agents-cli update
ADK Agent Code Patterns
Basic Agent Structure
from adk.agents import Agent
from adk.tools import Tool
from adk.models import ModelClient
class WeatherTool(Tool):
"""Get weather information for a location."""
def __init__(self):
super().__init__(
name="get_weather",
description="Get current weather for a location"
)
def execute(self, location: str) -> str:
return f"Weather in {location}: Sunny, 72°F"
agent = Agent(
name="weather-assistant",
description="An agent that provides weather information",
model=ModelClient(model_name="gemini-2.0-flash-exp"),
tools=[WeatherTool()]
)
if __name__ == "__main__":
response = agent.run("What's the weather in NYC?")
print(response)
Agent with State Management
from adk.agents import Agent, AgentState
from adk.models import ModelClient
from typing import Any, Dict
class ConversationState(AgentState):
"""Custom state for conversation tracking."""
def __init__(self):
super().__init__()
self.conversation_history = []
self.user_preferences = {}
def add_message(self, role: str, content: str):
self.conversation_history.append({"role": role, "content": content})
agent = Agent(
name="stateful-assistant",
model=ModelClient(model_name="gemini-2.0-flash-exp"),
state=ConversationState()
)
response = agent.run("Remember my name is Alice")
agent.state.user_preferences["name"] = "Alice"
Multi-Agent Orchestration
from adk.agents import Agent, AgentOrchestrator
from adk.models import ModelClient
research_agent = Agent(
name="researcher",
description="Researches topics and gathers information",
model=ModelClient(model_name="gemini-2.0-flash-exp")
)
writer_agent = Agent(
name="writer",
description="Writes content based on research",
model=ModelClient(model_name="gemini-2.0-flash-exp")
)
orchestrator = AgentOrchestrator(
agents=[research_agent, writer_agent],
workflow="sequential"
)
result = orchestrator.run("Write an article about AI agents")
Agent with Callbacks
from adk.agents import Agent
from adk.callbacks import Callback
from adk.models import ModelClient
class LoggingCallback(Callback):
"""Log agent execution steps."""
def on_agent_start(self, agent_name: str, input_data: Any):
print(f"Agent {agent_name} starting with input: {input_data}")
def on_tool_start(self, tool_name: str, tool_input: Dict[str, Any]):
print(f"Tool {tool_name} called with: {tool_input}")
def on_tool_end(self, tool_name: str, tool_output: Any):
print(f"Tool {tool_name} returned: {tool_output}")
def on_agent_end(self, agent_name: str, output: Any):
print(f"Agent {agent_name} finished with: {output}")
agent = Agent(
name="monitored-agent",
model=ModelClient(model_name="gemini-2.0-flash-exp"),
callbacks=[LoggingCallback()]
)
RAG Agent Pattern
from adk.agents import Agent
from adk.tools import Tool
from adk.models import ModelClient
from adk.rag import VectorStore, Retriever
class RAGTool(Tool):
"""Retrieve relevant documents from vector store."""
def __init__(self, datastore_id: str):
super().__init__(
name="retrieve_docs",
description="Retrieve relevant documents"
)
self.retriever = Retriever(datastore_id=datastore_id)
def execute(self, query: str) -> str:
docs = self.retriever.retrieve(query, top_k=5)
return "\n\n".join([doc.content for doc in docs])
agent = Agent(
name="rag-assistant",
description="Agent with RAG capabilities",
model=ModelClient(model_name="gemini-2.0-flash-exp"),
tools=[RAGTool(datastore_id="my-datastore")]
)
Project Configuration
agents.yaml
name: my-agent
version: 1.0.0
description: My AI agent
agent:
name: my-assistant
model: gemini-2.0-flash-exp
temperature: 0.7
max_tokens: 2048
tools:
- name: web_search
enabled: true
- name: code_execution
enabled: false
evaluation:
evalsets:
- path: evalsets/basic.yaml
- path: evalsets/advanced.yaml
metrics:
- accuracy
- latency
- cost
deployment:
target: cloud-run
region: us-central1
min_instances: 1
Evalset Configuration
name: basic-evalset
description: Basic functionality tests
test_cases:
- id: tc-001
input: "What is 2+2?"
expected_output: "4"
metrics:
- accuracy
- latency
- id: tc-002
input: "Explain quantum computing in simple terms"
judge:
type: llm-as-judge
criteria:
- clarity
- accuracy
- conciseness
- id: tc-003
input: "Write a Python function to reverse a string"
validator:
type: code-execution
test: |
def test_reverse():
assert reverse("hello") == "olleh"
assert reverse("") == ""
Deployment Configuration
target: cloud-run
project_id: ${GCP_PROJECT_ID}
region: us-central1
service:
name: my-agent-service
min_instances: 1
max_instances: 10
cpu: 2
memory: 4Gi
timeout: 300s
environment:
- name: GOOGLE_API_KEY
secret: projects/${GCP_PROJECT_ID}/secrets/gemini-api-key
- name: LOG_LEVEL
value: INFO
ci_cd:
enabled: true
environments:
- name: staging
project_id: ${STAGING_PROJECT_ID}
branch: develop
- name: production
project_id: ${PRODUCTION_PROJECT_ID}
branch: main
Environment Variables
export GOOGLE_API_KEY=your_api_key_here
export GOOGLE_CLOUD_PROJECT=your-project-id
export AGENT_MODEL=gemini-2.0-flash-exp
export AGENT_TEMPERATURE=0.7
export AGENT_MAX_TOKENS=2048
export DEPLOY_REGION=us-central1
export DEPLOY_ENV=production
export ENABLE_CLOUD_TRACE=true
export ENABLE_CLOUD_LOGGING=true
export LOG_LEVEL=INFO
export DATASTORE_ID=my-datastore
export VECTOR_STORE_TYPE=vertex-ai-search
Common Patterns
Creating a Complete Agent Project
agents-cli scaffold my-agent
cd my-agent
agents-cli install
agents-cli run "Test prompt"
agents-cli eval run
agents-cli login
agents-cli deploy
agents-cli publish gemini-enterprise
Adding Tools to an Agent
from adk.agents import Agent
from adk.tools import Tool
from adk.models import ModelClient
import requests
class SearchTool(Tool):
"""Search the web for information."""
def __init__(self, api_key: str):
super().__init__(
name="web_search",
description="Search the web for current information"
)
self.api_key = api_key
def execute(self, query: str, num_results: int = 5) -> str:
results = self._search(query, num_results)
return "\n".join([r["title"] + ": " + r["snippet"] for r in results])
def _search(self, query: str, num_results: int):
pass
class CalculatorTool(Tool):
"""Perform mathematical calculations."""
():
().__init__(
name=,
description=
)
() -> :
ast
operator
operators = {
ast.Add: operator.add,
ast.Sub: operator.sub,
ast.Mult: operator.mul,
ast.Div: operator.truediv,
}
():
(node, ast.Num):
node.n
(node, ast.BinOp):
operators[(node.op)](
eval_expr(node.left),
eval_expr(node.right)
)
:
ValueError()
eval_expr(ast.parse(expression, mode=).body)
os
agent = Agent(
name=,
model=ModelClient(model_name=),
tools=[
SearchTool(api_key=os.getenv()),
CalculatorTool()
]
)
Setting Up CI/CD
agents-cli infra cicd --project-id my-project
git add .
git commit -m "Set up CI/CD"
git push origin main
Implementing Custom Metrics
from adk.evaluation import Metric
from typing import Dict, Any
class CustomAccuracyMetric(Metric):
"""Custom accuracy metric with fuzzy matching."""
def __init__(self, threshold: float = 0.8):
super().__init__(name="custom_accuracy")
self.threshold = threshold
def evaluate(self,
prediction: str,
expected: str,
context: Dict[str, Any]) -> float:
from difflib import SequenceMatcher
ratio = SequenceMatcher(None, prediction, expected).ratio()
return 1.0 if ratio >= self.threshold else 0.0
class LatencyMetric(Metric):
"""Measure agent response latency."""
def __init__(self):
super().__init__(name="latency")
def () -> :
context.get(, )
adk.evaluation Evaluator
evaluator = Evaluator(
agent=my_agent,
evalset_path=,
metrics=[
CustomAccuracyMetric(threshold=),
LatencyMetric()
]
)
results = evaluator.run()
()
()
Troubleshooting
Authentication Issues
agents-cli login --force
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json
agents-cli login --service-account
agents-cli login --status
Deployment Failures
agents-cli info
agents-cli deploy --validate-only
agents-cli deploy --verbose
gcloud run services logs read my-agent-service --project=${GCP_PROJECT_ID}
Evaluation Issues
agents-cli eval run --test-case tc-001
agents-cli eval run --debug
agents-cli eval run --validate-only
cat .agents-cli/eval-results/latest.log
Dependency Conflicts
agents-cli install --force
rm -rf .agents-cli/cache
agents-cli install
uv venv --python 3.11
source .venv/bin/activate
agents-cli install
Model Access Issues
echo $GOOGLE_API_KEY
curl -X POST "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-exp:generateContent?key=${GOOGLE_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{"contents":[{"parts":[{"text":"Hello"}]}]}'
export AGENT_MODEL=gemini-1.5-pro
agents-cli run "test"
Performance Optimization
from adk.models import ModelClient
model = ModelClient(
model_name="gemini-2.0-flash-exp",
cache_enabled=True,
cache_ttl=3600
)
agents-cli eval run --batch-size 10 --parallel 4
agent = Agent(
name="efficient-agent",
model=ModelClient(
model_name="gemini-2.0-flash-exp",
max_tokens=1024,
temperature=0.3
)
)
Debugging Agent Behavior
from adk.agents import Agent
from adk.callbacks import DebugCallback
from adk.models import ModelClient
debug_callback = DebugCallback(
log_prompts=True,
log_responses=True,
log_tool_calls=True
)
agent = Agent(
name="debug-agent",
model=ModelClient(model_name="gemini-2.0-flash-exp"),
callbacks=[debug_callback],
verbose=True
)
response = agent.run("Debug this behavior")
print(agent.get_trace())
Model Selection Guide
ModelClient(model_name="gemini-2.0-flash-exp")
ModelClient(model_name="gemini-1.5-pro")
ModelClient(model_name="gemini-1.5-pro-002")
ModelClient(
model_name="gemini-1.5-pro-vision",
multimodal=True
)