Guardrails and approvals for AI agents
How to let an agent help without letting it do harm: read and write tools, approvals, limits and least privilege.
Guardrails are limits enforced by your code and your permissions, so they hold whatever the model decides. The most useful one is simple: sort tools into reads and writes. Reads run freely; writes need a person to approve the exact action, shown as the real tool name and arguments.
Around that, add limits: a step limit, a budget, an allow list of the services or resources the agent may touch, timeouts on tools, and a kill switch. Then limit identity: the agent's account gets read-only rights, and the few write tools use a separate identity with narrow rights.
Instructions in the prompt ('never restart payments') are helpful hints, not guardrails. Models can ignore them, misread them or be talked out of them by injected text.
Cost. Free: guardrails are code and permissions, not a product.
Use it when
- an agent will have any tool that changes something.
- you're deciding what an agent may do without asking.
- an auditor asks how the agent is controlled.
How it works
- Classify tools
- Read or write, and how bad a mistake would be.
- Approve writes
- A person sees the exact action and says yes.
- Limit the loop
- Steps, budget, timeouts, allow lists.
- Limit identity
- Least privilege for each tool.
- Record
- Trace every call, approval and refusal.
Options
- Approve every write
- Safest; fine when writes are rare.
- Auto-approve low-risk writes
- Faster, only for actions that are easy to undo and on an allow list.
Example. Ironbridge Payments lets its agent scale a test environment on its own, because that's cheap and easy to undo. Anything in production needs the on-call lead's approval, and the agent's identity has no rights at all on the payments databases.
Don't confuse it with
- Guardrail
- Enforced by code or permissions.
- Prompt instruction
- A request to the model, which it may not follow.
Words to know
- Human in the loop
- A person approves before an action runs.
- Allow list
- Only the explicitly permitted values or actions.
- Kill switch
- A fast way to stop the agent.
Where to look
- Your agent's run loop
- Its identity's role assignments
Practise it
- Add approvals and limits to an agentHow-to, Free
- Final project: an on-call helper agentHow-to, Free
- Build a safe AI troubleshooting agent for KubernetesHow-to, Costs money
Read it in the guide, next to the tasks and labs.
Open in DevOps, Hands On