Skip to main content
Use Kong ai-custom-guardrail (needs AI Proxy) to send prompts and completions to evaluate.

Coverage

Ask — the plugin maps the verdict onto a boolean, so an ask gate is allowed and recorded. Write the rule as Block if you need a hard stop. Use it when Kong AI Proxy is already configured on the routes you protect. Not when you do not use AI Proxy — ai-custom-guardrail does not work on its own — or when you need masking in flight. Limits. Output coverage is documented over non-streaming completions; validate against a streaming completion before relying on it there. concatenate_all_content flattens the message array, so detectors that depend on role boundaries see a single blob. Full comparison: Coverage.
  1. Create an API key on the collector.
  2. Configure AI Proxy (or AI Proxy Advanced) on the route.
  3. Add ai-custom-guardrail pointing at evaluate. Put Kong X-Consumer-ID in consumer_id and a conversation id in session_id.
  4. Block when status == "block".
For output inspection, use direction: output on the response pass (or guarding_mode: BOTH if your Kong version maps both). Transform that rewrites bodies needs more than block / block_message.