1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
51 small wins to finish your pathNext question →
What are guardrails, and what types are there?
30-second answerSay your answer out loud first, then reveal.
| Type | Examples | Implementation |
|---|---|---|
| Input | PII redaction, jailbreak/injection detection, off-topic filter, length limits, language detection | Regex, NER, classifiers, small LLM |
| Output | Toxicity, PII leak, hallucination/groundedness, schema validation, competitor mentions, brand tone | Classifiers, validators, LLM judges |
| Action / tool | Allow-listed tools, parameter validation, spending limits, approvals, sandboxing | Code-level policy enforcement |
| Dialogue / flow | Scripted flows for sensitive topics, escalation to humans | Rails frameworks, state machines |
| System-level | Rate limits, abuse detection, monitoring, kill switches | Infrastructure |
Key principle: guardrails in code and architecture are reliable; guardrails in prompts are guidance the model may not follow. Use both, but enforce critical policies in code.
Trade-offs: each guardrail adds latency and cost and can cause false positives (over-blocking). Tune thresholds with evals (Q28).
Related
You understood something today that you didn't yesterday.