Skip to main content
Let your agent set this up. Copy the evaluations prompt into your coding agent to get started automatically.
Guardrails are evaluators that run in real-time and act on the results - blocking, modifying, or rejecting responses that violate your safety or policy rules. Unlike monitors which only measure and alert, guardrails actively prevent harmful content from reaching users.

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

Guardrails can run at two points:
  1. Input guardrails - Check user input before calling your LLM
  2. Output guardrails - Check LLM response before sending to user

Getting Started

Code Integration

Available Evaluators

Quick Example

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

Next Steps

Code Integration

Evaluators List

Online Evaluation

Python Integration