Configure a policy
- Select All projects for an organization policy, or select a project for a project policy.
- Open Guardrails and create a policy with a name and description.
- Choose Prompt injection, Jailbreak attempts, Sensitive data, and/or Context bloat. You can start from a preset and review or edit its selected protections and rules.
- Set Attack detection sensitivity for attack patterns and Credential detection sensitivity independently for secrets. For sensitive data, choose Block or Redact per kind and edit the replacement marker when redacting. Context bloat has its own limits.
- Test representative samples using This draft only or This draft and effective policies, review the result, and save the policy.
Choose protections
For Company email, enter the protected domains; subdomains are included. Custom patterns use
RE2-compatible syntax with linear-time matching, without backreferences or lookaround. A policy accepts
up to 20 sensitive-data rules in total, including built-in and custom rules. Each custom pattern
has at most 200 characters; a replacement has 1–40 characters. Up to 50 protected email domains are
supported. Names have at most 80 characters and descriptions have at most 500.
Credential detection sensitivity is independent of attack sensitivity. Standard uses recognized
credential patterns; Strict additionally enables high-entropy secret detection, which may match
legitimate identifiers. Existing policies without a separate credential setting retain their earlier
sensitivity until you choose an explicit setting.
The additional identity and financial recognizers check formats and checksums locally. They do not
verify whether an identifier was issued, whether an account exists, or whether a credential works.
These checks do not load a named-entity model to recognize people or locations.
Context bloat
Enable Context bloat to inspect the combined inbound text before any redaction. The check covers the supported prompt fields across messages, instructions and incoming tool-result text. It does not inspect images or execute tools. Text fields are joined with blank-line separators for the check, so splitting padding across messages does not bypass the configured aggregate limit. The default maximum is 5,000 characters, not model tokens. The advanced defaults are a 50-character minimum for content checks, minimum entropy 3.5, maximum repeated n-gram ratio 0.4, n-gram size 3, and maximum repeated-character run ratio 0.1. Below the minimum, only the size cap applies. Tune these values against representative legitimate text as well as unwanted repetition; source code, structured data and long conversations can have different repetition patterns. Context bloat always blocks a detected violation. It never silently truncates instructions. The error identifies whether the aggregate size cap, low entropy, a long character run or repeated n-grams caused the block. Existing policies gain no context-bloat checks unless you enable this protection.Block or redact
Block rejects the request before an upstream connection is opened. The error identifies the policy and detector without echoing the matched text. The error message explains whether prompt injection, a jailbreak attempt, context bloat or a specific sensitive-data kind caused the block. OpenAI-compatible responses also include the policy ID, policy name, detector and rule inerror.details, plus check for context-bloat violations. A guardrails
service failure returns guardrails_unavailable (503), distinct from a policy block (400).
Redact replaces matches in the prompt fields sent upstream. The draft tester lets you inspect
the transformed model input before enabling the rule. Test both content that should match and
ordinary content that should pass, especially when using strict sensitivity or custom patterns.
Private key → Redact replaces the entire text field containing a detected key, including any
surrounding instructions, with the replacement marker. Use the draft tester to verify what the model
would receive.