bigonotes
AIAgents

Guardrails

The three guardrails every agent needs, always together: a maximum number of steps, a budget cap, and human approval for risky actions.

2 min readLast updated

Because the model drives the loop, an agent can run longer, spend more and do more than you planned. Every agent needs three guardrails, always, and all three together.

Each turn of the agent loop passes three gates: the step count, the budget, and human approval for risky actions; hitting a cap stops the loop and returns what it has

1. Maximum steps#

Cap the number of iterations. If the agent has not finished after 15 tool calls, something has gone wrong.

  • Stop the loop.
  • Return what you have so far.
  • Surface an error.

Never let an agent run unbounded.

2. Budget cap#

Each iteration is another model call, possibly a tool call, and more tokens. Set a maximum token or cost budget per request. A runaway agent is also a runaway bill.

3. Human approval for risky actions#

Before anything irreversible, that is anything that sends, deletes, pays or publishes, pause and ask the user to confirm.

The model may have misunderstood the intent, and once the action is taken you cannot undo it. A person approving the action is also what stops a prompt injection from turning into a real action.

Why all three#

Guardrail What it stops
Maximum steps A loop that never finishes
Budget cap A loop that finishes but costs far too much
Human approval A single wrong step that cannot be undone

Each one covers a failure the other two miss. A step cap does not stop one expensive step, and neither cap stops an irreversible action on step 2.

These are the same controls as for any tool calling loop: see Limits and Risky actions. With an agent they matter more, because the model, not your code, decides how far the loop goes.

Short line#

Every agent needs three guardrails together: a cap on steps so it cannot run unbounded, a token or cost budget so it cannot run up a bill, and human approval before anything that sends, deletes, pays or publishes.

Key takeaways#

  • Always use all three guardrails together.
  • Maximum steps: for example 15 tool calls, then stop, return what you have and surface an error.
  • Budget cap: a maximum token or cost budget per request.
  • Human approval before any irreversible action: send, delete, pay or publish.
  • Each guardrail covers a failure the other two miss.
Revision notes · 1 min

Core idea#

Every agent needs three guardrails, always, all three together.

Three guardrails#

Guardrail What it stops
Maximum steps (for example 15) A loop that never finishes
Budget cap (tokens or cost) A runaway bill
Human approval for risky actions An irreversible wrong step

Key points#

  • At the step cap: stop, return what you have, surface an error.
  • Each iteration is a model call, maybe a tool call, more tokens.
  • Confirm before anything that sends, deletes, pays or publishes.
  • The model may misread intent. An action taken cannot be undone.
  • Each guardrail covers a failure the other two miss.

Pitfalls#

  • Never let an agent run unbounded.
  • Do not use only one or two of the three.

Short line#

Cap steps, cap budget, and get human approval before irreversible actions.

Found a mistake? Email ask@bigonotes.com