> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orq.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Guardrail Rules | AI Router

> Configure guardrail rules in the AI Router to validate and control LLM requests and responses with evaluators triggered by CEL conditions.

<Badge color="blue" size="lg" shape="pill" stroke="true">Feature available with the [Enterprise Plan](https://orq.ai/solutions/enterprise)</Badge>

Guardrail Rules define conditions under which evaluators are applied to requests passing through the [**AI Router**](/docs/router/using-the-router). 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.

<AccordionGroup>
  <Accordion title="Add jailbreak protection to all customer-facing banking traffic" icon="shield">
    Runs a jailbreak detection [**Evaluator**](/docs/evaluators/overview) on all customer-facing requests at the router level, adding an extra security layer across **AI Router** traffic.
  </Accordion>

  <Accordion title="Enforce GDPR PII checks across the entire workspace" icon="lock">
    Enforces GDPR compliance by running PII detection on all matching requests workspace-wide from a single rule.
  </Accordion>

  <Accordion title="Validate customer detail access for the sales team" icon="users">
    Validates customer detail access for the sales team by calling an external [**Evaluator**](/docs/evaluators/overview) on every matching request before it reaches the model.
  </Accordion>

  <Accordion title="Monitor tone of voice across all company traffic" icon="waveform">
    Applies a tone of voice [**Evaluator**](/docs/evaluators/overview) at the router level so every response is checked against the company's tone guidelines.
  </Accordion>

  <Accordion title="Apply EU AI Act compliance checks to EU-routed requests" icon="scale-balanced">
    Runs a compliance [**Evaluator**](/docs/evaluators/overview) on EU-routed requests only, scoped using the Rule Builder so the guardrail applies exactly where it is needed without affecting other traffic.
  </Accordion>

  <Accordion title="Run safety and quality checks on targeted traffic using metadata" icon="robot">
    Runs jailbreak detection and response relevance [**Evaluators**](/docs/evaluators/overview) at 50% sample rate each, scoped to specific traffic using a metadata condition in the Rule Builder.
  </Accordion>
</AccordionGroup>

## 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 <Icon icon="circle-plus" /> **Add New Rule**. A panel opens on the right with the following fields.

<Frame caption="Create Guardrail Rule panel in the AI Router.">
  <img src="https://mintcdn.com/orqai/dycyWau_l9E63fTw/images/guardrail-rule-create.png?fit=max&auto=format&n=dycyWau_l9E63fTw&q=85&s=ab8de239478b0add2f9c33961145aa77" alt="Create Guardrail Rule" width="1525" height="1217" data-path="images/guardrail-rule-create.png" />
</Frame>

### General

| Field           | Description                                                                                                   |
| --------------- | ------------------------------------------------------------------------------------------------------------- |
| **Rule Name**   | A display name for the guardrail rule.                                                                        |
| **Description** | Optional context for administrators.                                                                          |
| **Enable Rule** | Toggle to activate or deactivate the rule. When enabled, the rule is active and applied to matching requests. |

### Evaluators

Select the [**Evaluators**](/docs/evaluators/overview) to run when this rule is triggered. Click <Icon icon="circle-plus" /> **Add** to attach one or more evaluators from the scoped project.

### Execution settings

| Field       | Description                                                                                                         |
| ----------- | ------------------------------------------------------------------------------------------------------------------- |
| **Timeout** | Maximum time in seconds allowed for the guardrail to complete. If the timeout is reached, the guardrail is skipped. |

### Rule Builder

The Rule Builder constructs the match conditions that determine when the guardrail is triggered. Clicking <Icon icon="circle-plus" /> **Add** opens a dropdown with the following condition types:

| Condition    | Description                                |
| ------------ | ------------------------------------------ |
| **Header**   | Match on a request header name and value.  |
| **Model**    | Match on the model being called.           |
| **Identity** | Match on the identity making the request.  |
| **Metadata** | Match on metadata attached to the request. |
| **Project**  | Match on the project scope of the request. |

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 <Icon icon="xmark" />.

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.
