Guardrails vs Monitors
Use guardrails when you need to prevent something from happening. Use monitors when you need to observe what’s happening.
Common Guardrail Use Cases
How Guardrails Work
- Input guardrails - Check user input before calling your LLM
- Output guardrails - Check LLM response before sending to user
Getting Started
Code Integration
Available Evaluators
Quick Example
- Python
- TypeScript
Best Practices
1. Layer your guardrails
Use multiple guardrails for defense in depth:2. Provide helpful error messages
Don’t just block - guide users toward acceptable behavior:3. Log guardrail triggers
Track when guardrails fire for monitoring and improvement:4. Consider latency
Guardrails add latency. For time-sensitive applications:- Use fast evaluators (regex, blocklists) for input checks
- Save heavier evaluators (LLM-based) for output checks
- Run multiple guardrails in parallel when possible