google-agents-cli-observability
它能做什么
这项技能说明如何监视已部署的 Google ADK 智能体,包括追踪和提示日志。适合在生产环境中运行智能体、需要调试真实流量的开发者。
适用场景
- ✓当你想为已部署的智能体设置追踪或日志时。
- ✓当你需要查明生产环境中的智能体为何表现异常的时候。
- ✓当你想把智能体分析数据发送到 BigQuery 或第三方监控工具时。
技能链接
https://github.com/google/agents-cli/blob/main/skills/google-agents-cli-observability/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请为我已部署的 ADK 智能体设置追踪和提示日志,以便我查看它在生产环境中给出的回答。”
每周 5 个新技能,1 分钟读完。
工作原理
这项技能说明哪些监控功能开箱即用,哪些需要额外的云资源。它会逐步讲解设置步骤,以及用于检查日志和追踪是否正常到达的命令。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Observability Guide
Cloud Trace works out of the box — no infrastructure needed. Prompt-response logging and BigQuery Agent Analytics require Terraform-provisioned infrastructure (service account, GCS bucket, BigQuery dataset). Run
agents-cli infra single-project --apply --project PROJECT_IDto provision these resources. Go projects get the BigQuery telemetry stack too; the GCS completion upload behind prompt-response logging and the BigQuery Agent Analytics plugin are Python only. Seereferences/cloud-trace-and-logging.mdfor details, env vars, and verification commands. If your project isn't scaffolded yet, see/google-agents-cli-scaffoldfirst.
Deployment order
| Do you want Terraform-managed observability? | Action |
|---|---|
| No | Run agents-cli deploy directly (works for all targets). |
| Yes | Run agents-cli infra single-project --apply first, then agents-cli deploy. |
If you already ran agents-cli deploy imperatively:
Do not apply Terraform afterward. For Agent Runtime in Gemini platform, Terraform owns the whole engine (service account, deployment spec, env vars), so a later apply can't be reconciled without taking over the resource.
Either delete the deployment and start over, or keep the SDK-deployed instance — skip infra single-project and set the observability env vars by re-running agents-cli deploy --update-env-vars "KEY=VALUE,..."; deploy matches the existing Reasoning Engine by display name and updates it in place, preserving env vars set outside the deploy. You must also grant its service account the telemetry IAM roles the Terraform module would otherwise provision: roles/storage.admin (write completions to the logs bucket), roles/logging.logWriter, roles/cloudtrace.agent, plus roles/bigquery.dataOwner + roles/bigquery.jobUser when scaffolded with --bq-analytics. The full set lives in deployment/terraform/single-project/iam.tf (from app_sa_roles) and telemetry.tf. Terraform-managed env vars aren't available in this mode.
Reference Files
| File | Contents |
|---|---|
references/cloud-trace-and-logging.md |
Scaffolded project details — Terraform-provisioned resources, environment variables, verification commands, enabling/disabling locally |
references/bigquery-agent-analytics.md |
BQ Agent Analytics plugin — enabling, key features, GCS offloading, tool provenance |
references/adk-docs.md |
ADK: adk.dev pages to fetch for detail beyond this skill |
references/feedback-mechanism.md |
Adding a user-feedback endpoint — request model, structured logging, log sink → BigQuery |
Observability Tiers
Choose the right level of observability based on your needs:
| Tier | What It Does | Scope | Default State | Best For |
|---|---|---|---|---|
| Cloud Trace | Distributed tracing — execution flow, latency, errors via OpenTelemetry spans | All templates, all environments | Always enabled | Debugging latency, understanding agent execution flow |
| Prompt-Response Logging | GenAI interactions exported to GCS, BigQuery, and Cloud Logging | Scaffolded ADK Python and Claude projects | Disabled locally, enabled when deployed | Auditing LLM interactions, compliance |
| BigQuery Agent Analytics | Structured agent events (LLM calls, tool use, outcomes) to BigQuery | ADK Python agents with the plugin enabled; Claude template agents | Opt-in (--bq-analytics at scaffold time) |
Conversational analytics, custom dashboards, LLM-as-judge evals |
| Third-Party Integrations | External observability platforms (AgentOps, Phoenix, MLflow, etc.) | Any OpenTelemetry-instrumented agent | Opt-in, per-provider setup | Team collaboration, specialized visualization, prompt management |
Ask the user which tier(s) they need — they can be combined. Cloud Trace is always on; the others are additive.
Cloud Trace
Scaffolded agents use OpenTelemetry to emit distributed traces. Every agent invocation produces spans that track the full execution flow.
Span Hierarchy
ADK projects. These are ADK's span names; other frameworks emit their own (
generate_contentcomes from the shared google-genai instrumentor either way).
invoke_workflow (top-level run)
└── invoke_agent (one per agent in the chain)
├── call_llm (model request)
│ └── generate_content (underlying GenAI model call)
└── execute_tool (tool execution)
常见问题
Cloud Trace 需要额外设置吗?
描述中说明,Cloud Trace 开箱即用,无需额外基础设施。
哪些功能需要 Terraform 管理的资源?
提示与回复日志和 BigQuery Agent Analytics 需要通过基础设施命令配置的资源。
如果我已经部署过智能体怎么办?
技能会提醒,在命令式部署之后执行 Terraform apply 可能产生冲突,并说明安全的选项。
详情
作者的原始描述
This skill should be used when the user wants to "set up tracing", "monitor my agent", "configure logging", "add observability", "debug production traffic", or needs guidance on monitoring deployed agents, including ADK (Agent Development Kit) agents. Covers Cloud Trace, prompt-response logging, BigQuery Agent Analytics, third-party integrations (AgentOps, Phoenix, MLflow, etc.), and troubleshooting. Part of the agents-cli skills suite. Do NOT use for deployment setup (use google-agents-cli-deploy) or API code patterns (use google-agents-cli-adk-code).
repo: google/agents-cli
热度
- GitHub 星标
- 6.3k
- 排名
- #14371
- 许可证
- Apache-2.0
- 更新时间
- 2026/10/27
评论
- …
同一仓库的更多技能
google-agents-cli-adk-code
6.3k帮你的智能体使用 Google ADK 为 AI 智能体编写代码,包括工具、回调、状态和编排模式。
google-agents-cli-deploy
6.3k帮你的智能体把 AI 智能体部署到 Google Cloud,涵盖 Agent Runtime、Cloud Run、GKE、密钥、CI/CD 和故障排查。
google-agents-cli-eval
6.3k帮你的智能体用测试数据集和评分来评估 AI 智能体,并找出回答出错的原因。
google-agents-cli-publish
6.3k帮你的智能体把已部署的 AI 智能体注册到 Gemini,并在 Agent Registry 中管理已注册的智能体和 MCP 服务器。