Skip to main content
Feature available with the Enterprise Plan Guardrail Rules define conditions under which evaluators are applied to requests passing through the AI Gateway. A guardrail is only triggered when its rule conditions are matched, not on every request.

Use cases

Guardrail rules are most useful when the same safety or compliance check needs to apply consistently across many requests.
Runs a jailbreak detection Evaluator on all customer-facing requests at the router level, adding an extra security layer across AI Gateway traffic.
Enforces GDPR compliance by running PII detection on all matching requests workspace-wide from a single rule.
Validates customer detail access for the sales team by calling an external Evaluator on every matching request before it reaches the model.
Applies a tone of voice Evaluator at the router level so every response is checked against the company’s tone guidelines.
Runs a compliance Evaluator on EU-routed requests only, scoped using the Rule Builder so the guardrail applies exactly where it is needed without affecting other traffic.
Runs jailbreak detection and response relevance Evaluators at 50% sample rate each, scoped to specific traffic using a metadata condition in the Rule Builder.

Visibility

  • Global rules: visible to workspace administrators only.
  • Project rules: visible to all members of the scoped project.

Creating a guardrail rule

From the Guardrail Rules list, click Add New Rule. A panel opens on the right with the following fields.
Create Guardrail Rule

Create Guardrail Rule panel in the AI Gateway.

General

Evaluators

Select the Evaluators to run when this rule is triggered. Click Add to attach one or more evaluators from the scoped project.

Execution settings

Rule Builder

The Rule Builder constructs the match conditions that determine when the guardrail is triggered. Clicking Add opens a dropdown with the following condition types: You can also click Add group to nest conditions into a logical group. Multiple conditions within a group are joined with and. Groups themselves can be joined with either and or or. Select the operator between groups to control how they combine. Each condition can be removed with . The builder generates a CEL (Common Expression Language) expression shown read-only in the CEL Expression Preview below. The guardrail is only triggered when the expression evaluates to true.