Enforcement modes
When a guardrail matches, it can take one of two actions:- Block: The gateway immediately halts the request and returns a
400 Bad Requestto your application. The upstream provider is never called, saving you money and tokens. - Log Only: The request proceeds normally, but the guardrail match is flagged in your Request Logs. This is useful for testing a new rule before enforcing it.
Scopes
A guardrail can be applied to:- Input: Evaluates the prompt sent to the LLM.
- Output: Evaluates the response coming from the LLM.
- Both: Evaluates both the prompt and the response.
Built-in guardrail types
Keyword Blocklist
Blocks requests/responses containing any word from a configurable list (case sensitive or insensitive).
Regex Match
Matches content against a custom regular expression pattern.
Substring Match
Blocks if the text contains a specific exact substring.
Length Constraints
Enforces a minimum and maximum word count or character count.
Configuring guardrails
1
Open Guardrails
In your workspace, go to the Guardrails page and click New Guardrail.
2
Set the rule
Give it a name, select the type (e.g.
word_count), and configure the settings (e.g. max: 500).3
Set enforcement
Choose whether the rule should apply to
Input, Output, or Both, and select Block or Log Only.