- AI Gateway
- 1.2.0
- Guardrails
Guardrails catalogue¶
The gateway ships the guardrails below. Each one validates, filters, or transforms content in the request or response pipeline, and you attach it to an LlmProvider, an LlmProxy, or an Mcp proxy. For what guardrails do as a class, and how a chain of them executes, see Guardrails.
Available guardrails¶
Guardrail policies are documented in the Policy Hub, the versioned reference for every API Platform policy. For policy categories and how policies chain, see the Policy Hub overview.
| Guardrail | What it checks |
|---|---|
| Regex Guardrail | Validates content against a regular expression |
| JSON Schema Guardrail | Enforces a JSON Schema on request or response payloads |
| Word Count Guardrail | Enforces word-count limits on payloads |
| Sentence Count Guardrail | Enforces sentence-count limits on payloads |
| Content Length Guardrail | Enforces byte-length limits on payloads |
| URL Guardrail | Validates URLs found in request or response bodies |
| PII Masking | Masks or redacts PII from request/response bodies using configurable regex patterns |
| Semantic Prompt Guard | Blocks or allows prompts based on semantic similarity to configured allow/deny phrases |
| Azure Content Safety | Screens content against Azure Content Safety API |
| AWS Bedrock Guardrail | Validates content against AWS Bedrock Guardrails |
| Granite Guardian Prompt Injection | Detects prompt injection and jailbreak attempts in LLM API requests using IBM Granite Guardian 3.3 8B |
| NeMo Guard Content Safety | Validates request and/or response content using NVIDIA NeMo Guard (llama-3.1-nemoguard-8b-content-safety) |
Add or update guardrails¶
A guardrail is a gateway policy, so you add or update one by editing the gateway's build.yaml and rebuilding the image with the ap CLI. See Add or Update Policies in a Gateway.
Custom guardrails¶
To write your own guardrail policy in Go and build it into the gateway image, see Writing a Custom Policy.
Related topics¶
- Guardrail execution order — the order a chain of these policies runs in, and how the proxy and provider chains combine.
- Prompt management — the policies that reshape a prompt rather than judging it.
- MCP governance — the policies that govern MCP traffic, including semantic tool filtering.