All skills
google avatar

/adk-debug

@29933ce
by googlegoogle/adk-python22k stars
4,084

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`).

Use this Skill: https://skilld.dev/gh/google/adk-python/adk-debug

This session only. Nothing lands on disk.

referencesfailure-modes.md

≈1.2k tokens on demand. Your agent reads this file only when SKILL.md points to it.

ADK failure modes

Match the symptom first; each entry names the mechanism and a check you can actually run.

The agent emits raw JSON instead of calling tools

output_schema puts the model into controlled generation: it sets config.response_schema and config.response_mime_type = "application/json" on the request, and a model in JSON mode returns JSON, not tool calls.

Check the call_llm span's gcp.vertex.agent.llm_request for response_mime_type (references/logs-and-traces.md). ADK only applies the schema when the agent has no tools, or when the model can do schemas and tools together — so the opposite symptom, a schema that seems to be ignored, means you landed on the other branch.

Source: src/google/adk/flows/llm_flows/basic.py, src/google/adk/utils/output_schema_utils.py.

ValueError when constructing the agent

Three messages come from the same validator, all meaning "you set this on generate_content_config instead of on the agent":

  • All tools must be set via LlmAgent.tools.
  • System instruction must be set via LlmAgent.instruction.
  • Response schema must be set via LlmAgent.output_schema.

Source: LlmAgent.validate_generate_content_config in src/google/adk/agents/llm_agent.py.

LlmCallsLimitExceededError: Max number of llm calls limit of N exceeded

run_config.max_llm_calls was hit. Treat the limit as a loop detector before raising it — dump the events and look for the same tool being called with the same arguments turn after turn. Source: src/google/adk/agents/invocation_context.py.

A tool "fails" but the agent carries on

Tool failures are converted into a function response carrying the error, so the model sees a result and keeps going. Look for a functionResponse whose payload has an error key. FunctionTool produces the same shape for two non-exception cases: missing mandatory arguments, and a confirmation-required tool that was not confirmed or was rejected.

To intervene, register on_tool_error_callback on a plugin or on_tool_error_callbacks on the agent. Source: src/google/adk/flows/llm_flows/functions.py, src/google/adk/tools/function_tool.py.

adk web does not list the agent, or returns 404

curl -s http://localhost:8000/list-apps | python3 -m json.tool

The loader accepts four layouts under {agents_dir}, checking for a top-level app before root_agent:

{name}/agent.py          # defines root_agent (or app)
{name}.py                # defines root_agent (or app)
{name}/__init__.py       # defines root_agent (or app) in the package
{name}/root_agent.yaml   # config-defined agent

__init__.py does not need from . import agent — the loader imports the agent submodule itself. Pointing adk web at a directory that itself contains agent.py or root_agent.yaml runs that single agent instead of treating the directory as a collection. Source: src/google/adk/cli/utils/agent_loader.py.

A sub-agent cannot see the parent conversation

Events carry a branch (agent_1.agent_2.agent_3), and the content builder drops events that do not belong to the current agent's branch — that isolation is deliberate, so peers do not read each other's history. Delegated task agents are isolated further by isolation_scope.

There is no flag to switch it off. Put whatever the sub-agent needs into the delegation input; the sub-agent's description is what steers the parent into including it. Source: _is_event_belongs_to_branch in src/google/adk/flows/llm_flows/contents.py.

The whole agent stalls while one tool runs

A synchronous tool function is awaited inline on the event loop, so anything blocking inside it — a requests call, time.sleep, a large file read — freezes the entire run, not just that tool.

Make the tool async. In live mode only, you can instead hand tools to a thread pool:

from google.adk.agents.run_config import RunConfig, ToolThreadPoolConfig

run_config = RunConfig(tool_thread_pool_config=ToolThreadPoolConfig())  # 4 workers

Source: FunctionTool._invoke_callable in src/google/adk/tools/function_tool.py, _call_tool_in_thread_pool in src/google/adk/flows/llm_flows/functions.py.

The run stops early and nothing looks wrong

adk run exits 2 when an event carries longRunningToolIds: a human-in-the-loop tool is waiting for an answer. See references/cli-run.md for how to resume.

The answer is cut off, empty, or blocked

Read gen_ai.response.finish_reasons on the call_llm span rather than inferring from the text — max_tokens means raise max_output_tokens, safety and recitation mean the model refused. See references/logs-and-traces.md.

The run ends with error_code="INVOCATION_ABORTED"

abort_signal was set on runner.run_async, or the HTTP client disconnected from /run_sse before the stream finished. The runner synthesizes a terminal event with error_code="INVOCATION_ABORTED" and seals any in-flight FunctionCall with a FunctionResponse carrying {"error": "Invocation was aborted by client."} so the session remains valid for the next turn. Source: Runner._synthesize_abort_events_if_needed in src/google/adk/runners.py, src/google/adk/cli/api_server.py.

Source: SKILL.md on GitHub

No alerts17d3 checks · Risk SAFE
  • Gen Agent Trust Hub17d

    This skill provides comprehensive instructions and reference material for debugging agents built with the Agent Development Kit (ADK). It includes security-conscious guidance, such as restricting development servers to the local loopback interface and managing telemetry data capture.

  • Socket17d

    No alerts

  • Snyk17d

    Risk: LOW · No issues

Signed by skilld at 29933ce. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 2 months ago

README badge

README badge for google/adk-python/adk-debug