This guide builds on the deployment step and adds an AIGatewayPolicy resource to the running AI Gateway deployment. AI Policies run inside the data plane and enforce guardrails, content filters, and governance rules on every LLM request without any changes to your application.
By the end of this guide, you will have a single AI Prompt Guard policy that:
- Blocks prompt injection and jailbreak attempts using deny patterns
- Restricts the gateway to a defined set of engineering topics using allow patterns
The AI Prompt Guard Policy evaluates deny patterns first. If the prompt matches a deny pattern, the request is rejected immediately. If no deny pattern matches, the prompt must then match at least one allow pattern to proceed. This means both rules must be in the same AI Policy to work together correctly.