TechPrep
Production AI systemsReadPracticeCheck

Guardrails

Layered checks on inputs, outputs and actions, chosen from the harms that matter for this product rather than a generic list.

A guardrail is any control that keeps an LLM feature inside acceptable behaviour. No single layer is reliable, so stack several cheap ones and keep the expensive human review for the highest-risk actions.

LayerExamples
InputAuthentication and quotas; PII detection and redaction; topic or intent classification; size limits; prompt-injection heuristics on untrusted content
Model and promptClear scope in the system prompt; refusal instructions; model choice with appropriate safety behaviour
OutputSchema validation; citation checks; toxicity or policy classifiers; blocking secrets and PII in responses
ActionLeast-privilege tools; authorisation as the user; human approval for irreversible steps; rate limits on side effects
MonitoringSampling and review of transcripts; alerts on refusal spikes, unusual tool use or cost

Trade-offs to state

The security track goes deeper on prompt injection, data exfiltration and tool permissions.

Practice

Written for this site to drill the lesson. Not reported interview questions.

  1. Choose guardrails for a public-facing tax-help chatbot. Which layer catches which harm?
  2. Your output classifier blocks 4% of legitimate answers. How do you decide what to change?

Check yourself

Why layer guardrails?

No single layer is reliable; independent cheap layers catch different failures.

Which actions need human approval?

Irreversible or high-impact ones: payments, sending external messages, deleting data, production changes.

Sources

Saved in this browser.