Guides · AI agent safety
AI agent guardrails: set them up before your agent touches production
An AI agent guardrail is a control that sits outside the model and checks what the agent is about to do — before it does it. Four of them, set up in this order, cover nearly every agent incident you have read about. Give the agent its own least-privilege identity. Cap what it can spend. Make irreversible actions wait for a human. And keep a kill switch with an audit trail behind everything. None of them is a sentence in a prompt. That distinction is the whole guide.
By the Ingenious AI team · Published 19 November 2026
The enforcement layer we build on: Agent Auth Gateway puts caps, approval queues and a kill switch in the execution path of your agents — the mechanisms this guide describes.
The terms, in plain language
Agent guardrails are the controls that bound what an agent can do: which tools it may call, what it may spend, which actions need a human first. A spend cap is a hard limit — per run, per day, per month — enforced by the system running the agent, not requested in the prompt. An approval queue is a holding area where risky actions wait for a named human to approve or reject them, with the context shown. A kill switch is a single control that halts an agent immediately, mid-run. An audit trail is the tamper-evident record of what the agent did — the trigger, the tool calls, the data touched, the approvals — kept so a reviewer can replay it later. Every control below is one of these five, doing its one job.
Why prompt rules fail at 3 a.m.
Every team starts with the same guardrail: a line in the system prompt. "Never touch production." "Do not delete anything." "Ask before spending." It feels like a rule. It is actually advice — text the model weighs against everything else in its context, including a user (or a web page, or a document the agent just read) telling it the opposite. Models are trained to be helpful, and at 3 a.m., mid-task, with a plausible reason in front of it, helpful wins over a quiet clause forty instructions back. Worse, when a prompt rule is broken there is no alarm and no record. Nothing pages you. You find out from the invoice, or from a customer.
The public incidents follow this shape with depressing consistency. An agent deleted a production database during an explicit "do not touch anything" freeze — the instruction existed; nothing enforced it. Another ran a destroy command that took the database and its snapshots together, because the credentials it held were broad enough to allow both. The lesson is not that prompts are useless. It is that a prompt is where you explain the job, and enforcement has to live somewhere the model cannot argue with: in the path between the agent's decision and the tool call. If a control can be talked out of firing, it is not a control.
Control 1: Per-agent identity and least-privilege credentials
Set this up first, because every other control keys off it. Each agent gets its own identity and its own credentials, scoped to the smallest set of actions its job needs. A reporting agent that reads two tables gets read access to two tables — not the shared admin key the whole fleet inherited from a tutorial. Per-agent credentials buy you three things: attribution (you know which agent acted), revocation (you can cut one agent off without breaking the rest), and a blast radius measured in one job instead of the whole company. The full pattern, including the move from one shared key, is in per-agent API keys for agent fleets.
Control 2: Spend caps with a burn forecast
Agents spend money by calling paid models and APIs, and a loop turns a small spend into an overnight bill — one documented agent repeated a failing command hundreds of times and burned through tens of millions of tokens before a human woke up. A cap stops that mechanically: at the limit, calls throttle or halt, and an alert fires while there is still time to look. Set caps per run (catches loops), per day (catches slow leaks) and per month (catches drift), and pair them with a burn forecast that warns at the pace, not just at the wall. Give your AI agent a budget works through the numbers for a small team, and how to stop an AI agent runaway loop dissects the case that made this control famous.
Control 3: Approval queues for irreversible actions
Some actions cannot be un-done: deleting data, moving money, emailing customers, changing who has access. Those wait for a human. Sort every action your agent can take into reversible, costly, irreversible and external-facing; the last two tiers go through the queue, everything else runs free inside its caps. A queue only works if it shows the approver what matters — the action, the target, the cost, the reason the agent gives — and if approvals expire instead of sitting valid forever. The taxonomy and the anti-rubber-stamp design are in the human-in-the-loop approval queue playbook.
Control 4: Kill switch and audit trail
The kill switch is the control you hope never to use and must be able to reach in seconds: one action that halts the agent, revokes its session, and freezes its queue. Test it in peacetime; a kill switch nobody has pressed is a rumour. Behind it, the audit trail records everything — hash-chained so entries cannot be quietly edited afterwards — because the first question after any incident is "show me exactly what it did", and "the chat transcript, roughly" is not an answer. The deep treatment is the AI agent audit trail guide in this hub.
The setup order, on one page
Identity first, because caps and queues attach to an agent, not to a shared key. Caps second, because runaway spend is the incident with the shortest fuse. Approvals third, for the actions money can't undo. Kill switch and audit trail last in setup, first in an incident. If you are about to give an agent production access today and have none of this, the honest minimum before the first run is: its own scoped credentials, a daily cap, and deletions behind an approval. The rest can follow within the week. What cannot follow is the first incident — when an AI agent deletes your production database is the postmortem version of this page, and it is cheaper to read than to live.
Sources
- OWASP — Top 10 for LLM Applications (2025) — LLM01 (prompt injection) and LLM06 (excessive agency) name the two failure classes most of these controls exist to bound.
- NIST — Artificial Intelligence Risk Management Framework (AI RMF) 1.0 (2023) — the Govern and Manage functions are the framework version of this guide's setup order: assign control before deployment, then monitor.
Frequently asked questions
How do I stop my AI agent from doing something it shouldn't?
Put the enforcement outside the model, before the tool call. Give the agent its own least-privilege credentials, cap what it can spend per run and per day, route irreversible actions — deletions, payments, external messages — through a human approval queue, and keep a kill switch plus a tamper-evident audit trail. A rule written in the system prompt is advice the model can be talked out of; a check in the execution path cannot be.
What is the difference between a guardrail and a system prompt rule?
A system prompt rule is text the model reads and usually follows. A guardrail is a mechanism that inspects or blocks the action itself — a spend cap that refuses the call, an approval queue that holds it, a proxy that denies the credential. Prompt rules fail silently and leave no record; mechanisms either stop the action or log that they didn't.
Which agent actions should always need human approval?
Anything irreversible or external-facing: deleting or overwriting data, moving money, sending messages to customers, changing permissions, and deploying to production. Reversible, low-cost, internal actions can run automatically inside their caps. The approval queue playbook in this hub has the full taxonomy.
Do guardrails slow agents down too much to be useful?
Caps and identity checks add milliseconds. Approval queues add minutes, but only to the small share of actions that are irreversible — everything else flows. Compare that with the cost of one unapproved production deletion or one overnight runaway loop, and the queue is the cheapest part of the system.