OpenCloud
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

Steps

  1. Deploy AI GuardRails
    Go to your project > Addons section and deploy the AI GuardRails addon. Wait for it to become active.
  2. Get the GuardRails endpoint
    From the AI GuardRails addon details, copy the endpoint URL. It will look like:
    http://guardrails-<project-id>:4000
    
  3. Route OpenClaw through GuardRails
    Go to your OpenClaw application > Environment Variables and update:
    VariableValue
    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.
  1. 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
  1. Restart OpenClaw

Save your environment variables and restart the application.

Test the Guardrails

  1. Send a message to OpenClaw containing test PII (e.g., a fake phone number)
  2. Check the GuardRails dashboard to see if it was detected and handled
  3. 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.
Copyright © 2026