Guardrail Types
Raven supports four guardrail types, each designed for a different class of content risk.| Type | Purpose | Example |
|---|---|---|
| block_topics | Prevent requests about specific subjects | Block requests mentioning “weapons” or “illegal activities” |
| pii_detection | Detect personally identifiable information | Flag SSNs, emails, or credit card numbers in prompts |
| content_filter | Filter content by category | Block “violence” or “adult” content categories |
| custom_regex | Match arbitrary patterns | Catch internal project codenames or proprietary terms |
Actions
Each guardrail has an action that determines what happens when content matches.- block — Immediately reject the request with an error. The request never reaches the provider.
- warn — Allow the request but include a warning in the response. Logged for review.
- log — Silently log the match for auditing. The request proceeds normally.
PII Types Supported
Thepii_detection guardrail can detect the following PII types:
| PII Type | Pattern | Example Match |
|---|---|---|
ssn | Social Security Numbers | 123-45-6789 |
email | Email addresses | [email protected] |
phone | Phone numbers | 555-123-4567 |
creditCard | Credit card numbers | 4111 1111 1111 1111 |
ipAddress | IP addresses | 192.168.1.1 |
Creating a Guardrail
Via the Dashboard
Configure the Rule
Set the name, action, and type-specific configuration (topics, PII types, regex pattern, or content categories).
Configuration Examples
- Block Topics
- PII Detection
- Content Filter
- Custom Regex
Priority Ordering
Guardrails are evaluated in ascending priority order. A guardrail with priority1 runs before priority 10. If a block action triggers, evaluation stops immediately and the request is rejected.
Use low priority numbers for your most critical rules (like PII blocking) and higher numbers for informational logging rules.
How It Works
When a request arrives at the Raven proxy:- All enabled guardrails for the organization are loaded, sorted by priority.
- Message content is extracted from the request body.
- Each guardrail evaluates the content against its configured rules.
- On a block match, a
GuardrailErroris thrown and the provider never receives the request. - On a warn match, the warning is recorded and the request continues.
- On a log match, the match is silently recorded.
Because blocked requests never reach the provider, guardrails save you tokens and cost in addition to providing safety.