agent-debug
Skill0 starsChanged 11 days agoApache-2.0View on GitHub
Triages a misbehaving or flaky Google ADK agent to a layer and a fix. Names the failure shape from a trace or an eval result - loops, oscillation, stalls, invented tools, cascading argument errors - then works out whether the cause is the tool layer, the prompt layer, the model layer, or the evaluation itself, and closes with a regression case and a reliability re-check. Use when told "my agent loops / hangs / repeats itself", "it calls the wrong tool", "it skips a step sometimes", "it made up a tool", "the eval passes sometimes", "the trace looks right but the answer is wrong", or "why is this flaky". Don't use for static code problems (use `/adk:agent-review`), for reading scores (use `/adk:eval-analyze`), or for writing the cases themselves (use `/adk:eval-create`).
3 other projects use a version of this.
Adopted by
Most recently taken up by
- manastalukdar/ai-devstudiotheir own version, first seen Oct 13, 2026
- DmNote-App/DmNotetheir own version, first seen Oct 8, 2026
- angelgabrieljacintohuayllasco/clipboard-skillstheir own version, first seen Sep 20, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- DmNote-App/DmNote★ 4.2ksame name
- manastalukdar/ai-devstudio★ 1same name
- angelgabrieljacintohuayllasco/clipboard-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository10 other files it gives its agents.
- adkSkill
- agent-createSkill
- agent-reviewSkill
- eval-analyzeSkill
- eval-ciSkill
- eval-createSkill
- eval-criteriaSkill
- eval-reviewSkill
- eval-runSkill
- eval-simulationSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 36
Rule out the evaluation first: Before debugging the agent, check the test is right:
- Very specific: line 64
Ask with AskUserQuestion and wait.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Debug a misbehaving ADK agent
The expensive mistake is a correct fix applied at the wrong layer: tightening a prompt when the tool's error message was the problem, or changing a model when the instruction was ambiguous. So this works out which layer before suggesting anything.
${CLAUDE_SKILL_DIR} is set by the skill runtime to this skill's own
directory. Use it verbatim in every command below; a sibling skill's scripts
are at ${CLAUDE_SKILL_DIR}/../<skill>/scripts/.
Flow
Two of the steps below spend money — a fresh adk run costs a model call per
turn, and five suite runs cost five suites. Neither happens before the user has
seen the evidence and chosen.
Rule out the evaluation first. Before debugging the agent, check the test is right:
- Is the golden trace still correct, or did the behaviour change deliberately?
- Are the thresholds sensible — is anything scored on wording that should not be?
- Did the run actually score, or is this a
NOT_EVALUATEDin disguise?
A wrong eval means you are debugging a false positive.
Read the evidence that already exists. Free, and usually enough to name the shape:
python3 ${CLAUDE_SKILL_DIR}/scripts/analyze_trace.py --result <agent-dir>/.adk/eval_history --eval-id <id> python3 ${CLAUDE_SKILL_DIR}/scripts/analyze_trace.py --trace <existing.jsonl> --agent-dir <agent-dir>- Report. The shape, the layer it points at, the first divergence, and what the existing evidence cannot settle.
Options, with their cost, then confirm. Typically:
Option Cost Answers capture a fresh trace one model call per turn what the agent does now, with tool calls visible five runs, then pass@k five full suite runs deterministic or stochastic fix at the named layer free to propose — Ask with
AskUserQuestionand wait. Nothing below runs before the answer.Run what was chosen.
adk run <agent-dir> --jsonl "the request that fails" > /tmp/run.jsonl python3 ${CLAUDE_SKILL_DIR}/scripts/analyze_trace.py --trace /tmp/run.jsonl --agent-dir <agent-dir>Without
--jsonl,adk runprints text only and every tool call is invisible.python3 ${CLAUDE_SKILL_DIR}/../eval-run/scripts/run_evals.py <agent-dir> --runs 5 python3 ${CLAUDE_SKILL_DIR}/../eval-analyze/scripts/pass_at_k.py --dir <agent-dir>/.adk/eval_historySame failure every time is a different diagnosis from three times in five, and the fixes have nothing in common.
- Name the fix, confirm, close the loop. One change at the named layer, a regression case, re-run several times, then the full suite.
The three layers
| Layer | What lives there | How it fails |
| tool | Python functions, schemas, the messages tools return | right tool, wrong arguments; endless retries after an unhelpful error |
| prompt | the instruction: ordering, prohibitions, tool descriptions | right tools, wrong order; a tool never called; two tools confused |
| model | sampling, capability, what the model invents | different result each run; invented tools; steps skipped sometimes |
Plus the evaluation itself, which is step 1 for a reason.
Failure shapes
Three worth memorising, because they cover most first reports:
| Shape | Signature | Layer | First fix |
| loop | the same call with the same arguments, three or more times | tool | nothing new is coming back: make the error response say what to change, and cap retries in the instruction |
| stall | model text where a call was required | prompt | no safe path for this input; define the default action for an ambiguous request |
| varies per run | passes sometimes | model | lower the temperature, then make the requirement explicit, then reconsider the model |
The other five — oscillation, invented tool, cascade, wrong order, wrong tool —
plus what each one rules out, are in
failure-shapes.md. analyze_trace.py names them
all, so read the script's output rather than matching by eye.
Deciding between layers
Deterministic — same failure every run:
- right tool, wrong arguments → tool layer: tighten the schema, or improve the argument's description in the docstring.
- right arguments, wrong sequence → prompt layer: add the ordering rule.
- a tool that should have been called never is → prompt layer: the descriptions do not distinguish it.
- everything looks right and the outcome is wrong → cascade: work backwards to the first divergence.
Stochastic — passes sometimes:
temperature=0.0fixes it → sampling variance. Lower it, or add a structural constraint so there is less to vary.- an explicit "do not skip steps" fixes it → the instruction was underspecified. Make the requirement explicit rather than louder.
- neither → a capability limit. In order: add pipeline constraints, split the work across agents, then consider a stronger model for that step.
Decision rules
- Fix the first divergence, not the last symptom. Everything after it is consequence.
- One change at a time, then re-measure. Two simultaneous fixes on a non-deterministic system teach you nothing.
- A tool failure does not raise. ADK returns it as a result with an
errorkey and the run continues, so "the tool silently did nothing" means reading the tool responses. - Five runs before and after. One green run after a change proves nothing that one green run before it did not. Both sets cost model calls, so say so and get the go-ahead before either.
- Every fix earns a regression case. The repro that found it is the case that keeps it fixed.
References
| Question | File |
| The shapes in detail, with what each rules out | failure-shapes.md |
| The decision tree, step by step | triage.md |
| Where evidence comes from: jsonl, traces, logs, spans | evidence.md |
Scripts
| Command | Does | Exit codes |
scripts/analyze_trace.py (--trace F | --result F [--eval-id ID]) [--agent-dir D] [--json] | names shapes, layers and divergences | 0 nothing found, 1 findings, 2 nothing to read |
scripts/run_jsonl.py <agent-dir> "<prompt>" [--runs N] [--out F] [--state-file F] [--dry-run] [--json] | reproduces one interaction with adk run --jsonl and keeps the trace under .adk/skills/traces/; --state-file seeds the session state (ADK 2.12+, exit 2 on older); spends model calls, so confirm first | 0 captured, 1 no events, 2 env |
Completion checklist
- The evaluation was ruled out before the agent was blamed.
- Existing evidence was read, and reported, before anything billable ran.
- Every billable option was offered with its cost, and the user chose.
- The failure was reproduced, and shown to be deterministic or stochastic.
- A shape and a layer were named, with the evidence for them.
- One change was made at that layer.
- A regression case was added.
- The fix was confirmed across several runs, not one.
- For a loop, the reply itself leads with the layer, says that the tool returned its error instead of raising (so the run kept going), and proposes both an error message that says what to change and a retry cap.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

