comply54 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. comply54-0.1.0/PKG-INFO +233 -0
  2. comply54-0.1.0/README.md +194 -0
  3. comply54-0.1.0/comply54/__init__.py +108 -0
  4. comply54-0.1.0/comply54/autogen/__init__.py +0 -0
  5. comply54-0.1.0/comply54/autogen/adapter.py +68 -0
  6. comply54-0.1.0/comply54/core/__init__.py +12 -0
  7. comply54-0.1.0/comply54/core/engine.py +185 -0
  8. comply54-0.1.0/comply54/core/models.py +200 -0
  9. comply54-0.1.0/comply54/core/packs.py +276 -0
  10. comply54-0.1.0/comply54/crewai/__init__.py +0 -0
  11. comply54-0.1.0/comply54/crewai/adapter.py +87 -0
  12. comply54-0.1.0/comply54/langchain/__init__.py +0 -0
  13. comply54-0.1.0/comply54/langchain/adapter.py +129 -0
  14. comply54-0.1.0/comply54/packs/__init__.py +0 -0
  15. comply54-0.1.0/comply54/packs/africa/__init__.py +0 -0
  16. comply54-0.1.0/comply54/packs/africa/egypt_pdpl.rego +219 -0
  17. comply54-0.1.0/comply54/packs/africa/ethiopia_pdp.rego +191 -0
  18. comply54-0.1.0/comply54/packs/africa/ghana_dpa.rego +183 -0
  19. comply54-0.1.0/comply54/packs/africa/kdpa.rego +189 -0
  20. comply54-0.1.0/comply54/packs/africa/mauritius_dpa.rego +272 -0
  21. comply54-0.1.0/comply54/packs/africa/popia.rego +163 -0
  22. comply54-0.1.0/comply54/packs/africa/rwanda_dpa.rego +197 -0
  23. comply54-0.1.0/comply54/packs/africa/tanzania_pdpa.rego +178 -0
  24. comply54-0.1.0/comply54/packs/africa/uganda_dppa.rego +183 -0
  25. comply54-0.1.0/comply54/packs/nigeria/__init__.py +0 -0
  26. comply54-0.1.0/comply54/packs/nigeria/bvn_nin.rego +142 -0
  27. comply54-0.1.0/comply54/packs/nigeria/cbn.rego +165 -0
  28. comply54-0.1.0/comply54/packs/nigeria/ndpa.rego +174 -0
  29. comply54-0.1.0/comply54/packs/nigeria/nfiu_aml.rego +154 -0
  30. comply54-0.1.0/comply54/packs/universal/__init__.py +0 -0
  31. comply54-0.1.0/comply54/packs/universal/human_approval.rego +122 -0
  32. comply54-0.1.0/comply54/packs/universal/model_routing.rego +151 -0
  33. comply54-0.1.0/comply54/packs/universal/pii_leakage.rego +166 -0
  34. comply54-0.1.0/comply54/packs/universal/prompt_injection.rego +111 -0
  35. comply54-0.1.0/comply54/packs/universal/tool_permissions.rego +98 -0
  36. comply54-0.1.0/comply54/sectors/__init__.py +11 -0
  37. comply54-0.1.0/comply54/sectors/_base.py +131 -0
  38. comply54-0.1.0/comply54/sectors/kenya_fintech.py +54 -0
  39. comply54-0.1.0/comply54/sectors/nigeria_fintech.py +72 -0
  40. comply54-0.1.0/comply54/sectors/pan_african.py +91 -0
  41. comply54-0.1.0/comply54.egg-info/PKG-INFO +233 -0
  42. comply54-0.1.0/comply54.egg-info/SOURCES.txt +48 -0
  43. comply54-0.1.0/comply54.egg-info/dependency_links.txt +1 -0
  44. comply54-0.1.0/comply54.egg-info/requires.txt +22 -0
  45. comply54-0.1.0/comply54.egg-info/top_level.txt +1 -0
  46. comply54-0.1.0/pyproject.toml +87 -0
  47. comply54-0.1.0/setup.cfg +4 -0
  48. comply54-0.1.0/tests/test_certificate.py +136 -0
  49. comply54-0.1.0/tests/test_engine.py +158 -0
  50. comply54-0.1.0/tests/test_sectors.py +135 -0
@@ -0,0 +1,233 @@
1
+ Metadata-Version: 2.4
2
+ Name: comply54
3
+ Version: 0.1.0
4
+ Summary: African AI governance compliance — enforcement engine and sector packs for NDPA, CBN, KDPA, POPIA and 15+ African regulatory frameworks.
5
+ Author-email: Oluwajuwon Omotayo <oluwajuwon.falore@sagegreytech.com>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://comply54.io
8
+ Project-URL: Repository, https://github.com/comply54/comply54
9
+ Project-URL: Issues, https://github.com/comply54/comply54/issues
10
+ Keywords: comply54,africa,compliance,ai-governance,ndpa,cbn,kdpa,popia,rego,opa,fintech,data-protection,nigeria,kenya
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Topic :: Security
14
+ Classifier: Topic :: Office/Business :: Financial
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Requires-Python: >=3.9
21
+ Description-Content-Type: text/markdown
22
+ Requires-Dist: regopy>=1.4.0
23
+ Requires-Dist: pydantic>=2.0.0
24
+ Provides-Extra: langchain
25
+ Requires-Dist: langchain-core>=0.1.0; extra == "langchain"
26
+ Provides-Extra: crewai
27
+ Requires-Dist: crewai>=0.28.0; extra == "crewai"
28
+ Provides-Extra: autogen
29
+ Requires-Dist: pyautogen>=0.2.0; extra == "autogen"
30
+ Provides-Extra: all
31
+ Requires-Dist: langchain-core>=0.1.0; extra == "all"
32
+ Requires-Dist: crewai>=0.28.0; extra == "all"
33
+ Requires-Dist: pyautogen>=0.2.0; extra == "all"
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest>=8.0; extra == "dev"
36
+ Requires-Dist: pytest-cov; extra == "dev"
37
+ Requires-Dist: ruff; extra == "dev"
38
+ Requires-Dist: pyright; extra == "dev"
39
+
40
+ # Comply54
41
+
42
+ **Open-source AI governance registry and tooling for African regulatory compliance.**
43
+
44
+ [![CI](https://github.com/comply54/comply54/actions/workflows/ci.yml/badge.svg)](https://github.com/comply54/comply54/actions/workflows/ci.yml)
45
+ [![codecov](https://codecov.io/gh/comply54/comply54/branch/main/graph/badge.svg)](https://codecov.io/gh/comply54/comply54)
46
+ [![PyPI](https://img.shields.io/pypi/v/comply54.svg)](https://pypi.org/project/comply54)
47
+ [![npm](https://img.shields.io/npm/v/@comply54/core.svg)](https://www.npmjs.com/package/@comply54/core)
48
+ [![Python](https://img.shields.io/pypi/pyversions/comply54.svg)](https://pypi.org/project/comply54)
49
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
50
+
51
+ ---
52
+
53
+ ## How it relates to agt-policies-nigeria
54
+
55
+ ```
56
+ kingztech2019/agt-policies-nigeria comply54
57
+ ────────────────────────────────── ────────────────────────────────────
58
+ The policy SOURCE. The registry and tooling LAYER.
59
+
60
+ • 12 policy packs (YAML + Rego) ──▶ • registry.json indexes them by URL
61
+ • Cited in Microsoft AGT main ──▶ • adapters load them into any framework
62
+ • OPA tests (306 passing) ──▶ • schema validates them on every PR
63
+ • Stays at kingztech2019 forever ──▶ • comply54 never duplicates them
64
+ ```
65
+
66
+ `agt-policies-nigeria` is where the policy files live — it is permanently cited in
67
+ [Microsoft Agent-OS](https://github.com/microsoft/agent-governance-toolkit). That repo
68
+ will never move.
69
+
70
+ `comply54` is where the ecosystem lives — the registry, framework adapters, JSON Schema
71
+ validator, and CI tooling that makes those policies consumable from LangChain, CrewAI,
72
+ AutoGen, and any OPA pipeline. When new packs are contributed (Ghana DPA, Rwanda DPA,
73
+ ECOWAS), their policy files will live under `packages/` in this repo.
74
+
75
+ ---
76
+
77
+ ## Policy Packs (current)
78
+
79
+ All 12 current packs are sourced from `kingztech2019/agt-policies-nigeria`.
80
+ `registry.json` has the direct raw GitHub URLs for each.
81
+
82
+ ### Universal Agent Safety Controls
83
+
84
+ | Pack | Regulation | OWASP Ref |
85
+ |------|-----------|-----------|
86
+ | prompt-injection | OWASP Agentic AI — LLM01/ASI01 | LLM01 |
87
+ | pii-leakage | OWASP LLM06 | LLM06 |
88
+ | tool-permissions | OWASP LLM08 | LLM08 |
89
+ | human-approval | OWASP LLM09 | LLM09 |
90
+ | model-routing | OWASP LLM03/LLM05 | LLM03/LLM05 |
91
+
92
+ ### Nigerian Regulatory Packs
93
+
94
+ | Pack | Regulation | Authority |
95
+ |------|-----------|----------|
96
+ | nigeria/ndpa | Nigeria Data Protection Act 2023 | NDPC |
97
+ | nigeria/cbn | CBN Transaction Limits & Tiered KYC | CBN |
98
+ | nigeria/bvn-nin | CBN BVN Framework; NIBSS Rules | CBN / NIBSS |
99
+ | nigeria/nfiu-aml | MLPPA 2022 / NFIU AML Guidelines | NFIU |
100
+ | nigeria/pos-geofencing | CBN Agent Banking Guidelines 2020 | CBN |
101
+
102
+ ### East Africa
103
+
104
+ | Pack | Regulation | Authority |
105
+ |------|-----------|----------|
106
+ | kenya/kdpa | Kenya Data Protection Act 2019 | ODPC |
107
+
108
+ ### Southern Africa
109
+
110
+ | Pack | Regulation | Authority |
111
+ |------|-----------|----------|
112
+ | south-africa/popia | POPIA Act 4 of 2013 | Information Regulator ZA |
113
+
114
+ ---
115
+
116
+ ## Quick Start
117
+
118
+ ### With Microsoft Agent-OS (AGT)
119
+
120
+ ```python
121
+ from adapters.agt import load_jurisdiction
122
+
123
+ # Loads all packs for Nigeria + universal from agt-policies-nigeria (via raw GitHub URL)
124
+ policies = load_jurisdiction("NG")
125
+
126
+ for policy in policies:
127
+ result = policy.evaluate({"action": "export_data", "output": ""})
128
+ ```
129
+
130
+ ### With LangChain / LangGraph
131
+
132
+ ```python
133
+ from adapters.langchain import compliance_node
134
+
135
+ # Pack source URL from registry.json
136
+ node = compliance_node([
137
+ "https://raw.githubusercontent.com/kingztech2019/agt-policies-nigeria/main/policies/ndpa-data-residency.yaml",
138
+ "https://raw.githubusercontent.com/kingztech2019/agt-policies-nigeria/main/policies/agent-pii-leakage.yaml",
139
+ ])
140
+ graph.add_node("compliance", node)
141
+ ```
142
+
143
+ ### With CrewAI
144
+
145
+ ```python
146
+ from adapters.crewai import build_tools_for_jurisdiction
147
+
148
+ tools = build_tools_for_jurisdiction("NG")
149
+ agent = Agent(role="Fintech Agent", tools=tools, ...)
150
+ ```
151
+
152
+ ### With AutoGen
153
+
154
+ ```python
155
+ from adapters.autogen import check_all_packs
156
+
157
+ result = check_all_packs(jurisdiction="NG", action="send_to_external", output="user@example.com")
158
+ # {"overall": "block", "results": [...]}
159
+ ```
160
+
161
+ ### Direct OPA (from agt-policies-nigeria)
162
+
163
+ ```bash
164
+ git clone https://github.com/kingztech2019/agt-policies-nigeria
165
+ cd agt-policies-nigeria
166
+ opa test policies/rego/ -v # 306 tests
167
+ ```
168
+
169
+ ---
170
+
171
+ ## Consuming the Registry
172
+
173
+ ```python
174
+ import json, urllib.request
175
+
176
+ registry = json.loads(
177
+ urllib.request.urlopen(
178
+ "https://raw.githubusercontent.com/kingztech2019/comply54/main/registry.json"
179
+ ).read()
180
+ )
181
+
182
+ # Get all packs for Nigeria
183
+ ng_pack_ids = registry["jurisdiction_map"]["NG"]
184
+ ng_packs = [p for p in registry["packs"] if p["id"] in ng_pack_ids]
185
+
186
+ # Fetch a policy YAML directly
187
+ import yaml, urllib.request
188
+ policy_yaml = yaml.safe_load(
189
+ urllib.request.urlopen(ng_packs[0]["source_yaml"]).read()
190
+ )
191
+ ```
192
+
193
+ ---
194
+
195
+ ## Adding a New Pack
196
+
197
+ New packs that are NOT part of `agt-policies-nigeria` (e.g. Ghana DPA, Rwanda DPA,
198
+ ECOWAS) go into `packages/<jurisdiction>/<slug>/` in this repo. See [CONTRIBUTING.md](CONTRIBUTING.md).
199
+
200
+ Packs already in `agt-policies-nigeria` do not need to be duplicated here — add a
201
+ registry entry in `registry.json` with the `source_yaml` URL.
202
+
203
+ ---
204
+
205
+ ## Validation & CI
206
+
207
+ ```bash
208
+ pip install pyyaml jsonschema
209
+
210
+ # Validate all packs in registry.json (fetches remote ones over HTTPS)
211
+ python tools/validate.py
212
+
213
+ # Skip remote packs (offline mode)
214
+ python tools/validate.py --local-only
215
+
216
+ # Validate a single local pack
217
+ python tools/validate.py packages/ghana/gdpa
218
+ ```
219
+
220
+ CI runs on every push and PR:
221
+ 1. Schema validation (all registry packs — remote + local)
222
+ 2. OPA tests (local packs only — remote packs tested in agt-policies-nigeria)
223
+ 3. Regal lint (local packs only)
224
+ 4. meta.json completeness (local packs)
225
+ 5. Registry source URL reachability check
226
+
227
+ ---
228
+
229
+ ## Disclaimer
230
+
231
+ Comply54 policy packs are community-maintained governance **starter templates**, not
232
+ certified legal compliance instruments. Organisations must perform their own assessments
233
+ with qualified legal and regulatory advisors before deploying in regulated environments.
@@ -0,0 +1,194 @@
1
+ # Comply54
2
+
3
+ **Open-source AI governance registry and tooling for African regulatory compliance.**
4
+
5
+ [![CI](https://github.com/comply54/comply54/actions/workflows/ci.yml/badge.svg)](https://github.com/comply54/comply54/actions/workflows/ci.yml)
6
+ [![codecov](https://codecov.io/gh/comply54/comply54/branch/main/graph/badge.svg)](https://codecov.io/gh/comply54/comply54)
7
+ [![PyPI](https://img.shields.io/pypi/v/comply54.svg)](https://pypi.org/project/comply54)
8
+ [![npm](https://img.shields.io/npm/v/@comply54/core.svg)](https://www.npmjs.com/package/@comply54/core)
9
+ [![Python](https://img.shields.io/pypi/pyversions/comply54.svg)](https://pypi.org/project/comply54)
10
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
11
+
12
+ ---
13
+
14
+ ## How it relates to agt-policies-nigeria
15
+
16
+ ```
17
+ kingztech2019/agt-policies-nigeria comply54
18
+ ────────────────────────────────── ────────────────────────────────────
19
+ The policy SOURCE. The registry and tooling LAYER.
20
+
21
+ • 12 policy packs (YAML + Rego) ──▶ • registry.json indexes them by URL
22
+ • Cited in Microsoft AGT main ──▶ • adapters load them into any framework
23
+ • OPA tests (306 passing) ──▶ • schema validates them on every PR
24
+ • Stays at kingztech2019 forever ──▶ • comply54 never duplicates them
25
+ ```
26
+
27
+ `agt-policies-nigeria` is where the policy files live — it is permanently cited in
28
+ [Microsoft Agent-OS](https://github.com/microsoft/agent-governance-toolkit). That repo
29
+ will never move.
30
+
31
+ `comply54` is where the ecosystem lives — the registry, framework adapters, JSON Schema
32
+ validator, and CI tooling that makes those policies consumable from LangChain, CrewAI,
33
+ AutoGen, and any OPA pipeline. When new packs are contributed (Ghana DPA, Rwanda DPA,
34
+ ECOWAS), their policy files will live under `packages/` in this repo.
35
+
36
+ ---
37
+
38
+ ## Policy Packs (current)
39
+
40
+ All 12 current packs are sourced from `kingztech2019/agt-policies-nigeria`.
41
+ `registry.json` has the direct raw GitHub URLs for each.
42
+
43
+ ### Universal Agent Safety Controls
44
+
45
+ | Pack | Regulation | OWASP Ref |
46
+ |------|-----------|-----------|
47
+ | prompt-injection | OWASP Agentic AI — LLM01/ASI01 | LLM01 |
48
+ | pii-leakage | OWASP LLM06 | LLM06 |
49
+ | tool-permissions | OWASP LLM08 | LLM08 |
50
+ | human-approval | OWASP LLM09 | LLM09 |
51
+ | model-routing | OWASP LLM03/LLM05 | LLM03/LLM05 |
52
+
53
+ ### Nigerian Regulatory Packs
54
+
55
+ | Pack | Regulation | Authority |
56
+ |------|-----------|----------|
57
+ | nigeria/ndpa | Nigeria Data Protection Act 2023 | NDPC |
58
+ | nigeria/cbn | CBN Transaction Limits & Tiered KYC | CBN |
59
+ | nigeria/bvn-nin | CBN BVN Framework; NIBSS Rules | CBN / NIBSS |
60
+ | nigeria/nfiu-aml | MLPPA 2022 / NFIU AML Guidelines | NFIU |
61
+ | nigeria/pos-geofencing | CBN Agent Banking Guidelines 2020 | CBN |
62
+
63
+ ### East Africa
64
+
65
+ | Pack | Regulation | Authority |
66
+ |------|-----------|----------|
67
+ | kenya/kdpa | Kenya Data Protection Act 2019 | ODPC |
68
+
69
+ ### Southern Africa
70
+
71
+ | Pack | Regulation | Authority |
72
+ |------|-----------|----------|
73
+ | south-africa/popia | POPIA Act 4 of 2013 | Information Regulator ZA |
74
+
75
+ ---
76
+
77
+ ## Quick Start
78
+
79
+ ### With Microsoft Agent-OS (AGT)
80
+
81
+ ```python
82
+ from adapters.agt import load_jurisdiction
83
+
84
+ # Loads all packs for Nigeria + universal from agt-policies-nigeria (via raw GitHub URL)
85
+ policies = load_jurisdiction("NG")
86
+
87
+ for policy in policies:
88
+ result = policy.evaluate({"action": "export_data", "output": ""})
89
+ ```
90
+
91
+ ### With LangChain / LangGraph
92
+
93
+ ```python
94
+ from adapters.langchain import compliance_node
95
+
96
+ # Pack source URL from registry.json
97
+ node = compliance_node([
98
+ "https://raw.githubusercontent.com/kingztech2019/agt-policies-nigeria/main/policies/ndpa-data-residency.yaml",
99
+ "https://raw.githubusercontent.com/kingztech2019/agt-policies-nigeria/main/policies/agent-pii-leakage.yaml",
100
+ ])
101
+ graph.add_node("compliance", node)
102
+ ```
103
+
104
+ ### With CrewAI
105
+
106
+ ```python
107
+ from adapters.crewai import build_tools_for_jurisdiction
108
+
109
+ tools = build_tools_for_jurisdiction("NG")
110
+ agent = Agent(role="Fintech Agent", tools=tools, ...)
111
+ ```
112
+
113
+ ### With AutoGen
114
+
115
+ ```python
116
+ from adapters.autogen import check_all_packs
117
+
118
+ result = check_all_packs(jurisdiction="NG", action="send_to_external", output="user@example.com")
119
+ # {"overall": "block", "results": [...]}
120
+ ```
121
+
122
+ ### Direct OPA (from agt-policies-nigeria)
123
+
124
+ ```bash
125
+ git clone https://github.com/kingztech2019/agt-policies-nigeria
126
+ cd agt-policies-nigeria
127
+ opa test policies/rego/ -v # 306 tests
128
+ ```
129
+
130
+ ---
131
+
132
+ ## Consuming the Registry
133
+
134
+ ```python
135
+ import json, urllib.request
136
+
137
+ registry = json.loads(
138
+ urllib.request.urlopen(
139
+ "https://raw.githubusercontent.com/kingztech2019/comply54/main/registry.json"
140
+ ).read()
141
+ )
142
+
143
+ # Get all packs for Nigeria
144
+ ng_pack_ids = registry["jurisdiction_map"]["NG"]
145
+ ng_packs = [p for p in registry["packs"] if p["id"] in ng_pack_ids]
146
+
147
+ # Fetch a policy YAML directly
148
+ import yaml, urllib.request
149
+ policy_yaml = yaml.safe_load(
150
+ urllib.request.urlopen(ng_packs[0]["source_yaml"]).read()
151
+ )
152
+ ```
153
+
154
+ ---
155
+
156
+ ## Adding a New Pack
157
+
158
+ New packs that are NOT part of `agt-policies-nigeria` (e.g. Ghana DPA, Rwanda DPA,
159
+ ECOWAS) go into `packages/<jurisdiction>/<slug>/` in this repo. See [CONTRIBUTING.md](CONTRIBUTING.md).
160
+
161
+ Packs already in `agt-policies-nigeria` do not need to be duplicated here — add a
162
+ registry entry in `registry.json` with the `source_yaml` URL.
163
+
164
+ ---
165
+
166
+ ## Validation & CI
167
+
168
+ ```bash
169
+ pip install pyyaml jsonschema
170
+
171
+ # Validate all packs in registry.json (fetches remote ones over HTTPS)
172
+ python tools/validate.py
173
+
174
+ # Skip remote packs (offline mode)
175
+ python tools/validate.py --local-only
176
+
177
+ # Validate a single local pack
178
+ python tools/validate.py packages/ghana/gdpa
179
+ ```
180
+
181
+ CI runs on every push and PR:
182
+ 1. Schema validation (all registry packs — remote + local)
183
+ 2. OPA tests (local packs only — remote packs tested in agt-policies-nigeria)
184
+ 3. Regal lint (local packs only)
185
+ 4. meta.json completeness (local packs)
186
+ 5. Registry source URL reachability check
187
+
188
+ ---
189
+
190
+ ## Disclaimer
191
+
192
+ Comply54 policy packs are community-maintained governance **starter templates**, not
193
+ certified legal compliance instruments. Organisations must perform their own assessments
194
+ with qualified legal and regulatory advisors before deploying in regulated environments.
@@ -0,0 +1,108 @@
1
+ """
2
+ comply54
3
+ ~~~~~~~~
4
+ African AI governance compliance — enforcement engine and sector packs.
5
+
6
+ Quick start:
7
+
8
+ from comply54 import NigeriaFintechCompliance
9
+
10
+ compliance = NigeriaFintechCompliance()
11
+ result = compliance.check(
12
+ action="transfer_funds",
13
+ params={"amount": 15_000_000, "currency": "NGN"},
14
+ context={"kyc_tier": 3},
15
+ )
16
+ if result.blocked:
17
+ raise ValueError(result.primary_violation.messages[0])
18
+
19
+ Low-level API:
20
+
21
+ from comply54 import evaluate, PACK_REGISTRY
22
+
23
+ result = evaluate(
24
+ pack_ids=["nigeria/cbn", "nigeria/ndpa", "universal/pii-leakage"],
25
+ action="export_data",
26
+ params={"destination_country": "CN", "data_type": "pii"},
27
+ )
28
+ """
29
+
30
+ from __future__ import annotations
31
+
32
+ from .core.engine import Comply54Engine
33
+ from .core.models import Action, ComplianceCertificate, ComplianceResult, EvaluationInput, PolicyDecision
34
+ from .core.packs import (
35
+ PACK_REGISTRY,
36
+ PackSpec,
37
+ packs_for_ids,
38
+ packs_for_jurisdiction,
39
+ )
40
+ from .sectors import (
41
+ KenyaFintechCompliance,
42
+ NigeriaFintechCompliance,
43
+ PanAfricanFintechCompliance,
44
+ SectorCompliance,
45
+ )
46
+
47
+ __version__ = "0.1.0"
48
+ __all__ = [
49
+ # Sector packs (recommended entry point)
50
+ "NigeriaFintechCompliance",
51
+ "KenyaFintechCompliance",
52
+ "PanAfricanFintechCompliance",
53
+ "SectorCompliance",
54
+ # Low-level API
55
+ "evaluate",
56
+ "list_packs",
57
+ "Comply54Engine",
58
+ "EvaluationInput",
59
+ "ComplianceResult",
60
+ "ComplianceCertificate",
61
+ "PolicyDecision",
62
+ "Action",
63
+ # Pack registry
64
+ "PACK_REGISTRY",
65
+ "PackSpec",
66
+ "packs_for_jurisdiction",
67
+ "packs_for_ids",
68
+ ]
69
+
70
+
71
+ def list_packs() -> list[PackSpec]:
72
+ """Return all registered comply54 packs."""
73
+ return list(PACK_REGISTRY.values())
74
+
75
+
76
+ def evaluate(
77
+ pack_ids: list[str],
78
+ action: str,
79
+ params: dict | None = None,
80
+ output: str = "",
81
+ context: dict | None = None,
82
+ ) -> ComplianceResult:
83
+ """
84
+ Evaluate a set of comply54 packs against an agent action.
85
+
86
+ This is the lowest-level public API. Prefer sector packs
87
+ (NigeriaFintechCompliance etc.) for production use.
88
+
89
+ Args:
90
+ pack_ids: List of pack IDs from PACK_REGISTRY.
91
+ action: The tool/action name.
92
+ params: Structured parameters dict.
93
+ output: Agent's proposed text output.
94
+ context: Session context dict.
95
+
96
+ Returns:
97
+ ComplianceResult
98
+
99
+ Example:
100
+ result = evaluate(
101
+ pack_ids=["nigeria/cbn", "universal/pii-leakage"],
102
+ action="transfer_funds",
103
+ params={"amount": 15_000_000, "currency": "NGN"},
104
+ )
105
+ """
106
+ packs = packs_for_ids(pack_ids)
107
+ engine = Comply54Engine(packs=packs)
108
+ return engine.check(action=action, params=params or {}, output=output, context=context or {})
File without changes
@@ -0,0 +1,68 @@
1
+ """
2
+ comply54.autogen.adapter
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~
4
+ Microsoft AutoGen integration for comply54.
5
+
6
+ Usage:
7
+ from autogen import AssistantAgent
8
+ from comply54.autogen import register_compliance
9
+ from comply54 import NigeriaFintechCompliance
10
+
11
+ assistant = AssistantAgent("assistant", llm_config=llm_config)
12
+ register_compliance(assistant, NigeriaFintechCompliance())
13
+ """
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ from typing import Annotated, Any
19
+
20
+ from ..sectors._base import SectorCompliance
21
+
22
+
23
+ def register_compliance(agent: Any, compliance: SectorCompliance) -> None:
24
+ """
25
+ Register a comply54 SectorCompliance pack as a callable function tool on an AutoGen agent.
26
+
27
+ Args:
28
+ agent: An autogen ConversableAgent or AssistantAgent.
29
+ compliance: A SectorCompliance instance.
30
+ """
31
+ def check_compliance(
32
+ action: Annotated[str, "The agent action or tool name to evaluate."],
33
+ params: Annotated[str, "JSON-encoded parameters dict."] = "{}",
34
+ output: Annotated[str, "The agent's proposed output text."] = "",
35
+ context: Annotated[str, "JSON-encoded session context dict."] = "{}",
36
+ ) -> str:
37
+ result = compliance.check(
38
+ action=action,
39
+ params=json.loads(params) if params else {},
40
+ output=output,
41
+ context=json.loads(context) if context else {},
42
+ )
43
+ return json.dumps({
44
+ "overall": result.overall,
45
+ "blocked": result.blocked,
46
+ "violations": [
47
+ {"pack": d.pack, "action": d.action, "messages": d.messages}
48
+ for d in result.violations
49
+ ],
50
+ })
51
+
52
+ fn_name = f"comply54_{compliance.__class__.__name__.lower()}"
53
+ check_compliance.__name__ = fn_name
54
+ check_compliance.__doc__ = (
55
+ f"comply54 compliance check: {compliance.name}. "
56
+ f"Jurisdictions: {', '.join(compliance.jurisdictions)}. "
57
+ "Returns JSON with overall decision and violations."
58
+ )
59
+
60
+ try:
61
+ agent.register_for_llm(
62
+ name=fn_name,
63
+ description=check_compliance.__doc__,
64
+ )(check_compliance)
65
+ except AttributeError as e:
66
+ raise ImportError(
67
+ "pyautogen is required. Install with: pip install comply54[autogen]"
68
+ ) from e
@@ -0,0 +1,12 @@
1
+ from .models import PolicyDecision, ComplianceResult, EvaluationInput
2
+ from .engine import Comply54Engine
3
+ from .packs import PACK_REGISTRY, PackSpec
4
+
5
+ __all__ = [
6
+ "PolicyDecision",
7
+ "ComplianceResult",
8
+ "EvaluationInput",
9
+ "Comply54Engine",
10
+ "PACK_REGISTRY",
11
+ "PackSpec",
12
+ ]