Guardrails
Rules and checks that stop an agent doing damage: step limits, argument validation, permissions and approvals.
Last updated
Analogy
Branch protection rules for a bot that types very fast and never gets tired.
In an agent
Juniors build the demo; seniors explain how it stays safe. Guardrails are the first half of that answer.
Practice
Flashcards
- What are guardrails?Rules and checks that keep an agent safe: step limits, validation, permissions, approvals.
- Interview: four guardrails against harmful actions?Step limits, Zod validation of arguments, least-privilege tools with approval for writes, and treating tool output as untrusted.
Interview questions
- How do you stop an agent doing something harmful?
- A maximum step limit.
- Zod validation of every tool argument.
- Least-privilege tools and human approval for write actions.
- Treat all tool output as untrusted data to defend against prompt injection.
Questions people ask
What are guardrails for AI agents?
Guardrails are rules and checks that stop an agent from doing damage: a maximum number of steps, validation of every tool argument, limited permissions for each tool, and human approval for risky actions. They live in your code, not just in the prompt, so a confused model cannot talk its way past them.
How do I explain agent safety in an interview?
Name concrete guardrails. A step limit stops endless loops. Zod validates every tool argument. Tools get least privilege, with human approval for writes. Tool results are treated as data, never as instructions. Then mention tracing and evals, so you can see failures and measure fixes. Specifics beat saying it is safe.