> For the complete documentation index, see [llms.txt](https://docs.mozilla.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mozilla.ai/any-guardrail/api-reference/any_guardrail.md).

# AnyGuardrail

Factory class for creating guardrail instances.

## create

Create a guardrail instance.

**Parameters**

| Parameter        | Type                           | Required | Default | Description                                                        |
| ---------------- | ------------------------------ | -------- | ------- | ------------------------------------------------------------------ |
| `guardrail_name` | `GuardrailName`                | Yes      | —       | The name of the guardrail to use.                                  |
| `provider`       | `Optional[Provider[Any, Any]]` | No       | `None`  | Optional provider instance to use for model loading and inference. |

**Returns:** `Guardrail`

## metadata

Return the static taxonomy/capability metadata for a guardrail.

**Parameters**

| Parameter        | Type            | Required | Default | Description               |
| ---------------- | --------------- | -------- | ------- | ------------------------- |
| `guardrail_name` | `GuardrailName` | Yes      | —       | The guardrail to look up. |

**Returns:** `GuardrailMetadata`

## list\_guardrails

List guardrails whose metadata matches every supplied filter.

Filters combine with AND across dimensions. Set-valued dimensions (`category`, `stage`, `output_shape`) accept a single enum member or an iterable and match when the guardrail has **any** of the requested values. Scalar dimensions match by equality. A `None` filter is ignored. Runs entirely against the import-free registry — no backends are loaded.

**Parameters**

| Parameter          | Type                | Required                     | Default | Description |
| ------------------ | ------------------- | ---------------------------- | ------- | ----------- |
| `category`         | \`GuardrailCategory | Iterable\[GuardrailCategory] | None\`  | No          |
| `stage`            | \`GuardrailStage    | Iterable\[GuardrailStage]    | None\`  | No          |
| `output_shape`     | \`OutputShape       | Iterable\[OutputShape]       | None\`  | No          |
| `backend`          | \`BackendType       | None\`                       | No      | `None`      |
| `requires_api_key` | \`bool              | None\`                       | No      | `None`      |
| `multilingual`     | \`bool              | None\`                       | No      | `None`      |
| `multimodal`       | \`bool              | None\`                       | No      | `None`      |
| `vendor`           | \`str               | None\`                       | No      | `None`      |

**Returns:** `list[GuardrailName]`

## group\_by

Group guardrails by one metadata dimension.

**Parameters**

| Parameter   | Type  | Required | Default | Description                                                                                                                                               |
| ----------- | ----- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `dimension` | `str` | Yes      | —       | One of `"category"`, `"stage"`, `"output_shape"`, `"backend"`, or `"vendor"`. For set-valued dimensions a guardrail appears under every value it carries. |

**Returns:** `dict[str, list[GuardrailName]]`

## get\_supported\_guardrails

List all supported guardrails.

**Returns:** `list[GuardrailName]`

## get\_supported\_model

Get the model IDs supported by a specific guardrail.

**Parameters**

| Parameter        | Type            | Required | Default |
| ---------------- | --------------- | -------- | ------- |
| `guardrail_name` | `GuardrailName` | Yes      | —       |

**Returns:** `list[str]`

## get\_all\_supported\_models

Get all model IDs supported by all guardrails.

Guardrails whose optional extra isn't installed are skipped rather than raising, since this is a discovery API and the natural use is "what can I run here?" on a partial install. Every guardrail module that gates an optional SDK re-raises the failed import as `raise ImportError(msg) from e`, so only an `ImportError` with a chained cause is treated as a missing-extra signal; an uncaused `ImportError` (e.g. an unresolvable module path or class name) is a real bug and propagates.

**Returns:** `dict[str, list[str]]`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.mozilla.ai/any-guardrail/api-reference/any_guardrail.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
