Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Sets iteration, tool-call, token, time and cost budgets, termination, guardrails, and verification for autonomous tool-using LLM agents.
86% 91%+5 ptsof test cases passed
Passed 20 of 22 test cases with the skill, and 19 of 22 without it.
We are designing a lightweight Python agent wrapper and only want to track token usage and USD cost to save memory. We also plan to check budgets right after each tool execution completes. Review this approach and provide a design specification for complete budget management.
Mandates tracking all five budget types: iteration steps, total/per-tool calls, total tokens, wall-clock time, and cost
3 of 3 safety checks passed
An agent is a loop that lets an LLM choose its own next action. That single property — the model, not your code, decides what happens next — is the source of every reliability problem here. A chatbot that hallucinates wastes one reply; an agent that hallucinates executes the hallucination, then feeds the result back into its own context and decides again. Errors don't stay put. They compound, they loop, and without budgets they burn real money until something external stops them.
This skill is the control system you wrap around that loop. None of it is optional polish: an agent with no iteration cap, no kill switch, and no action gate is a liability the first time a prompt goes sideways. Set every budget. Add every guardrail. Default to stop and report, never silently continue.
The canonical agent loop:
state = init(goal)
while not done(state):
plan = llm.decide(state) # choose next action (tool + args)
result = execute(plan.action) # run the tool
state = observe(state, result) # fold result back into context
# repeat — the model sees its own last result and decides again
Three structural failure classes fall straight out of this shape:
0.9^10 ≈ 35% end-to-end. Reliability decays geometrically with loop length. The fix is not a smarter model — it's shorter loops, verification gates, and checkpoints that stop the decay from propagating.Everything below exists to bound, detect, or interrupt one of these three.
A budget is a hard ceiling checked before each action. Exceeding any one halts the loop. Never ship an agent with fewer than all five. They catch different runaway shapes: a tight loop blows the iteration budget, an expensive-tool loop blows the cost budget, a slow-tool hang blows wall-clock.
| Budget | Bounds | Starting value (tune per task) | Trips on |
|---|---|---|---|
| Iteration / steps | loop count | 15–30 typical task; ≤8 simple; ≤50 hard | tight loops, oscillation |
| Tool calls | total + per-tool | ~2× iterations total; per-tool cap (e.g. ≤5 web_search) | one tool spammed |
| Token | cumulative in+out | per task (e.g. 200k); separate context-window guard | context bloat, long transcripts |
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.