guardrails-african-compliance
Guardrails AI validator for African financial and data protection compliance.
Validates LLM outputs against African regulatory frameworks — detecting special-category data, AML/CFT transaction thresholds, and prohibited cross-border data transfers.
What it checks
1. Sensitive data (sensitive_data)
Flags special-category data keywords under African data protection laws:
| Framework | Jurisdiction | Special categories |
|---|---|---|
| NDPA 2023 | Nigeria | Health, biometric, genetic, religious, political, children's data |
| POPIA | South Africa | Above + criminal records |
| KDPA 2019 | Kenya | Above + ethnic origin, race |
| GH_DPA 2012 | Ghana | Same as NDPA base |
| RW_DPA 2021 | Rwanda | Same as NDPA base |
2. CBN transaction thresholds (cbn_threshold)
Flags Nigerian Naira (NGN / ₦) amounts in LLM output:
| Amount | Rule |
|---|---|
| ≥ ₦5,000,000 | Structuring risk — compliance officer review required |
| ≥ ₦10,000,000 | Mandatory Currency Transaction Report (CBN AML/CFT/CPF 2023) |
3. CBK transaction thresholds (cbk_threshold)
Flags Kenyan Shilling (KES / KSh) amounts:
| Amount | Rule |
|---|---|
| ≥ KES 1,000,000 | Suspicious transaction — enhanced due diligence |
| ≥ KES 5,000,000 | Mandatory CTR (CBK AML/CFT Guidelines) |
4. Cross-border data transfers (cross_border)
Flags data transfer language directed at countries without NDPA 2023 §43 adequacy determination (China, Russia, Iran, North Korea, Belarus, Myanmar, Cuba, Syria).
Installation
guardrails hub install hub://guardrails/african_compliance
Or install directly:
pip install guardrails-african-compliance
Usage
from guardrails import Guard
from guardrails.hub import AfricanCompliance
# Run all checks
guard = Guard().use(AfricanCompliance, on_fail="exception")
# CBN threshold
guard.validate("Transfer of NGN 10,000,000 approved.")
# → raises ValidationError: [CBN] Amount ₦10,000,000 exceeds mandatory CTR threshold
# Sensitive data
guard.validate("The customer's health record was retrieved.")
# → raises ValidationError: [NDPA] Special-category data detected
# Cross-border
guard.validate("Syncing customer records to China.")
# → raises ValidationError: [NDPA] Cross-border data transfer to 'China' detected
# Run specific checks only
guard_cbn = Guard().use(
AfricanCompliance,
checks=["cbn_threshold"],
on_fail="exception"
)
# Scope sensitive data to specific frameworks
guard_ndpa_popia = Guard().use(
AfricanCompliance,
checks=["sensitive_data"],
jurisdictions=["NDPA", "POPIA"],
on_fail="exception"
)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
checks |
list[str] | None |
None (all) |
Checks to run |
jurisdictions |
list[str] | None |
None (all) |
Frameworks for sensitive_data check |
on_fail |
str | Callable |
— | Guardrails failure action |
Available checks: sensitive_data, cbn_threshold, cbk_threshold, cross_border
Available jurisdictions: NDPA, POPIA, KDPA, GH_DPA, RW_DPA
Running tests
pip install guardrails-ai pytest
pytest tests/
Contributing
Part of a broader African compliance initiative. Issues and PRs welcome.
Built by Oluwajuwon Omotayo — also see:
- eve-policy — policy enforcement for AI agent tool calls
- guardrails-african-pii — African PII detection validator
Release files for guardrails-african-compliance 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| guardrails_african_compliance-0.1.0.tar.gz | 12.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| guardrails_african_compliance-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.1 kB
Release files / guardrails_african_compliance-0.1.0.tar.gz
| Download URL | guardrails_african_compliance-0.1.0.tar.gz |
|---|---|
| Size | 12.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
17eb03be74750d00ed8d486680503a73fd2c2b8399675c35113ddf43903fb5cb
|
|
BLAKE2b-256 checksum How to use checksums |
59dc904b6311b3cc1ffb0fb535f3b6e16c173bec00f926feac54b893125c25a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Release files / guardrails_african_compliance-0.1.0-py3-none-any.whl
| Download URL | guardrails_african_compliance-0.1.0-py3-none-any.whl |
|---|---|
| Size | 14.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5408bacaf68f4850d43edf2508e96a67f0510ce46f8d76023dd6a761140f718c
|
|
BLAKE2b-256 checksum How to use checksums |
f442287f5ad0e8c25090c3443e9ed943c1abc582be4d0182aa3d987c88e8937b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|