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

# Guardrails

> How to configure content safety rules in the dashboard.

The **Guardrails** page lets you define rules that are automatically evaluated on every request or response passing through the gateway.

## Adding a Guardrail

1. Click **New Guardrail**.
2. Give it a **name** (e.g. `Block Competitor Mentions`).
3. Select the **type** from the dropdown.
4. Set the **scope**: `Input` (prompt), `Output` (response), or `Both`.
5. Set the **action**: `Block` or `Log Only`.
6. Configure the type-specific settings (see below).
7. Click **Save**.

## Guardrail Types

| Type                  | What it does                                   | Key settings                                   |
| :-------------------- | :--------------------------------------------- | :--------------------------------------------- |
| **Keyword Blocklist** | Blocks content containing any word from a list | `keywords` (list), `caseSensitive` (bool)      |
| **Regex**             | Matches against a regular expression           | `pattern` (string), `flags` (string, e.g. `i`) |
| **Word Count**        | Enforces prompt/response length in words       | `min`, `max`                                   |
| **Character Count**   | Enforces prompt/response length in characters  | `min`, `max`                                   |
| **Contains**          | Blocks content containing a specific substring | `substring` (string)                           |

## Ordering

Guardrails are evaluated in the order they appear on this page. Drag and drop to reorder them. The first guardrail that **blocks** a request stops evaluation of subsequent rules.

## Action: Block vs Log

* **Block** — The request is rejected immediately. The upstream provider is never called. Your application receives a structured error response.
* **Log Only** — The request proceeds, but the guardrail match is recorded in the Request Logs for review. Useful for monitoring before enforcing a rule.
