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.
- Create an API key on the collector.
- Configure AI Proxy (or AI Proxy Advanced) on the route.
- Add
ai-custom-guardrailpointing at evaluate. Put KongX-Consumer-IDinconsumer_idand a conversation id insession_id. - Block when
status == "block".
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.