Guards
Guards are optional fields on a policy rule that add an extra enforcement layer on top of the rule’s primary action. They run at request time — before the request is forwarded to the upstream server. Two kinds of guards are available:
Guards are evaluated after target matching and condition checking. If a token guard fires, the request is denied regardless of the rule’s
action. Content guards are evaluated for LLM requests only; see the interaction table below for how they interact with redact rule actions.
Token Guards
Token guards let you cap the size of LLM requests before they reach the upstream provider. They apply to rules whosetarget.kind is llm_model or llm_endpoint.
Source: packages/proxy/src/policy-engine.ts — checkTokenGuard, apps/api/src/lib/schemas/policies.ts.
Fields
When a token guard fires, the request is denied before it reaches the upstream provider with a structured error explaining which limit was exceeded.
Example
max_tokens exceeds 2 048.
maxInputTokens uses a character-count heuristic (chars / 4) at request time. It is not an exact token count. Use it to catch runaway prompts, not for precise billing.Content Guards
Content guards run Igris detectors on request content (and optionally on the upstream response) before forwarding. They can block or redact matched content. Source:packages/proxy/src/policy-engine.ts — checkContentGuard / redactRequestBody / inspectResponseContent, apps/api/src/lib/schemas/policies.ts.
Fields
Example: Redact PII before forwarding
[REDACTED:<detector-id>] in-place. The upstream call still proceeds with the redacted content. Note: when the rule action is redact, the content-guard deny-check is skipped by the evaluator — redaction is applied directly to the request body before forwarding.
Example: Deny if secrets detected in LLM prompt
Built-in packs
Custom detectors
Manage custom detectors via the API athttps://api.igrisecurity.com/api/v1/detectors/custom. Three kinds are supported: regex, keywords, and luhn. Reference a saved custom detector in any detectors array using the custom:<slug> prefix.
Combining Guards with Actions
Guards and actions interact as follows:Related
- Policies — how rules are structured, evaluated, and rate-limited
- Tool Calls — how MCP tool calls flow through the proxy
- Identity & Metadata — how user and metadata context reach the policy engine