agent-reliability-and-guardrails
Agent Reliability & Guardrails
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.
1. The loop and why it goes wrong
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