Open-source compliance engine for AI agents. Rules, SDKs, and examples.
git clone https://github.com/ComplyEdge/complyedge && cp complyedge/*.md ~/.claude/agents/Subagents overview
# ComplyEdge
[](https://pypi.org/project/complyedge/)
[](LICENSE)
Runtime compliance enforcement for AI agents. Not a scanner — runs in production, on every request.
**Article 5 is already law.** GPAI obligations carry fines from 2 August 2026. Your AI is either compliant right now, or it isn't.
> What does your compliance tool tell a regulator when it blocks a request? A probability score?
>
> ComplyEdge says: **Article 5(1)(a), rule `rego-art5-1a-001`, timestamp, input hash.** One is an audit trail. One is a guess.
## Live enforcement seals
Not a static badge. These seals reflect live `/v1/check` traffic from open-source projects
embedding ComplyEdge — they change as real enforcement happens.
Both projects below are our own. ComplyEdge runs in production against our own code
before we ask anyone else to run it against theirs.
[](https://trust.complyedge.io/ivd)
[](https://trust.complyedge.io/horizon)
| Project | Live trust page |
|---------|-----------------|
| **IVD Framework** | [trust.complyedge.io/ivd](https://trust.complyedge.io/ivd) |
| **Horizon** | [trust.complyedge.io/horizon](https://trust.complyedge.io/horizon) |
Each trust page is generated from that project's real audit trail — enforcement status, check
volume, and the EU AI Act articles enforced at runtime. (GitHub proxies and caches images, so the
seal above can lag; the trust page is always current.)
Embed one on your own project: [Enforcement Seal docs](https://complyedge.io/docs/trust-badge.html).
## Quick Start
```bash
pip install complyedge
```
```python
from complyedge import compliance_check
@compliance_check(jurisdiction="EU", agent_id="my-agent")
def my_agent(prompt):
return llm.generate(prompt) # every input and output checked
```
Three lines. Every AI input and output evaluated against the EU AI Act rule corpus (Article 5, Article 50, GPAI). Violations blocked before they reach the user — with article citation, rule ID, and timestamp on every decision.
Set `COMPLYEDGE_API_KEY` to your key. The decorator activates by default; to disable without removing the key (e.g., in CI), set `COMPLYEDGE_ENABLED=false`.
## Without a decorator
```python
from complyedge import is_safe, check
import os
api_key = os.environ["COMPLYEDGE_API_KEY"]
# Boolean check — returns True if no violations
if not is_safe(prompt, api_key=api_key, jurisdiction="EU"):
raise ValueError("Prompt violates EU AI Act")
# Full result — returns ComplianceResult with the violations that blocked it
result = check(prompt, api_key=api_key, jurisdiction="EU")
if not result.allowed:
for v in result.violations:
print(v.rule_id, v.severity, v.rule_description)
```
`rule_id` is the citation key: every rule carries its article reference in the corpus (`rego-art5-1c-001` → Article 5(1)(c)), and the full citation text ships with the rule under [`rules/`](rules).
Jurisdiction maps to the rule corpus: `EU` evaluates against EU AI Act Article 5, Article 50, and GPAI obligations. `US` evaluates against HIPAA, SOX, COPPA, TCPA, BIPA.
## TrustLint — Offline Linter
No API key required. Scans text against the YAML rule corpus using regex patterns. Published as a standalone package, versioned independently of the SDK.
```bash
pip install trustlint
trustlint check --text "We use social credit scoring to evaluate applicants"
# → CRITICAL: EU_AI_ACT_ART5_SOCIAL_SCORING_001 — Article 5(1)(c)
```
Exit codes: `0` = pass, `1` = violations found. Designed for CI/CD pipelines. Source: [`packages/trustlint/`](packages/trustlint).
## Rule IDs — two namespaces
ComplyEdge resolves the same regulations through two engines, each with its own rule-ID namespace:
- **Runtime API (OPA/Rego):** IDs like `rego-art5-1c-001` — returned by `compliance_check` and the `/v1/check` API. This is the audit trail your production system logs.
- **TrustLint (offline, YAML corpus):** IDs like `EU_AI_ACT_ART5_SOCIAL_SCORING_001` — emitted by the offline linter.
Both cite the same legal article and differ only in engine. Map between them via the article reference carried in every rule.
## What's In This Repo
```
sdks/python/ Python SDK (@compliance_check decorator, CLI)
packages/trustlint/ Offline regex linter (TrustLint) — no API key, for CI/CD
rules/regulations/ 64 YAML rules (EU AI Act, GDPR, HIPAA, SOX, PCI DSS, and more)
rules/rego/ 63 leaf OPA/Rego policies + 6 package aggregators
rules/schemas/ Rule validation schema
examples/ Usage examples (decorators, OpenAI Agents)
scripts/benchmark/ Runtime benchmark (runner + prompt YAMLs + committed results)
tests/ Rule validation + acceptance tests
```
## Rules
64 YAML rules + 63 deterministic leaf OPA/Rego policies (+ 6 package aggregators) across 4 jurisdictions:
| Jurisdiction | Rules | Regulations |
|---|---|---|
| **EU** | 36 YAML + 63 leaf Rego | EU AI Act Articles 4–6, 9–10, 12–16, 26–27, 50, 53, GPAI, GDPR + Art 15 IPI |
| **US** | 16 YAML | HIPAA, SOX, COPPA, TCPA, BIPA, CCPA, Colorado AI Act, NYC LL144, ECPA |
| **Global** | 1 YAML | PCI DSS |
| **Universal** | 11 YAML | PII detection, prompt injection (direct + indirect) |
Each rule specifies conditions, severity, detection scope, and remediation with legal citations. See the [rule schema](rules/schemas/rule-schema.json) for the format.
### Writing Custom Rules
```yaml
id: MY_CUSTOM_RULE_001
jurisdiction: EU
effective_date: "2025-02-02"
description: "Detect prohibited practice X under Article Y"
severity: critical
conditions:
- type: regex
value: "prohibited pattern"
description: "Matches prohibited practice X"
source:
regulation: "EU AI Act"
article: "Article Y(1)(z)"
```
Validate: `cd rules && python scripts/validate_rules.py`
## Architecture
**Layer 1 — Deterministic (hot path):** 63 leaf OPA/Rego policies (+ 6 package aggregators) evaluate every request, no LLM. The engine (OPA/Rego + TrustLint) evaluates in ~1.5ms p99 in a local microbenchmark (`layer1_latency_latest.json`). End-to-end through the live API, the published 60-prompt run measured a p50 of 139ms and p95 of 2,519ms across the 39 OPA-decided prompts, with individual requests spanning 47ms to 10.7s (`runtime_benchmark_latest.json`, 2026-07-28). That run mixes cold and concurrent invocations against a Lambda-backed API, which is where the long tail comes from; we publish the whole run rather than a hand-picked warm figure. Opting into the Layer 2 LLM adds 2–5s on the long tail. Binary pass/block, legal citation on every decision. (TrustLint applies the same regex corpus offline for CI use.)
**Layer 2 — Interpretive (synchronous, opt-in):** When called with `use_semantic_fallback=True`, an LLM evaluates the request and blocks if a violation is found. Off by default since v0.2.2. Adds 2–5s latency per request.
Security products protect AI from bad actors. **ComplyEdge blocks EU AI Act violations at runtime — and logs a cited record on every decision.**
## Benchmark
A 60-prompt corpus runs against the live API. The runner, prompt YAMLs, and the latest result JSON are committed under [`scripts/benchmark/`](scripts/benchmark) — inspect the results directly, or re-run with your own `COMPLYEDGE_API_KEY`.
## Contributing
We welcome rule contributions. See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
Every rule must include: article + paragraph citation, verifiable detection condition, and test cases.
## Security
To report a vulnerability, see [SECURITY.md](SECURITY.md). Do not open a public issue for security reports.
## License
Apache License 2.0 — see [LICENSE](LICENSE).
## Links
- **Website**: [complyedge.io](https://complyedge.io)
- **Blog**: [complyedge.io/blog/](https://complyedge.io/blog/)
- **GPAI Compliance Benchmark**: [complyedge.io/blog/gpai-compliance-benchmark.html](https://complyedge.io/blog/gpai-compliance-benchmark.html)
- **Why OPA/Rego for EU AI Act**: [complyedge.io/blog/why-opa-rego-eu-ai-act.html](https://complyedge.io/blog/why-opa-rego-eu-ai-act.html)
- **PyPI**: [pypi.org/project/complyedge](https://pypi.org/project/complyedge/)
- **Changelog**: [CHANGELOG.md](CHANGELOG.md)
- **Rule Schema**: [rules/schemas/rule-schema.json](rules/schemas/rule-schema.json)
What people ask about complyedge
What is ComplyEdge/complyedge?
+
ComplyEdge/complyedge is subagents for the Claude AI ecosystem. Open-source compliance engine for AI agents. Rules, SDKs, and examples. It has 4 GitHub stars and was last updated today.
How do I install complyedge?
+
You can install complyedge by cloning the repository (https://github.com/ComplyEdge/complyedge) or following the README instructions on GitHub. ClaudeWave also provides quick install blocks on this page.
Is ComplyEdge/complyedge safe to use?
+
ComplyEdge/complyedge has not been audited yet by our security agent. Review the original repository on GitHub before using it in production.
Who maintains ComplyEdge/complyedge?
+
ComplyEdge/complyedge is maintained by ComplyEdge. The last recorded GitHub activity is from today, with 0 open issues.
Are there alternatives to complyedge?
+
Yes. On ClaudeWave you can browse similar subagents at /categories/agents, sorted by popularity or recent activity.
Deploy complyedge to your cloud
Ship this repo to production in minutes. Each platform spins up its own environment with editable env vars.
Maintain this repo? Add a badge to your README
Drop the badge into your GitHub README to show it's tracked on ClaudeWave. Each badge links back to this page and reflects the live Trust Score.
[](https://claudewave.com/repo/complyedge-complyedge)<a href="https://claudewave.com/repo/complyedge-complyedge"><img src="https://claudewave.com/api/badge/complyedge-complyedge" alt="Featured on ClaudeWave: ComplyEdge/complyedge" width="320" height="64" /></a>More Subagents
The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
The agent that grows with you
Java 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
The agent engineering platform.
Turn any codebase, with its docs, SQL schemas, configs, and PDFs, into a queryable knowledge graph. A /graphify skill for Claude Code, Cursor, Codex, and Gemini CLI: local deterministic AST parsing, every edge explained, no vector store.