> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.governanceaicore.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.governanceaicore.com/_mcp/server.

# Setting Up Guardrails

> Create and configure guardrails for AI governance

# Setting Up Guardrails

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

## Quick Start

### Via Dashboard

* **Guardrails** → **Create Guardrail**
* Select rule type (e.g., "Block PII")
* Configure parameters
* Set severity
* Test with sample input
* Click **Save**

### Via API

```bash
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:

```bash
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

* **[Creating Policies](/usage-guides/policies)** - Bundle guardrails into policies
* **[Running Scans](/usage-guides/scans)** - Scan your repositories
* **[API Reference](/api)** - Guardrail APIs