docs: add "AI Agent Policy Enforcement" use case guide
What is the underlying problem?
OPA's Use Cases section covers Kubernetes, Envoy, Kafka, Terraform, Docker, and HTTP APIs — but nothing for AI agent runtimes. As LLM-powered agents (LangChain, AutoGen, Google ADK, etc.) move into production, they make autonomous tool calls that cross compliance boundaries: data transfers, financial transactions, PII access, cross-border data movement. Developers building these agents need a policy decision point, and OPA is the natural fit, but there is no guide showing how.
The gap is increasingly visible. The 2025 OPA community survey showed growing adoption in application authorization contexts. AI agent frameworks are a natural next step — they need exactly the kind of fine-grained, context-aware, testable policy enforcement that OPA provides — but developers currently have to piece this together from the REST API docs and existing integration guides.
What would the guide cover?
- Why AI agents need a dedicated runtime policy layer (distinct from training-time safety or K8s admission control)
- OPA as the policy decision point (PDP) in the agent control loop:
BeforeToolCallback → OPA query → decision - Designing the agent policy input schema:
{action, params, output, context} - Returning structured decisions:
deny / escalate / audit / allowwith reasons the agent can act on - Writing a first agent policy (example: financial transaction limit enforcement)
- Testing with
opa test - Querying OPA via the REST API from a Python or Go agent
- Structuring multi-jurisdiction or multi-tenant policies as OPA bundles
Why I'm proposing this
I've been building OPA-based compliance policies for AI agent deployments covering African data protection regulations (NDPA 2023, Ghana DPA, Egypt PDPL, Kenya DPA, etc.) and regularly point developers to OPA as the right tool for agent governance. The project is listed in the awesome-opa list (PR #82) and I've just opened an ecosystem entry (PR #8850). A first-party guide in the Use Cases section would make this pattern discoverable for anyone building agentic systems — a fast-growing segment of the OPA user base.
I'm happy to write the full guide if the maintainers are open to this addition.
Source: open-policy-agent/opa