skill
Google Agents Cli Observability
نبذة
# 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 --project PROJECT_ID` to 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. See `references/cloud-trace-and-logging.md` for details, env vars, and verification commands. If your project isn't scaffolded yet, see `/google-agents-cli-scaffold` first.
### Order of operations for `agent_runtime` deployments
For `deployment_target = agent_runtime`, run `agents-cli infra single-project` **before** the first `agents-cli deploy`. The Terraform module owns the entire Reasoning Engine resource (service account, deployment spec, env vars), so applying it after an SDK-based deploy creates a state mismatch Terraform can't reconcile without taking ownership of the whole resource.
Already ran `agents-cli deploy`? Two options:
1. **Switch to Terraform-managed** — delete the SDK-deployed Reasoning Engine, then run `agents-cli infra single-project` and `agents-cli deploy` (sessions and in-flight state are lost). 2. **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 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 | 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_content` comes 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) ```
### Setup by Deployment Type
| Deployment | Setup | |-----------|-------| | **Agent Runtime** | Automatic — exporters wired at startup, gated on `GOOGLE_CLOUD_AGENT_ENGINE_ENABLE_TELEMETRY` (set by deploy); exports to Cloud Trace/Logging + Agent Engine console | | **Cloud Run / GKE (scaffolded)** | Automatic — exporters wired at startup, exports to Cloud Trace/Logging | | **Cloud Run / GKE (manual)** | Configure OpenTelemetry exporter in your app | | **
التثبيت
شغل هذا الأمر
npx skills add google/agents-cliيعمل مع
خطوات التثبيت
Install with `npx skills add google/agents-cli`, or clone the repository and copy the `skills/google-agents-cli-observability` folder into your Claude skills directory.
أصول ذات صلة
مختارات أخرى في البيانات والتحليلات.
git clone https://github.com/anthropics/knowledge-work-plugins && cp -r knowledge-work-plugins/bio-research/skills/nextflow-development ~/.claude/skills/
git clone https://github.com/anthropics/knowledge-work-plugins && cp -r knowledge-work-plugins/data/skills/data-context-extractor ~/.claude/skills/
git clone https://github.com/anthropics/knowledge-work-plugins && cp -r knowledge-work-plugins/bio-research/skills/instrument-data-to-allotrope ~/.claude/skills/
git clone https://github.com/anthropics/knowledge-work-plugins && cp -r knowledge-work-plugins/data/skills/analyze ~/.claude/skills/
git clone https://github.com/anthropics/knowledge-work-plugins && cp -r knowledge-work-plugins/bio-research/skills/start ~/.claude/skills/
git clone https://github.com/anthropics/knowledge-work-plugins && cp -r knowledge-work-plugins/data/skills/validate-data ~/.claude/skills/
افحص قبل التثبيت
شغل أي مصدر عبر فحوصاتنا - الظهور في الذكاء الاصطناعي والأمان والأداء واكتشاف التقنيات.
فحص أمني تلقائي للموقع
الأمان
محلل سرعة الصفحة
الأداء
اختبار جودة المحتوى العربي بالذكاء الاصطناعي
جودة المحتوى
مختبر وكلاء الذكاء الاصطناعي
اختبار الذكاء الاصطناعي
كاشف منصة الموقع
الترحيل
تدقيق الظهور في محركات الذكاء الاصطناعي
الظهور في الذكاء الاصطناعي
مولد ملف llms.txt
الظهور في الذكاء الاصطناعي
مقياس سهولة القراءة بالعربية
جودة المحتوى
منشئ البيانات المنظمة
الظهور في الذكاء الاصطناعي
حاسبة تكاليف الذكاء الاصطناعي
اختبار الذكاء الاصطناعي
محلل العناوين العربية
جودة المحتوى