Skip to content

Guards

Guards are protective rules that inspect requests and responses flowing through the gateway. They can detect sensitive data, block harmful content, and enforce usage limits before requests reach providers or before responses reach clients.

Guard List

The Guards page displays all configured guards as cards. Each card shows the guard’s name, description, type, enforcement level, and whether it is applied to input, output, or both. A toggle switch lets you enable or disable each guard inline.

Creating a Guard

Click Create Guard to open the form:

FieldDescription
NameA descriptive name (e.g. “Block PII in prompts”)
DescriptionOptional notes about what this guard protects against
TypeThe detection or enforcement mechanism (see below)
LevelHow the gateway responds when the guard triggers
Applied ToWhether to inspect input, output, or both
EnabledToggle to activate the guard

Guard Types

TypeDescription
Content FilterDetects toxic, harmful, or inappropriate content using a configurable toxicity threshold
Rate LimitEnforces request rate limits beyond the global settings
Token LimitCaps the maximum token count per request
PII DetectionScans for personally identifiable information patterns
Prompt InjectionDetects attempts to manipulate model behavior through crafted prompts
CustomUser-defined guard logic

Enforcement Levels

LevelBehavior
BlockRejects the request or suppresses the response with a 4xx error
WarnAllows the request to proceed but logs a warning and may trigger alerts
LogRecords the detection in audit logs without affecting the request

Type-Specific Configuration

Content Filter

When the type is set to content-filter, a Toxicity Threshold slider appears. The threshold ranges from 0 (most permissive) to 1 (most strict), with a default of 0.70. Content scoring above the threshold triggers the guard.

PII Detection

When the type is set to pii-detection, a checklist of PII Patterns appears. Select which patterns to detect:

  • email — Email addresses
  • phone — Phone numbers
  • ssn — Social security numbers
  • credit-card — Credit card numbers
  • address — Physical addresses
  • name — Personal names
  • ip-address — IP addresses

You can enable any combination of patterns per guard. Create multiple PII guards with different levels if you want to block some patterns and only warn on others.

Applied To: Input vs Output

TargetWhat is inspected
InputThe user’s prompt and any attached content before it reaches the provider
OutputThe provider’s response before it is returned to the client
BothBoth directions are inspected

Applying guards to output is useful for catching provider responses that contain sensitive data or inappropriate content, even when the input was clean.

Editing and Deleting Guards

  • Click Edit to modify a guard’s configuration.
  • Use the inline toggle switch to enable or disable a guard without opening the editor.
  • Click Delete to permanently remove a guard. A confirmation dialog warns that the protection it provides will be removed.

Best Practices

  • Start guards in Log mode to understand detection patterns before switching to Block.
  • Apply PII detection to both input and output to prevent data leakage in either direction.
  • Use content filters on output to catch unexpected provider responses.
  • Layer multiple guards — for example, a warn-level PII guard and a block-level prompt injection guard can run simultaneously.