ADK 智能体调试
adk-debug
通过检查会话、事件、工具调用以及到达模型的确切请求,诊断行为异常的 ADK 智能体。涵盖 `adk run` 命令行工具和 `adk web` 开发服务器及其会话、追踪和调试 HTTP 端点。当智能体返回错误答案、忽略工具或吞掉工具错误、挂起、循环、输出原始 JSON 而不调用工具、未被 `adk web` 发现、子智能体看不到父对话,或需要某次运行的 LLM 请求/响应、token 计数或日志时使用。不用于 ADK 内部设计原理(使用 `adk-architecture`)、不用于构建新智能体或工作流(使用 `adk-agent-builder`)、不用于环境或依赖设置失败(使用 `adk-setup`),也不用于 lint 和风格问题(使用 `adk-style`)。
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 2.2w
- Forks
- 4.4k
01 前言 Front Matter
- name
- adk-debug
- description
- Diagnoses misbehaving ADK agents by inspecting sessions, events, tool calls, and the exact request that reached the model. Covers the `adk run` CLI and the `adk web` dev server with its session, trace, and debug HTTP endpoints. Use when an agent returns the wrong answer, ignores a tool or swallows a tool error, hangs, loops, emits raw JSON instead of calling tools, is not discovered by `adk web`, when a sub-agent cannot see the parent conversation, or when you need the LLM request/response, token counts, or logs for a run. Don't use for how ADK is designed internally (use `adk-architecture`), for building a new agent or workflow (use `adk-agent-builder`), for environment or dependency setup failures (use `adk-setup`), or for lint and style nits (use `adk-style`).
02 资源文件 5
- 参考文档references/cli-run.md4.9 KB
- 参考文档references/event-flow.md4.6 KB
- 参考文档references/failure-modes.md5.3 KB
- 参考文档references/logs-and-traces.md4.3 KB
- 参考文档references/web-api.md3.4 KB
03 SKILL.md 正文
Debugging ADK agents
Two entry points. Default to adk run: one process, no server, and --jsonl
output that pipes straight into grep or python3. Switch to adk web when
you need the browser UI, a persisted session you can click through, or the
trace endpoints that expose the exact LLM request.
First moves
- Reproduce headlessly:
adk run --jsonl {agent_dir} "{query}". Without--jsonl,adk runprints only text parts — tool calls and tool errors are invisible. - Read the log file.
adk runwrites to/tmp/agents_log/agent.latest.logand nothing to the terminal;adk webdoes the opposite. See logs-and-traces.md. - Match the symptom in failure-modes.md before reading source — most reports are one of a handful of known shapes.
- If the text is fine but the routing is not, dump the events and read
author,branch,nodeInfo.path, andactions— event-flow.md. - If the model itself misbehaved, read what it actually received from the
call_llmspan rather than guessing from the agent definition — logs-and-traces.md.
References
- cli-run.md —
adk runflags, the JSONL event shape, multi-turn and human-in-the-loop resume, exit codes, driving aRunnerfrom Python. - web-api.md — starting
adk web, listing and reading sessions over HTTP, posting test messages to/run_sse. - logs-and-traces.md — log levels and where each command writes them, the trace endpoints, span attributes, and the env vars that control whether prompts appear in spans.
- failure-modes.md — ADK-specific symptoms with the cause and a concrete check for each.
- event-flow.md — how an invocation becomes events, callback order, the event fields that matter, and where each stage lives in the source.
Ground rules
- Leave sessions in place when you finish. The user may still want to open them
in the web UI, and
adk webhas no undelete. - Delete any throwaway agent you created for a repro, unless the user asked to keep it.
- Reach for a unit test in
tests/unittests/when the bug is inside one component, and for a sample undercontributing/samples/(seeadk-sample-creator) when it only reproduces with runner, agent, and workflow wired together.
04 同仓库更多 Skills
BigQuery 图查询分析
bigquery-graph
针对属性图使用图查询语言(GQL)或 SQL/PGQ 进行查询的技能。包括路径查找、多跳遍历、拓扑连接、最短路径、节点可达性、边连通性和语义图查询。
BigQuery AI 与机器学习分析
bigquery-ai-ml
利用 BigQuery 内置的机器学习与生成式 AI 能力进行高级数据分析。当您需要编写 SQL 查询以执行时间序列预测、数值预测、异常值或异常检测、寻找关键驱动因素、语义搜索或向量搜索、文本分类、相似度计算、内容摘要、语言翻译、模型评估、按语义条件筛选、衡量干预措施的因果效应、计算列之间的相关性、检测变化点或结构性突变、提取趋势或季节性成分,或利用 BigQuery 中的生成式 AI 能力时使用。不适用于常规的 BigQuery 数据集、表或作业管理请求。
代码审查与定制反馈
code-review-skill
审查代码,并根据会话状态中开发者的个人画像提供量身定制的反馈。
天气信息查询
weather-skill
基于参考数据提供天气信息的技能。
天气信息查询
weather-skill
基于参考数据和脚本提供天气信息的技能。
天气信息查询
weather-skill
一种基于参考数据提供天气信息的技能。