| name | agentic-loop-auditor |
| description | Audit agent frameworks and agentic workflows for token-burning loop pathologies — unbounded retries, excessive planning depth, tool-call thrashing, context snowballing, missing loop budgets and kill switches. Use this skill whenever the user shares agent configs or traces (LangChain/LangGraph, CrewAI, AutoGen, custom loops), complains an agent is slow or expensive, or is designing any autonomous/multi-step agent. Part of Lean Agentic AI Skills; emits lean-findings.json. |
Agentic Loop Auditor
Producer skill. Input: agent configs, execution traces/logs, orchestration code. Output: lean-findings.json.
Agents multiply inference: one user request can fan out into dozens of model calls, each carrying a growing context. Loop pathologies are the highest-leverage waste in modern AI systems — and the least audited.
Subject type: emit subject.type: "ai-agent" in findings.
Signatures
- Unbounded retries — no max-attempt on failed tool calls or unparseable outputs; the agent argues with the error forever. High. Fix: retry budget (2–3) with backoff, then structured failure surfaced to user.
- No step/token budget — loops without max-iterations or cumulative token ceilings. High. Fix: hard budgets with graceful "here's what I have so far" termination.
- Context snowballing — full history + full tool outputs re-sent every step; context grows quadratically over the run. High. Evidence from traces: tokens-per-step curve. Fix: tool-output truncation/summarization, sliding window with pinned goal, scratchpad instead of transcript.
- Tool-call thrashing — repeated identical or near-identical calls (same search, re-reading the same file) visible in traces. High. Fix: per-run tool memo cache; instruct the model that results persist.
- Excessive planning depth — multi-step deliberation, subagent trees, or reflection rounds on tasks a single call solves. Medium-high. Fix: complexity-gated planning — plan only past a triviality threshold.
- Max-power model for every hop — the loop's router/formatter steps on the frontier model. Medium; route to model-right-sizer patterns.
- Chatty heartbeats/polling — scheduled agent wakeups doing full reasoning to conclude "nothing to do". Medium (a common pathology in always-on personal-agent frameworks). Fix: cheap pre-check (does the checklist have deltas?) before waking the big model; lengthen intervals.
- No cost/energy observability — nothing logs tokens per task; waste is invisible. Medium. Fix: per-run receipt (pairs with sci-receipt).
Procedure
If traces exist, compute real numbers: calls per task, tokens per step, duplicate-call rate — these are countable, report them. If only config exists, audit for the absence of guardrails and mark quantitative items out_of_scope.
Honesty rules
Budgets trade against task-completion on genuinely hard tasks — recommend budgets with escalation ("ask the user to continue") rather than silent truncation. Autonomy reductions are product decisions; present them as options with the energy rationale, not mandates.
Cost signal (countable)
Cost drivers: tokens per task (cumulative across loop hops) and tool-call count per task. Both countable from execution traces. Every loop-pathology finding should quote them.
Not this skill's job
Model choice (model-right-sizer), prompt bodies (prompt-carbon-optimizer), when to run the agent (carbon-aware-scheduler).