An open source, general-purpose policy engine that unifies policy enforcement across the stack
open sourceApache-2.0self-hostablefree
Open Policy Agent (OPA) is an Apache-2.0 policy engine, a graduated CNCF project, that takes policy decisions out of your code. You write rules in Rego, its declarative language; your service sends OPA structured input (a request, a Kubernetes manifest, a Terraform plan, an AI agent's tool call) and OPA answers with a decision, from a yes or no to any JSON. It runs as a sidecar or daemon with a REST API, embeds in Go programs through its SDK, or compiles policies to WebAssembly, and integrates with Envoy and Istio, Kubernetes (through Gatekeeper), API gateways, CI/CD, Kafka, SSH and sudo. Bundle, status and decision log APIs and the OPA Control Plane distribute policies and keep an audit trail of every decision.
Ways to install
Package managers
Problems it solves
- authorization rules are hard-coded in every microservice and nobody can see them all in one place
- ask a central policy engine whether user X can call operation Y on resource Z
- write access control rules as code, test them and review them in pull requests
- allow or deny HTTP API requests at the Envoy or Istio sidecar before they reach the service
- stop Kubernetes deployments that pull images from unapproved registries
- check a Terraform plan against our security rules before it is applied
- decide which tool calls our AI agent may run and which parameters are safe before the harness executes them
- a record of every authorization decision for audits and to replay it when debugging
- fine-grained authorization for Kafka topics, GraphQL APIs and SSH logins with one policy language
- security team owns shared rules while each product team extends them
- evaluate policies inside a browser or edge function without calling a server
- filter database queries down to the rows a user is allowed to see
- distribute policy updates to hundreds of services from Git
Features
- Rego, a declarative policy language for hierarchical JSON data
- decisions as any structured JSON, not just allow or deny
- REST API for running OPA as a sidecar or host-level daemon
- Go SDK and Go API for embedding
- compile policies to WebAssembly for any Wasm runtime
- SDKs for TypeScript, Java and C#
- Envoy External Authorization integration
- Kubernetes admission control through OPA Gatekeeper
- policy testing and the opa CLI (eval, run, test, build)
- bundle API for distributing policies and data
View 5 more
- decision logs and status API
- OPA Control Plane: Git-based policy management and bundle serving
- data filtering for partial evaluation
- Rego Playground and VS Code extension
- guides for agent tool calling, Terraform, CI/CD, Kafka, GraphQL, Docker, SSH and sudo
Limitations
- Doesn't enforce decisions itself: OPA returns allow or deny, and your service, proxy or agent harness accepts or rejects the request34
Capabilities
| Has an API | plan not known |
|---|---|
| Has a command line tool | plan not known |
| Has official SDKs | plan not known |
Alternatives
The same job
These do what Open Policy Agent does.
- Oso Cloud A centralized authorization service built on Polar
- Ory Keto Open source authorization server based on Google Zanzibar, for RBAC and ReBAC
- OpenFGA Fine-grained authorization
- Apache Casbin An authorization library that supports access control models like ACL, RBAC, ABAC
- Kyverno Unified Policy as Code
- Cerbos Authorize every identity. Govern every action.
