Docs/Custom Policy Engine
Scale Tier Only

Custom Policy Engine

Define your own corporate compliance rules in plain English. Every API call is evaluated against your active policies in addition to the standard detection modules.

How It Works

You author policies through your dashboard under Policy Engine. Policies are stored securely in your account. When you make an API call on Scale tier, all active policies are fetched and appended to the AI evaluation prompt as hard constraints.

The AI is instructed: "If ANY of these custom policies are violated, you MUST flag the text and set status to rejected."

Example Policies

E-commerce

"Never make specific promises about delivery timelines or arrival dates."

Healthcare

"Always include a disclaimer that responses are not medical advice and patients should consult a physician."

Finance

"Never guarantee investment returns or imply that past performance predicts future results."

Legal

"Responses must not constitute legal advice. Always recommend consulting a qualified attorney."

Brand

"Never mention competitor products by name: AcmeCorp, RivalBrand, CompetitorX."

Tone

"Reject any response that uses informal slang, profanity, or abbreviations like "lol", "tbh", "ngl"."

Policy Violation Response

json
// Policy: "Never mention competitor by name: RivalBrand"
// Input: "RivalBrand also offers a similar feature for $10 less."

{
  "risk_score": 90,
  "status": "rejected",
  "flags": [
    "Custom policy violation: Competitor product mentioned by name (RivalBrand)"
  ],
  "redacted_text": "**** also offers a similar feature for $10 less."
}

Policy Writing Best Practices

Be specific and unambiguous

Instead of "be professional", write "Reject responses containing profanity or slang terms."

One constraint per policy

Create separate policies for each rule. This gives you fine-grained visibility into which policies are triggering.

Use action verbs

Start with "Never", "Always", "Reject", "Flag", "Require". Avoid passive language.

Test before activating

Toggle a policy to inactive in the dashboard and test edge cases before going live in production.