OpenClaw
Connect OpenClaw to AI GuardRails
Add security middleware between OpenClaw and your LLM providers for PII protection, prompt injection detection, and content moderation.
Connect OpenClaw to AI GuardRails
Overview
AI GuardRails adds security middleware between OpenClaw and your LLM providers. It provides PII protection, prompt injection detection, secret detection, and content moderation — ensuring your AI agent operates safely.
Prerequisites
- OpenClaw deployed and running (see Installation)
- AI GuardRails addon deployed (see AI Security)
Steps
- Deploy AI GuardRails
Go to your project > Addons section and deploy the AI GuardRails addon. Wait for it to become active. - Get the GuardRails endpoint
From the AI GuardRails addon details, copy the endpoint URL. It will look like:http://guardrails-<project-id>:4000 - Route OpenClaw through GuardRails
Go to your OpenClaw application > Environment Variables and update:Variable Value OPENAI_API_BASEYour GuardRails endpoint URL OPENAI_API_KEYYour GuardRails API key
If you're also using 9Router, chain them: OpenClaw → GuardRails → 9Router → LLM providers.
- Configure guardrail policies
Open the AI GuardRails dashboard and configure:
- PII Detection — Automatically redact personal information
- Prompt Injection Detection — Block malicious prompts
- Secret Detection — Prevent API keys from leaking in responses
- Content Moderation — Filter inappropriate content
- Restart OpenClaw
Save your environment variables and restart the application.
Test the Guardrails
- Send a message to OpenClaw containing test PII (e.g., a fake phone number)
- Check the GuardRails dashboard to see if it was detected and handled
- Verify that responses are properly filtered
Benefits
- PII Protection — Automatically detect and redact personal data
- Prompt Safety — Block injection attacks before they reach the LLM
- Audit Trail — Log all guardrail actions for compliance
- Configurable Policies — Fine-tune what gets blocked vs. allowed
For a full guide on AI GuardRails configuration, see AI Security.