Setting Up Guardrails

Setting Up Guardrails

Learn how to create and configure guardrails to protect your AI applications.

Quick Start

Via Dashboard

  • GuardrailsCreate Guardrail
  • Select rule type (e.g., “Block PII”)
  • Configure parameters
  • Set severity
  • Test with sample input
  • Click Save

Via API

$curl -X POST https://api.governanceai.com/v1/guardrails \
> -H "Authorization: Bearer $API_KEY" \
> -d '{
> "name": "Block Toxic Content",
> "rule_type": "block_toxic_content",
> "severity": "high",
> "config": {
> "toxicity_threshold": 0.8,
> "action": "block"
> }
> }'

Common Guardrail Types

  • block_pii - Block personally identifiable information
  • block_toxic_content - Block abusive language
  • rate_limit - Limit requests per user
  • enforce_classification - Require data tags
  • jailbreak_detection - Detect jailbreak attempts
  • agent_tool_control - Control agent tool access

Testing Guardrails

Test before deploying:

$curl -X POST https://api.governanceai.com/v1/guardrails/test \
> -H "Authorization: Bearer $API_KEY" \
> -d '{
> "guardrail_id": "guardrail_123",
> "test_input": "My credit card is 4532-1111-2222-3333",
> "context": {"user_id": "user_test"}
> }'
$
$# Response:
${
> "decision": "block",
> "reason": "PII detected: credit card number",
> "matched_rules": ["credit_card_regex"]
>}

Best Practices

  • Test thoroughly before production
  • Start with broad rules, then refine
  • Monitor violation rates
  • Adjust thresholds based on feedback
  • Document rule purposes

Next Steps