Create a guardrail rule Preview

Create a guardrail rule from a template or from blank, set its check and action, test it and bind it to an agent.

After reading this page you will be able to:
  • Create a guardrail rule from the PII protection template
  • Test it against sample sentences
  • Bind it to an agent in monitor mode and then enforce it
Preview

This page creates a guardrail rule, one check applied by agent (PUT /api/guardrails/{name}). To bundle several checks for an LLM provider or agent, create a guardrail profile instead: open Guardrail profiles (the Profiles tab) and choose Create guardrail profile.

Prerequisites

  • The admin or owner role.
  • An agent to protect. The built-in Liya agent works.

Steps

  1. Open Guardrail rules and choose + Create guardrail rule.
  2. Pick a template ("Start from a working policy, or begin blank."). For this guide choose PII protection.
  3. Name it, for example pii-standard, and set how and where it runs.
    FieldValue for this guide
    RolloutMonitor first (recommended)
    DirectionBoth
    AgentsBlank for all agents, or name one
  4. Review the policy the template set: Redact PII with Mask, in both directions, for the default identifier types (email, phone, card numbers, IBANs, national IDs and tokens). Under Entities you can narrow the types, and choose an action per type if you need to:
    TypeSuggested action
    EmailMask, or Tokenise to keep replies personal
    PhoneMask
    Card numberBlock
    National IDBlock
  5. Choose Create guardrail rule.
  6. For an identifier of your own, for example an employee number EMP-\d{6}, create a second rule of kind Custom patterns with action Mask.
  7. Test it: in the Dry run panel on Guardrail rules, enter Reset the laptop for jane.doe@example.com, badge EMP-104233 and choose Run against enabled policies. The result shows what each policy, including those in monitor mode, would do and the text after it. See Test a guardrail.
  8. To hold one agent to it, choose + Bind an agent under Per-agent bindings, tick the rule and choose Create binding. Left with no agents named, it already covers every agent.
  9. Send a few real messages. In monitor mode its matches are listed for review. Mark each False positive or Correct.
  10. When the matches look right, choose Enforce now on its row.
Warning

Output-side masking changes what users see. Check that answers still read well, especially for templates that mask names.

With the API

curl -X PUT https://<host>/api/guardrails/pii-standard \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d @pii-standard.json

Next steps