Quickstart
Install
pip install comply54
No OPA binary required. comply54 evaluates Rego policies in-process using regopy.
Your first compliance check
from comply54.sectors import NigeriaFintechCompliance
compliance = NigeriaFintechCompliance()
# Check a fund transfer against NDPA + CBN + BVN/NIN + NFIU + agent safety packs
result = compliance.check(
action="transfer_funds",
params={"amount": 15_000_000, "currency": "NGN"},
context={"kyc_tier": 3},
)
print(result.overall) # "deny"
print(result.blocked) # True
pv = result.primary_violation
print(pv.regulation) # "CBN NIP Framework"
print(pv.messages[0]) # "Transaction of ₦15,000,000 exceeds ..."
print(pv.rule_triggered) # "nip_cap"
print(pv.citations[0].document) # "CBN NIP (NIBSS Instant Payment) Framework"
print(pv.citations[0].section) # "§4.2 — Per-Transaction Cap"
Integrate with LangGraph (ReAct agents)
Comply54Guard intercepts every tool call a ReAct agent makes and blocks it before execution if any pack returns deny.
from langchain_anthropic import ChatAnthropic
from langgraph.graph import StateGraph, MessagesState
from langgraph.prebuilt import ToolNode
from comply54.sectors import NigeriaFintechCompliance
from comply54.langchain import Comply54Guard, comply54_route
compliance = NigeriaFintechCompliance()
tools = [transfer_funds_tool, check_balance_tool] # your LangChain tools
def build_agent():
llm = ChatAnthropic(model="claude-haiku-4-5-20251001").bind_tools(tools)
def agent_node(state):
return {"messages": [llm.invoke(state["messages"])]}
guard = Comply54Guard(compliance, tools)
graph = StateGraph(MessagesState)
graph.add_node("agent", agent_node)
graph.add_node("guard", guard)
graph.add_node("tools", ToolNode(tools))
graph.set_entry_point("agent")
graph.add_conditional_edges("agent", comply54_route, {"guard": "guard", "__end__": "__end__"})
graph.add_edge("guard", "tools")
graph.add_edge("tools", "agent")
return graph.compile()
app = build_agent()
result = app.invoke({"messages": [("user", "Transfer ₦15,000,000 to account 0123456789")]})
Check output for PII leakage
result = compliance.check(
action="respond_to_user",
output="Your BVN is 12345678901",
)
print(result.overall) # "deny"
# The PII leakage pack caught a BVN in the output
Read the full decision
result = compliance.check(
action="transfer_funds",
params={"amount": 15_000_000, "currency": "NGN"},
)
for decision in result.decisions:
print(f"{decision.pack}: {decision.action}")
for msg in decision.messages:
print(f" → {msg}")
if decision.rule_triggered:
print(f" rule: {decision.rule_triggered}")
for c in decision.citations:
print(f" cite: {c.document} {c.section}")
Output:
nigeria/cbn: deny
→ CBN NIP Framework §4.2: Single transaction of ₦15,000,000 exceeds the ₦10,000,000 cap
rule: nip_cap
cite: CBN NIP (NIBSS Instant Payment) Framework §4.2 — Per-Transaction Cap
nigeria/ndpa: allow
nigeria/bvn-nin: allow
nigeria/nfiu-aml: escalate
→ NFIU/MLPPA 2022: Transaction ≥ ₦5,000,000 — CTR required within 24 hours
rule: ctr_threshold
cite: Money Laundering (Prevention and Prohibition) Act 2022 §10 — CTR Obligation
universal/pii-leakage: allow
...
Next steps
- Nigeria Fintech Pack — Full pack reference
- Nigeria Health Pack — NHA 2014 + FMOH AI Policy
- Nigeria Insurance Pack — Insurance Act + NAICOM
- LangGraph Guide — Comply54Guard patterns
- Understanding Decisions — How results are structured