Skip to content
GOPAL: the Rego policy library for AI compliance

English | 简体中文 | 日本語 | 한국어 | हिन्दी

AI compliance rules you can read, run, diff, and prove.

EU AI Act · UK AI framework · NIST AI RMF · aviation · financial services · education · healthcare · legal practice

OPA CI Compliance gate demo Stars Latest release OPA 1.20.1 Regal DOI Apache 2.0 Mentioned in Awesome OPA PRs Welcome


GOPAL: Governance Open Policy Agent Library. An open policy pack for AI regulation.

92 policies that translate published regulation into industry-standard policy-as-code, written in Rego for OPA. Each one takes a named instrument, encodes its obligations as executable rules, cites the article or control it enforces, ships with tests, and appears in a coverage matrix that states what is implemented and what is not. The EU AI Act, NIST AI RMF, aviation safety standards, FERPA and COPPA in education, fair-lending rules in banking, and more.

Run them against two kinds of input: facts you declare about the system and the organisation around it, and metrics an evaluator measures. You get back a structured, machine-readable verdict you can drop into CI, an audit log, or a regulator submission.

The problem

AI systems in active development change on the order of days through model updates, prompt edits, or index rebuilds. A signed compliance document records an assessment at a point in time; it does not automatically reflect subsequent system changes. Without re-evaluation, the documented state can diverge from the system being operated. A vendor score does not solve the same problem when the policy logic behind it cannot be inspected, contested, or traced to the source provision.

A signed document records a point-in-time assessment. An executable rule can be re-evaluated whenever the governed system changes.

GOPAL expresses those obligations as versioned Rego rules held in git. Each rule cites the article or control it enforces, has tests beside it, and returns a verdict that can be decomposed. The same rules run on a laptop, in a browser, or in CI. When GOPAL is configured as a required status check, a failing evaluation blocks the merge.

A terminal session. The production model scores 0.0056 against a 0.1 threshold and passes. After swapping the model, the aggregate is 0.1373, global.v1.toxicity.allow fails, and the output responsible is listed at 0.8106.

The example compares checked-in baseline and candidate toxicity metrics while the prompts, scoring method, and policy remain fixed. The candidate metrics cause the unchanged rule to fail, which blocks the merge and identifies the responsible output. This example runs in CI on every push and verifies both the passing and failing paths.

 

Policy as code does not make every compliance determination automatic. In GOPAL's current EU AI Act implementation, the 29 policies contain 185 input-field reads: 170 declarations and 15 measurements. Declarations cover facts such as whether a conformity assessment was completed or whether a person can halt the system. Measurements cover values produced by evaluators.

Manually supplying a value is still an assertion unless the value is backed by the evaluator evidence that produced it. GOPAL makes both kinds of input explicit and versionable. When GOPAL is wired into CI, the selected policy set is re-evaluated on every change covered by that workflow, including updated declarations and measurements. The validation preview shows both input types against your own system, in your browser, without sending us anything.

GOPAL coverage: 92 policies across international standards, aviation, industry verticals, and cross-cutting principles

Tell us where this is wrong. A policy library is only worth trusting if the people using it can argue with it, and the useful arguments are specific: a verdict you think is incorrect, a provision we mapped badly, a regulation we do not cover, an evaluation tool that should have an adapter. The model-card analysis was corrected once already in response to exactly that kind of report.

Request a framework · Request a policy · Report a wrong verdict · Start a discussion

Every policy is a file with a test beside it, so an extension is a pull request rather than a project. CONTRIBUTING.md is short.

Jump to: Run it now · What's covered · Already using OPA · Supply your own metrics · Write a policy · How it compares · Contribute


AI compliance rules you can read, run, diff, and prove

GOPAL turns regulatory and governance requirements (the EU AI Act, NIST AI RMF, aviation safety standards, FERPA/COPPA, fair lending, healthcare safety) into executable OPA policies.

Use GOPAL when you want AI governance checks that are:

  • Readable. Every rule is Rego, not a black-box score.
  • Reviewable. Policy changes go through pull requests.
  • Testable. Every policy can have allow/deny test cases.
  • Versioned. Frameworks evolve without breaking pinned users.
  • Automatable. Run checks in CI/CD, audit workflows, or AICertify.

Why now

The EU AI Act is in force. The NIST AI RMF is the de facto US baseline. The UK, India, Brazil, Singapore, and California are all moving. Aviation regulators are publishing AI/UAS guidance. Financial supervisors are issuing model-risk requirements.

Engineering teams need AI governance checks that run in CI. Neither a PDF on a shared drive nor a screenshot pasted into a review-board deck can be run against the system as it currently stands.

GOPAL ships executable Rego policies for each of those regimes. They are versioned, testable, and reviewable in pull requests. The same tooling your platform team already uses for Kubernetes admission control can now enforce AI-system requirements.


Quick Start

How GOPAL evaluation works: input JSON, Rego policy, OPA evaluation, verdict

Try GOPAL in 30 seconds

git clone https://github.com/Principled-Evolution/gopal.git
cd gopal/examples/eu-ai-act-transparency
./run.sh

You'll see a structured EU AI Act transparency verdict against a sample AI system. See examples/ for NIST AI RMF, customer-support LLM, and more.

Standalone with the OPA CLI

# Get OPA
curl -L -o opa https://openpolicyagent.org/downloads/latest/opa_linux_amd64 && chmod +x opa

# Clone gopal
git clone https://github.com/Principled-Evolution/gopal.git && cd gopal

# Evaluate your input against the EU AI Act
./opa eval -d international/eu_ai_act/v1 \
  --input my_ai_system.json \
  "data.international.eu_ai_act.v1.transparency.allow"

As the policy engine for AICertify

from aicertify import regulations, application

regs = regulations.create("eu_compliance")
regs.add("eu_ai_act")  # gopal policies under the hood

app = application.create(name="my-llm-app", ...)
await app.evaluate(regulations=regs, report_format="pdf")

See AICertify for the full Python framework.


Why GOPAL

Generic policy-as-code gives you the execution engine, but not an AI-regulatory policy library. Governance platforms can add inventory, workflow, and evidence management; where their decision logic is proprietary, that logic cannot be independently diffed or reproduced. GOPAL fills a different gap: open, executable AI-governance policy that runs in standard OPA tooling.

Where GOPAL differs:

  1. AI-specific policy content. Policies target named AI regulations, standards, and sector requirements covering concerns such as bias, transparency, human oversight, model risk, content safety, and safety-critical certification.
  2. Inspectable by default. The rules are Rego, source provisions are cited, and verdicts expose their constituent checks rather than only an aggregate score.
  3. Portable. There is no proprietary policy DSL or hosted runtime requirement. Evaluate with opa eval, Conftest, an existing OPA server, or AICertify.
  4. Versioned and testable. Frameworks live under stable versioned paths (v1/, then v2/, etc.) with explicit semver guarantees (see COMPATIBILITY.md), and policy changes are exercised by tests in CI.

The policy semantics remain open and independently reproducible even when GOPAL is used inside a larger governance workflow.


For OPA / Rego users

If you already run OPA for Kubernetes admission, cloud authorization, CI/CD, or service mesh, GOPAL gives you a policy library targeted at AI systems instead of infrastructure.

The packages, conventions, and test patterns are idiomatic Rego. There is no DSL on top, and you don't need Python to evaluate. You can:

  • download a prebuilt bundle for one framework, rather than vendoring the whole tree
  • evaluate with opa eval, Conftest, or your existing OPA server
  • pin to a major version (v1/) and review upgrades as PRs
  • compose GOPAL rules with your private custom/ rules in the same evaluation
  • lint with Regal, the same linter GOPAL runs in CI

Per-framework bundles

Every release ships one OPA bundle per framework, so you can take the 29 EU AI Act policies without the aviation or FERPA ones. Each bundle is self-contained: it carries the shared libraries its policies import, so it evaluates with no other GOPAL files present.

gh release download v2.0.0 --pattern 'gopal-international-eu_ai_act-*.tar.gz'

opa eval -b gopal-international-eu_ai_act-2.0.0.tar.gz \
  --input model_card.json \
  'data.international.eu_ai_act.v1.transparency.allow'

The EU AI Act bundle is 24K against 56K for the whole library, and there is a gopal-all-<version>.tar.gz if you do want everything. Because the per-framework bundles each include the shared libraries, their roots overlap and OPA will not load two of them side by side; use the full bundle when you need more than one framework. Every release also carries a checksums.txt.

Build them yourself with scripts/build-bundles.sh, which loads each bundle back and asserts a real decision denies on empty input before declaring success.

Supplying measured metrics

Policies read two kinds of input: declared facts and measured metrics. A declaration records what an accountable person or source asserts. A measured metric should carry provenance from the evaluator that produced it; typing the same number into JSON does not establish that the measurement occurred. Plug your evaluator into GOPAL walks the integration end to end in plain opa: find what a policy reads, use the canonical name from helper_functions/metrics.rego, write the JSON, and gate a build on the result. No Python and no framework are required.

Automation in practice

With the prompts, scoring method, and policy held constant, the checked-in candidate metrics cause the existing rule to fail and block the merge:

Two runs of check.sh: the production model passes at 0.0056, the swapped model fails at 0.1373 with the offending output named

examples/model-switch contains the complete deterministic example, and the Compliance gate demo badge above runs it on every push. The workflow verifies both the passing baseline and failing candidate so that the CI path exercises both outcomes.

Five policies in the current library can be evaluated entirely from measured metrics: toxicity, Article 11 technical documentation, fair lending, diagnostic safety, and fairness. These are the starting points for automated CI enforcement. Most EU AI Act obligations rest on declared facts instead: 170 of the 185 input-field reads across the 29 policies are declarations, including whether a conformity assessment was completed. The example names each metric-based policy and what supplies it.

If you want a Python framework that handles input capture and PDF/Markdown report generation on top, see AICertify. It supplies that scaffolding; it is not required in order to use these policies.


What's Inside

GOPAL directory layout: 4 top-level branches, policies organized by jurisdiction and vertical

gopal/
├── international/        Frameworks crossing borders
│   ├── eu_ai_act/v1/         29 policies — EU AI Act 2024/1689
│   ├── nist/v1/              5  policies — NIST AI RMF + AI 600-1
│   ├── india/v1/             1  policy   — Digital India Policy
│   ├── brazil/v1/            1  policy   — AI Governance Bill
│   ├── uk/v1/                6  policies — pro-innovation principles, UK GDPR Arts 22A-22D
│   ├── icao/v1/              1  policy   — ICAO Doc 10019
│   ├── faa/v1/               2  policies — Part 107, Remote ID
│   ├── easa/v1/              2  policies — Regulation 2019/947, SORA
│   └── standards/v1/         2  policies — RTCA DO-365, ISO 21384
│
├── industry_specific/    Vertical-specific requirements
│   ├── education/v1/         12 policies — FERPA, COPPA, proctoring, grading
│   ├── aviation/v1/          12 policies — airworthiness, autonomy, data, ops
│   ├── healthcare/v1/         2 policies — patient & diagnostic safety
│   ├── bfs/v1/                4 policies — model risk, fair lending, PRA SS1/23, FCA Consumer Duty
│   ├── legal/v1/              3 policies — citation verification, privilege, supervision
│   └── automotive/v1/         1 policy   — vehicle safety integration
│
├── global/v1/             4  policies — accountability, fairness, transparency, toxicity
│   └── common/            5  libraries — shared fairness, content-safety, risk
│                                       and compliance helpers, imported by the
│                                       framework policies rather than run directly
│
├── operational/          DevOps & corporate
│   ├── aiops/v1/              1 policy   — scalability
│   ├── cost/v1/               1 policy   — resource efficiency
│   └── corporate/v1/          2 policies — InfoSec, governance
│
├── helper_functions/     Shared utilities for policy authors
│   ├── reporting.rego        Standardized report-output helpers
│   └── validation.rego       Field-presence and required-field checks
│
└── custom/               Your private policies (git-ignored, CI-skipped)

92 policies that reach a verdict, plus 7 shared libraries they import. 198 Rego files including tests. These figures are generated from the tree by scripts/generate-coverage.sh and checked in CI, so they cannot drift from the code. Run jq .totals docs/coverage/coverage.json for the current numbers.


Comparison

GOPAL Generic OPA bundle Vendor governance SaaS
Targets AI systems specifically
Open source (Apache 2.0)
You can read every rule ✅ Rego ✅ Rego ❌ Hidden
Tracks named regulations (EU AI Act, NIST RMF, FAA) ✅ 10+ Partial
Industry-specific verticals out of the box ✅ 6 Limited
Aviation / safety-critical coverage ✅ ICAO, RTCA, FAA, EASA, ISO
Education sector (FERPA / COPPA) Rare
Versioned policies (v1/, v2/ …) ✅ Semver Varies N/A
CI/CD integration opa check + Regal Varies
Custom local policies (not shared upstream) custom/ is git-ignored Paid tier

A few other open-source projects worth knowing about: VerifyWise and Compl-AI both evaluate AI systems against the EU AI Act and other frameworks. airblackbox scans agent frameworks like LangChain, CrewAI, and AutoGen for compliance gaps at runtime. GOPAL's difference is that it's plain Rego/OPA, so it slots into policy tooling you may already run for Kubernetes or cloud authorization, and it isn't limited to the EU AI Act. Aviation, education, and banking frameworks are in the same tree, all versioned and tested the same way.


GOPAL vs AICertify

Need Use
I want raw Rego policies GOPAL
I want to evaluate an AI app and generate reports AICertify
I want to plug policies into existing OPA tooling GOPAL
I want PDF/Markdown/JSON audit reports AICertify

AICertify uses GOPAL underneath. Pick GOPAL if you already have an OPA workflow you want to extend with AI-specific rules. Pick AICertify if you want a Python framework that captures AI-application interactions and produces audit-ready evidence end-to-end.


Authoring Policies

Anatomy of a GOPAL policy: package path, imports, metadata, default deny, allow rule, report

Every policy follows the same shape:

package international.eu_ai_act.v1.transparency

import data.helper_functions.reporting

# Metadata describes the rule for tooling and auditors.
# METADATA
# title: Transparency for general-purpose AI systems
# description: GPAI providers must publish technical documentation per Article 53.

default allow := false

allow if {
    input.system.technical_documentation_published == true
    input.system.training_data_summary_published == true
}

report := reporting.compose_report(
    "eu_ai_act.transparency",
    allow,
    [{"name": "documentation_present", "value": allow, "control_passed": allow}],
)

Then a sibling *_test.rego covers the rule. CI enforces:

  1. opa check for syntax and reference correctness across all packages
  2. regal lint for Rego style and best practices

The helper_functions/ library gives you compose_report(), validate_required_fields(), and field_exists() so reports come out in a uniform shape no matter who wrote the rule.

See docs/tutorials/add-your-first-policy.md for a walkthrough, and docs/coverage/ for per-framework coverage matrices.


Policy correctness

GOPAL is not legal advice. The policies here are executable interpretations of public regulatory and governance requirements, written by engineers who care about getting them right.

If you believe a rule misreads a regulation or misses an obligation, please open an issue with:

  • the regulation, section, or article in question
  • your interpretation
  • the input/output behavior you'd expect
  • any official guidance, regulator text, or precedent

Policy-correctness disagreements are not security vulnerabilities; see SECURITY.md for those. We want disagreements about interpretation in the open, where the community can review the rules and improve them.


Custom Policies

The custom/ directory is for your organization's proprietary policies. It's:

  • .gitignored, so nothing in it reaches this repo
  • Skipped by CI
  • Structured identically to the public tree (custom/your_org/v1/...)

Drop in your internal AI use-case rules without forking. They evaluate alongside the public set.


Development

# One-time setup
pip install pre-commit
curl -L -o opa https://openpolicyagent.org/downloads/latest/opa_linux_amd64 && chmod +x opa && sudo mv opa /usr/local/bin/
curl -L -o regal https://github.com/open-policy-agent/regal/releases/latest/download/regal_Linux_x86_64 && chmod +x regal && sudo mv regal /usr/local/bin/
pre-commit install

# Run the same checks CI runs
opa check --ignore custom/ .
regal lint --ignore-files custom/ .

See CONTRIBUTING.md for the PR workflow.


Roadmap

  • More NIST coverage: filling out the Measure and Manage controls
  • ICO statutory code of practice on AI and automated decision-making, expected 2026
  • EU GDPR, scoped to the AI-relevant articles: Article 22 and Recital 71, Article 35 DPIA triggers, Article 9, Articles 5(1)(c) and 5(1)(e), Articles 13 and 14, and Article 25. Deliberately not the whole regulation, because most of GDPR describes organisational practice that an input document cannot evidence. The UK counterpart to the Article 22 regime is already implemented and the two have now diverged, so the pair is worth having side by side
  • MAS / HKMA banking AI guidance for APAC financial supervision
  • Per-metric test coverage: every policy is now tested against empty input, but the stronger check is removing one required metric at a time. That is what surfaced the most recent fail-open

If a framework you need is not covered, ask for it. Making the request does not require writing any Rego.


Related Projects

  • AICertify: Python framework that uses GOPAL to evaluate AI applications and produce audit-ready PDF/MD/JSON reports.
  • Open Policy Agent: the policy engine.
  • Regal: the Rego linter we use in CI.

Community and support

We work upstream as well as here. OPA v1.20.1 exists to fix a number-comparison regression we found while running this library, reported and patched by us.

You don't need to know Rego, OPA, or GitHub conventions to get an answer here.

If you want to Use this
Ask how to integrate GOPAL into your CI, OPA server, or platform Integration help form or a Q&A discussion
Request a regulation or standard GOPAL doesn't cover yet New framework request
Request a specific policy inside a framework we already cover New policy request
Report a policy that returns the wrong verdict Bug report
Email us instead of using GitHub gopal@principledevolution.ai
Report a security vulnerability See SECURITY.md. Please don't open a public issue.

Two things answer most questions before you file anything. The coverage matrices list what's already implemented, article by article. The FAQ covers scope, input shapes, and how GOPAL relates to AICertify.

Contributions of any size are welcome; see CONTRIBUTING.md. Participation is governed by our Code of Conduct.

Listed in


How it fits together

A policy library evaluates supplied evidence about a system rather than the model itself. GOPAL separates that evidence into declared facts and measured metrics because they establish different things.

How a GOPAL policy gets its inputs: declared facts asserted by a person, and measured metrics produced by evaluators such as AICertify running DeepEval or LangFair, both feeding a Rego policy that returns satisfied, not satisfied, or no conclusion

Facts you declare record assertions such as whether the CE marking was affixed or whether logs are retained for six months. Metrics an evaluator measures record results such as toxicity, fairness disparity, and content safety. Typing a number into the input is still a declaration unless it is backed by the evaluator evidence that produced the measurement. A policy can read both.

GOPAL as a required status check: a pull request carries committed compliance facts, AICertify runs evaluators to add measured metrics, opa eval runs a pinned GOPAL bundle, and the status check passes with a retained report or fails naming the article and control

When GOPAL is configured as a required CI status check, a failing policy evaluation blocks the pull request in the same review workflow as other required checks. Sources for both diagrams are in docs/diagrams/src/, rendered with render-all.sh.

Cite this

If GOPAL informs a paper, a policy submission or a regulator response, please cite it. CITATION.cff is machine-readable, so GitHub's Cite this repository button will generate APA or BibTeX for you.

@software{gopal,
  author  = {Madan, Kapil and {Principled Evolution}},
  title   = {{GOPAL}: the {Rego} policy library for {AI} compliance},
  version = {2.0.0},
  year    = {2026},
  license = {Apache-2.0},
  doi     = {10.5281/zenodo.22142302},
  url     = {https://doi.org/10.5281/zenodo.22142302}
}

That DOI is the concept DOI: it always resolves to the newest release, so a citation using it does not go stale. To pin a reader to this exact version, cite 10.5281/zenodo.22142303 instead. Each release is archived by Zenodo, so the artefact survives independently of GitHub.

Cite the coverage matrices rather than the library as a whole if your claim is about a specific framework: they state per article what is implemented and what is not, which is the part that can be checked.

License

Apache License 2.0. See LICENSE.

Maintained by Principled Evolution · Compliance you can read, run, and prove.

About

Executable Rego policies for AI compliance, each traceable to a named article or control: EU AI Act, UK pro-innovation principles and UK GDPR Arts 22A-22D, NIST AI RMF, PRA SS1/23, FCA Consumer Duty, ICAO/FAA/EASA aviation, FERPA, SRA/BSB legal practice. Per-article coverage matrices state what is implemented and what is not.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

7 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages