langchain-comply54 0.3.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.
@@ -0,0 +1,204 @@
1
+ Metadata-Version: 2.4
2
+ Name: langchain-comply54
3
+ Version: 0.3.0
4
+ Summary: LangChain / LangGraph integration for comply54 — African AI agent compliance enforcement
5
+ Author-email: Oluwajuwon Omotayo <ginuxtechacademy@gmail.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://comply54.io/langchain
8
+ Project-URL: Repository, https://github.com/comply54/langchain-comply54
9
+ Project-URL: Issues, https://github.com/comply54/langchain-comply54/issues
10
+ Project-URL: Changelog, https://github.com/comply54/langchain-comply54/blob/main/CHANGELOG.md
11
+ Keywords: langchain,langgraph,comply54,africa,compliance,ai-governance,guardrails,ndpa,cbn,fintech,data-protection,nigeria,kenya,opa,rego
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Topic :: Security
15
+ Classifier: Topic :: Office/Business :: Financial
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/markdown
23
+ Requires-Dist: comply54[langgraph]>=0.3.0
24
+
25
+ # langchain-comply54
26
+
27
+ LangChain and LangGraph integration for [comply54](https://comply54.io) — runtime compliance enforcement for AI agents operating under African data protection and financial-sector regulations.
28
+
29
+ ## Overview
30
+
31
+ `langchain-comply54` wraps the comply54 policy engine as a first-class LangGraph node and LangChain tool. It intercepts agent tool calls **before execution**, evaluates them against African regulatory frameworks (NDPA 2023, CBN, NFIU, Ghana DPA, Kenya DPA, and 15+ more), and either blocks the call or lets it through — all in-process, with no OPA binary or external service required.
32
+
33
+ ```
34
+ Agent → Comply54Guard → [deny] → ToolMessage error back to agent
35
+ → [allow] → Tools execute normally
36
+ ```
37
+
38
+ ## Installation
39
+
40
+ ```bash
41
+ pip install langchain-comply54
42
+ ```
43
+
44
+ ## Quick Start — LangGraph Guard Node
45
+
46
+ The recommended pattern is `Comply54Guard` as a pre-execution node in a LangGraph ReAct graph:
47
+
48
+ ```python
49
+ from langchain_comply54 import Comply54Guard, comply54_route
50
+ from comply54.sectors import NigeriaFintechCompliance
51
+ from langgraph.graph import StateGraph, MessagesState, END
52
+ from langgraph.prebuilt import ToolNode
53
+
54
+ # 1. Build your tools and agent as normal
55
+ tools = [transfer_funds_tool, lookup_account_tool]
56
+ tool_node = ToolNode(tools)
57
+ agent_node = build_agent(tools) # your LLM + tools
58
+
59
+ # 2. Create the guard
60
+ guard = Comply54Guard(
61
+ NigeriaFintechCompliance(),
62
+ context={"kyc_tier": 3, "customer_verified": True},
63
+ )
64
+
65
+ # 3. Wire it into the graph between agent and tools
66
+ graph = StateGraph(MessagesState)
67
+ graph.add_node("agent", agent_node)
68
+ graph.add_node("comply54_guard", guard)
69
+ graph.add_node("tools", tool_node)
70
+
71
+ graph.set_entry_point("agent")
72
+ graph.add_conditional_edges("agent", should_continue,
73
+ {"comply54_guard": "comply54_guard", END: END})
74
+ graph.add_conditional_edges("comply54_guard", comply54_route,
75
+ {"tools": "tools", "agent": "agent"})
76
+ graph.add_edge("tools", "agent")
77
+
78
+ app = graph.compile()
79
+ ```
80
+
81
+ When the agent attempts a tool call that violates compliance policy, `Comply54Guard` injects a `ToolMessage` with a structured denial that the agent can explain to the user:
82
+
83
+ ```json
84
+ {
85
+ "blocked": true,
86
+ "decision": "deny",
87
+ "reason": "CBN NIP Framework: single transfer of ₦15,000,000 exceeds the ₦10,000,000 per-transaction cap",
88
+ "regulation": "CBN Transaction Limits & Controls",
89
+ "audit_id": "a3f2c1d4-...",
90
+ "jurisdictions": ["NG"]
91
+ }
92
+ ```
93
+
94
+ ## Compliance Decision Outcomes
95
+
96
+ Every evaluation returns one of four outcomes:
97
+
98
+ | Decision | Meaning | Guard behaviour |
99
+ |---|---|---|
100
+ | `allow` | All checks passed | Tool executes normally |
101
+ | `audit` | Action logged for regulatory trail | Tool executes; state gets `compliance_result` |
102
+ | `escalate` | Elevated-risk action — human review recommended | Tool executes by default; blocked if `block_on_escalate=True` |
103
+ | `deny` | Hard regulatory violation | Tool blocked; agent receives structured `ToolMessage` error |
104
+
105
+ ## Available Sector Packs
106
+
107
+ | Import | Jurisdictions | Key Regulations |
108
+ |---|---|---|
109
+ | `NigeriaFintechCompliance` | NG | NDPA 2023, CBN NIP (₦10M cap), NFIU AML/CFT, BVN/NIN |
110
+ | `NigeriaHealthCompliance` | NG | NDPA 2023, NHA, NHIA — patient data & health records |
111
+ | `NigeriaInsuranceCompliance` | NG | NDPA 2023, NIIRA 2025 (replaces Insurance Act 2003) |
112
+ | `KenyaFintechCompliance` | KE | Kenya Data Protection Act 2019, CBK guidelines |
113
+ | `PanAfricanCompliance` | NG, KE, GH, RW, EG, MU, ZA, TZ, UG | 9-jurisdiction pack |
114
+
115
+ ```python
116
+ from comply54.sectors import (
117
+ NigeriaFintechCompliance,
118
+ NigeriaHealthCompliance,
119
+ NigeriaInsuranceCompliance,
120
+ KenyaFintechCompliance,
121
+ PanAfricanCompliance,
122
+ )
123
+ ```
124
+
125
+ ## Patterns
126
+
127
+ ### Block on escalate
128
+
129
+ ```python
130
+ guard = Comply54Guard(
131
+ NigeriaFintechCompliance(),
132
+ block_on_escalate=True, # treat escalate as deny
133
+ )
134
+ ```
135
+
136
+ ### Per-request context from agent state
137
+
138
+ Merge dynamic context (e.g. session KYC tier, consent flags) at evaluation time:
139
+
140
+ ```python
141
+ # Set compliance_context in your agent state before the guard runs
142
+ state["compliance_context"] = {
143
+ "kyc_tier": user.kyc_tier,
144
+ "customer_verified": user.is_verified,
145
+ "consent_documented": user.has_data_transfer_consent,
146
+ }
147
+ ```
148
+
149
+ ### LangChain StructuredTool (self-check pattern)
150
+
151
+ For agents that should self-check before acting rather than being intercepted automatically:
152
+
153
+ ```python
154
+ from langchain_comply54 import comply54_tool
155
+ from comply54.sectors import NigeriaFintechCompliance
156
+
157
+ # The agent can call this tool to ask "is this action allowed?"
158
+ compliance_check = comply54_tool(NigeriaFintechCompliance())
159
+ tools = [transfer_funds_tool, compliance_check]
160
+ ```
161
+
162
+ ### Legacy state-dict node
163
+
164
+ For LangGraph graphs that pass structured state rather than messages:
165
+
166
+ ```python
167
+ from langchain_comply54 import compliance_node
168
+ from comply54.sectors import NigeriaFintechCompliance
169
+
170
+ node = compliance_node(NigeriaFintechCompliance())
171
+ # state must contain: action, params, output, context
172
+ # node writes back: compliance_result, compliance_blocked, compliance_message
173
+ ```
174
+
175
+ ## Compliance Certificate
176
+
177
+ Every evaluation produces an auditor-exportable compliance certificate:
178
+
179
+ ```python
180
+ result = guard._compliance.check(action="transfer_funds", params={"amount": 5_000_000})
181
+ cert = result.to_certificate(
182
+ sector_pack="NigeriaFintechCompliance",
183
+ jurisdictions=["NG"],
184
+ regulations=["NDPA 2023", "CBN FPR"],
185
+ )
186
+ print(cert.to_json())
187
+ ```
188
+
189
+ ## Requirements
190
+
191
+ - Python 3.9+
192
+ - `comply54[langgraph] >= 0.3.0` (installed automatically)
193
+ - No OPA binary, no Docker, no external services
194
+
195
+ ## Links
196
+
197
+ - [comply54 documentation](https://comply54.io)
198
+ - [comply54 on PyPI](https://pypi.org/project/comply54/)
199
+ - [Source repository](https://github.com/comply54/langchain-comply54)
200
+ - [African regulatory policy reference](https://github.com/kingztech2019/agt-policies-nigeria)
201
+
202
+ ## License
203
+
204
+ Apache 2.0
@@ -0,0 +1,180 @@
1
+ # langchain-comply54
2
+
3
+ LangChain and LangGraph integration for [comply54](https://comply54.io) — runtime compliance enforcement for AI agents operating under African data protection and financial-sector regulations.
4
+
5
+ ## Overview
6
+
7
+ `langchain-comply54` wraps the comply54 policy engine as a first-class LangGraph node and LangChain tool. It intercepts agent tool calls **before execution**, evaluates them against African regulatory frameworks (NDPA 2023, CBN, NFIU, Ghana DPA, Kenya DPA, and 15+ more), and either blocks the call or lets it through — all in-process, with no OPA binary or external service required.
8
+
9
+ ```
10
+ Agent → Comply54Guard → [deny] → ToolMessage error back to agent
11
+ → [allow] → Tools execute normally
12
+ ```
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ pip install langchain-comply54
18
+ ```
19
+
20
+ ## Quick Start — LangGraph Guard Node
21
+
22
+ The recommended pattern is `Comply54Guard` as a pre-execution node in a LangGraph ReAct graph:
23
+
24
+ ```python
25
+ from langchain_comply54 import Comply54Guard, comply54_route
26
+ from comply54.sectors import NigeriaFintechCompliance
27
+ from langgraph.graph import StateGraph, MessagesState, END
28
+ from langgraph.prebuilt import ToolNode
29
+
30
+ # 1. Build your tools and agent as normal
31
+ tools = [transfer_funds_tool, lookup_account_tool]
32
+ tool_node = ToolNode(tools)
33
+ agent_node = build_agent(tools) # your LLM + tools
34
+
35
+ # 2. Create the guard
36
+ guard = Comply54Guard(
37
+ NigeriaFintechCompliance(),
38
+ context={"kyc_tier": 3, "customer_verified": True},
39
+ )
40
+
41
+ # 3. Wire it into the graph between agent and tools
42
+ graph = StateGraph(MessagesState)
43
+ graph.add_node("agent", agent_node)
44
+ graph.add_node("comply54_guard", guard)
45
+ graph.add_node("tools", tool_node)
46
+
47
+ graph.set_entry_point("agent")
48
+ graph.add_conditional_edges("agent", should_continue,
49
+ {"comply54_guard": "comply54_guard", END: END})
50
+ graph.add_conditional_edges("comply54_guard", comply54_route,
51
+ {"tools": "tools", "agent": "agent"})
52
+ graph.add_edge("tools", "agent")
53
+
54
+ app = graph.compile()
55
+ ```
56
+
57
+ When the agent attempts a tool call that violates compliance policy, `Comply54Guard` injects a `ToolMessage` with a structured denial that the agent can explain to the user:
58
+
59
+ ```json
60
+ {
61
+ "blocked": true,
62
+ "decision": "deny",
63
+ "reason": "CBN NIP Framework: single transfer of ₦15,000,000 exceeds the ₦10,000,000 per-transaction cap",
64
+ "regulation": "CBN Transaction Limits & Controls",
65
+ "audit_id": "a3f2c1d4-...",
66
+ "jurisdictions": ["NG"]
67
+ }
68
+ ```
69
+
70
+ ## Compliance Decision Outcomes
71
+
72
+ Every evaluation returns one of four outcomes:
73
+
74
+ | Decision | Meaning | Guard behaviour |
75
+ |---|---|---|
76
+ | `allow` | All checks passed | Tool executes normally |
77
+ | `audit` | Action logged for regulatory trail | Tool executes; state gets `compliance_result` |
78
+ | `escalate` | Elevated-risk action — human review recommended | Tool executes by default; blocked if `block_on_escalate=True` |
79
+ | `deny` | Hard regulatory violation | Tool blocked; agent receives structured `ToolMessage` error |
80
+
81
+ ## Available Sector Packs
82
+
83
+ | Import | Jurisdictions | Key Regulations |
84
+ |---|---|---|
85
+ | `NigeriaFintechCompliance` | NG | NDPA 2023, CBN NIP (₦10M cap), NFIU AML/CFT, BVN/NIN |
86
+ | `NigeriaHealthCompliance` | NG | NDPA 2023, NHA, NHIA — patient data & health records |
87
+ | `NigeriaInsuranceCompliance` | NG | NDPA 2023, NIIRA 2025 (replaces Insurance Act 2003) |
88
+ | `KenyaFintechCompliance` | KE | Kenya Data Protection Act 2019, CBK guidelines |
89
+ | `PanAfricanCompliance` | NG, KE, GH, RW, EG, MU, ZA, TZ, UG | 9-jurisdiction pack |
90
+
91
+ ```python
92
+ from comply54.sectors import (
93
+ NigeriaFintechCompliance,
94
+ NigeriaHealthCompliance,
95
+ NigeriaInsuranceCompliance,
96
+ KenyaFintechCompliance,
97
+ PanAfricanCompliance,
98
+ )
99
+ ```
100
+
101
+ ## Patterns
102
+
103
+ ### Block on escalate
104
+
105
+ ```python
106
+ guard = Comply54Guard(
107
+ NigeriaFintechCompliance(),
108
+ block_on_escalate=True, # treat escalate as deny
109
+ )
110
+ ```
111
+
112
+ ### Per-request context from agent state
113
+
114
+ Merge dynamic context (e.g. session KYC tier, consent flags) at evaluation time:
115
+
116
+ ```python
117
+ # Set compliance_context in your agent state before the guard runs
118
+ state["compliance_context"] = {
119
+ "kyc_tier": user.kyc_tier,
120
+ "customer_verified": user.is_verified,
121
+ "consent_documented": user.has_data_transfer_consent,
122
+ }
123
+ ```
124
+
125
+ ### LangChain StructuredTool (self-check pattern)
126
+
127
+ For agents that should self-check before acting rather than being intercepted automatically:
128
+
129
+ ```python
130
+ from langchain_comply54 import comply54_tool
131
+ from comply54.sectors import NigeriaFintechCompliance
132
+
133
+ # The agent can call this tool to ask "is this action allowed?"
134
+ compliance_check = comply54_tool(NigeriaFintechCompliance())
135
+ tools = [transfer_funds_tool, compliance_check]
136
+ ```
137
+
138
+ ### Legacy state-dict node
139
+
140
+ For LangGraph graphs that pass structured state rather than messages:
141
+
142
+ ```python
143
+ from langchain_comply54 import compliance_node
144
+ from comply54.sectors import NigeriaFintechCompliance
145
+
146
+ node = compliance_node(NigeriaFintechCompliance())
147
+ # state must contain: action, params, output, context
148
+ # node writes back: compliance_result, compliance_blocked, compliance_message
149
+ ```
150
+
151
+ ## Compliance Certificate
152
+
153
+ Every evaluation produces an auditor-exportable compliance certificate:
154
+
155
+ ```python
156
+ result = guard._compliance.check(action="transfer_funds", params={"amount": 5_000_000})
157
+ cert = result.to_certificate(
158
+ sector_pack="NigeriaFintechCompliance",
159
+ jurisdictions=["NG"],
160
+ regulations=["NDPA 2023", "CBN FPR"],
161
+ )
162
+ print(cert.to_json())
163
+ ```
164
+
165
+ ## Requirements
166
+
167
+ - Python 3.9+
168
+ - `comply54[langgraph] >= 0.3.0` (installed automatically)
169
+ - No OPA binary, no Docker, no external services
170
+
171
+ ## Links
172
+
173
+ - [comply54 documentation](https://comply54.io)
174
+ - [comply54 on PyPI](https://pypi.org/project/comply54/)
175
+ - [Source repository](https://github.com/comply54/langchain-comply54)
176
+ - [African regulatory policy reference](https://github.com/kingztech2019/agt-policies-nigeria)
177
+
178
+ ## License
179
+
180
+ Apache 2.0
@@ -0,0 +1,48 @@
1
+ """
2
+ langchain-comply54
3
+ ~~~~~~~~~~~~~~~~~~
4
+ LangChain / LangGraph integration for comply54 African AI governance.
5
+
6
+ Provides:
7
+ Comply54Guard — LangGraph node that intercepts tool calls and enforces
8
+ comply54 compliance packs before execution.
9
+ comply54_route — Conditional routing function for the guard node.
10
+ comply54_tool — Wrap any SectorCompliance pack as a LangChain StructuredTool.
11
+ compliance_node — Simple state-dict node (legacy API).
12
+
13
+ Quick start:
14
+
15
+ from langchain_comply54 import Comply54Guard, comply54_route
16
+ from comply54.sectors import NigeriaFintechCompliance
17
+
18
+ guard = Comply54Guard(NigeriaFintechCompliance(), context={"kyc_tier": 3})
19
+
20
+ graph.add_node("comply54_guard", guard)
21
+ graph.add_conditional_edges(
22
+ "comply54_guard",
23
+ comply54_route,
24
+ {"tools": "tools", "agent": "agent"},
25
+ )
26
+
27
+ Installation:
28
+
29
+ pip install langchain-comply54
30
+
31
+ Docs: https://comply54.io/langchain
32
+ """
33
+
34
+ from comply54.langchain.adapter import (
35
+ Comply54Guard,
36
+ compliance_node,
37
+ comply54_route,
38
+ comply54_tool,
39
+ )
40
+
41
+ __all__ = [
42
+ "Comply54Guard",
43
+ "comply54_route",
44
+ "comply54_tool",
45
+ "compliance_node",
46
+ ]
47
+
48
+ __version__ = "0.3.0"
@@ -0,0 +1,204 @@
1
+ Metadata-Version: 2.4
2
+ Name: langchain-comply54
3
+ Version: 0.3.0
4
+ Summary: LangChain / LangGraph integration for comply54 — African AI agent compliance enforcement
5
+ Author-email: Oluwajuwon Omotayo <ginuxtechacademy@gmail.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://comply54.io/langchain
8
+ Project-URL: Repository, https://github.com/comply54/langchain-comply54
9
+ Project-URL: Issues, https://github.com/comply54/langchain-comply54/issues
10
+ Project-URL: Changelog, https://github.com/comply54/langchain-comply54/blob/main/CHANGELOG.md
11
+ Keywords: langchain,langgraph,comply54,africa,compliance,ai-governance,guardrails,ndpa,cbn,fintech,data-protection,nigeria,kenya,opa,rego
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Topic :: Security
15
+ Classifier: Topic :: Office/Business :: Financial
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/markdown
23
+ Requires-Dist: comply54[langgraph]>=0.3.0
24
+
25
+ # langchain-comply54
26
+
27
+ LangChain and LangGraph integration for [comply54](https://comply54.io) — runtime compliance enforcement for AI agents operating under African data protection and financial-sector regulations.
28
+
29
+ ## Overview
30
+
31
+ `langchain-comply54` wraps the comply54 policy engine as a first-class LangGraph node and LangChain tool. It intercepts agent tool calls **before execution**, evaluates them against African regulatory frameworks (NDPA 2023, CBN, NFIU, Ghana DPA, Kenya DPA, and 15+ more), and either blocks the call or lets it through — all in-process, with no OPA binary or external service required.
32
+
33
+ ```
34
+ Agent → Comply54Guard → [deny] → ToolMessage error back to agent
35
+ → [allow] → Tools execute normally
36
+ ```
37
+
38
+ ## Installation
39
+
40
+ ```bash
41
+ pip install langchain-comply54
42
+ ```
43
+
44
+ ## Quick Start — LangGraph Guard Node
45
+
46
+ The recommended pattern is `Comply54Guard` as a pre-execution node in a LangGraph ReAct graph:
47
+
48
+ ```python
49
+ from langchain_comply54 import Comply54Guard, comply54_route
50
+ from comply54.sectors import NigeriaFintechCompliance
51
+ from langgraph.graph import StateGraph, MessagesState, END
52
+ from langgraph.prebuilt import ToolNode
53
+
54
+ # 1. Build your tools and agent as normal
55
+ tools = [transfer_funds_tool, lookup_account_tool]
56
+ tool_node = ToolNode(tools)
57
+ agent_node = build_agent(tools) # your LLM + tools
58
+
59
+ # 2. Create the guard
60
+ guard = Comply54Guard(
61
+ NigeriaFintechCompliance(),
62
+ context={"kyc_tier": 3, "customer_verified": True},
63
+ )
64
+
65
+ # 3. Wire it into the graph between agent and tools
66
+ graph = StateGraph(MessagesState)
67
+ graph.add_node("agent", agent_node)
68
+ graph.add_node("comply54_guard", guard)
69
+ graph.add_node("tools", tool_node)
70
+
71
+ graph.set_entry_point("agent")
72
+ graph.add_conditional_edges("agent", should_continue,
73
+ {"comply54_guard": "comply54_guard", END: END})
74
+ graph.add_conditional_edges("comply54_guard", comply54_route,
75
+ {"tools": "tools", "agent": "agent"})
76
+ graph.add_edge("tools", "agent")
77
+
78
+ app = graph.compile()
79
+ ```
80
+
81
+ When the agent attempts a tool call that violates compliance policy, `Comply54Guard` injects a `ToolMessage` with a structured denial that the agent can explain to the user:
82
+
83
+ ```json
84
+ {
85
+ "blocked": true,
86
+ "decision": "deny",
87
+ "reason": "CBN NIP Framework: single transfer of ₦15,000,000 exceeds the ₦10,000,000 per-transaction cap",
88
+ "regulation": "CBN Transaction Limits & Controls",
89
+ "audit_id": "a3f2c1d4-...",
90
+ "jurisdictions": ["NG"]
91
+ }
92
+ ```
93
+
94
+ ## Compliance Decision Outcomes
95
+
96
+ Every evaluation returns one of four outcomes:
97
+
98
+ | Decision | Meaning | Guard behaviour |
99
+ |---|---|---|
100
+ | `allow` | All checks passed | Tool executes normally |
101
+ | `audit` | Action logged for regulatory trail | Tool executes; state gets `compliance_result` |
102
+ | `escalate` | Elevated-risk action — human review recommended | Tool executes by default; blocked if `block_on_escalate=True` |
103
+ | `deny` | Hard regulatory violation | Tool blocked; agent receives structured `ToolMessage` error |
104
+
105
+ ## Available Sector Packs
106
+
107
+ | Import | Jurisdictions | Key Regulations |
108
+ |---|---|---|
109
+ | `NigeriaFintechCompliance` | NG | NDPA 2023, CBN NIP (₦10M cap), NFIU AML/CFT, BVN/NIN |
110
+ | `NigeriaHealthCompliance` | NG | NDPA 2023, NHA, NHIA — patient data & health records |
111
+ | `NigeriaInsuranceCompliance` | NG | NDPA 2023, NIIRA 2025 (replaces Insurance Act 2003) |
112
+ | `KenyaFintechCompliance` | KE | Kenya Data Protection Act 2019, CBK guidelines |
113
+ | `PanAfricanCompliance` | NG, KE, GH, RW, EG, MU, ZA, TZ, UG | 9-jurisdiction pack |
114
+
115
+ ```python
116
+ from comply54.sectors import (
117
+ NigeriaFintechCompliance,
118
+ NigeriaHealthCompliance,
119
+ NigeriaInsuranceCompliance,
120
+ KenyaFintechCompliance,
121
+ PanAfricanCompliance,
122
+ )
123
+ ```
124
+
125
+ ## Patterns
126
+
127
+ ### Block on escalate
128
+
129
+ ```python
130
+ guard = Comply54Guard(
131
+ NigeriaFintechCompliance(),
132
+ block_on_escalate=True, # treat escalate as deny
133
+ )
134
+ ```
135
+
136
+ ### Per-request context from agent state
137
+
138
+ Merge dynamic context (e.g. session KYC tier, consent flags) at evaluation time:
139
+
140
+ ```python
141
+ # Set compliance_context in your agent state before the guard runs
142
+ state["compliance_context"] = {
143
+ "kyc_tier": user.kyc_tier,
144
+ "customer_verified": user.is_verified,
145
+ "consent_documented": user.has_data_transfer_consent,
146
+ }
147
+ ```
148
+
149
+ ### LangChain StructuredTool (self-check pattern)
150
+
151
+ For agents that should self-check before acting rather than being intercepted automatically:
152
+
153
+ ```python
154
+ from langchain_comply54 import comply54_tool
155
+ from comply54.sectors import NigeriaFintechCompliance
156
+
157
+ # The agent can call this tool to ask "is this action allowed?"
158
+ compliance_check = comply54_tool(NigeriaFintechCompliance())
159
+ tools = [transfer_funds_tool, compliance_check]
160
+ ```
161
+
162
+ ### Legacy state-dict node
163
+
164
+ For LangGraph graphs that pass structured state rather than messages:
165
+
166
+ ```python
167
+ from langchain_comply54 import compliance_node
168
+ from comply54.sectors import NigeriaFintechCompliance
169
+
170
+ node = compliance_node(NigeriaFintechCompliance())
171
+ # state must contain: action, params, output, context
172
+ # node writes back: compliance_result, compliance_blocked, compliance_message
173
+ ```
174
+
175
+ ## Compliance Certificate
176
+
177
+ Every evaluation produces an auditor-exportable compliance certificate:
178
+
179
+ ```python
180
+ result = guard._compliance.check(action="transfer_funds", params={"amount": 5_000_000})
181
+ cert = result.to_certificate(
182
+ sector_pack="NigeriaFintechCompliance",
183
+ jurisdictions=["NG"],
184
+ regulations=["NDPA 2023", "CBN FPR"],
185
+ )
186
+ print(cert.to_json())
187
+ ```
188
+
189
+ ## Requirements
190
+
191
+ - Python 3.9+
192
+ - `comply54[langgraph] >= 0.3.0` (installed automatically)
193
+ - No OPA binary, no Docker, no external services
194
+
195
+ ## Links
196
+
197
+ - [comply54 documentation](https://comply54.io)
198
+ - [comply54 on PyPI](https://pypi.org/project/comply54/)
199
+ - [Source repository](https://github.com/comply54/langchain-comply54)
200
+ - [African regulatory policy reference](https://github.com/kingztech2019/agt-policies-nigeria)
201
+
202
+ ## License
203
+
204
+ Apache 2.0
@@ -0,0 +1,8 @@
1
+ README.md
2
+ pyproject.toml
3
+ langchain_comply54/__init__.py
4
+ langchain_comply54.egg-info/PKG-INFO
5
+ langchain_comply54.egg-info/SOURCES.txt
6
+ langchain_comply54.egg-info/dependency_links.txt
7
+ langchain_comply54.egg-info/requires.txt
8
+ langchain_comply54.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ comply54[langgraph]>=0.3.0
@@ -0,0 +1 @@
1
+ langchain_comply54
@@ -0,0 +1,52 @@
1
+ [project]
2
+ name = "langchain-comply54"
3
+ version = "0.3.0"
4
+ description = "LangChain / LangGraph integration for comply54 — African AI agent compliance enforcement"
5
+ authors = [
6
+ { name = "Oluwajuwon Omotayo", email = "ginuxtechacademy@gmail.com" }
7
+ ]
8
+ license = "Apache-2.0"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ keywords = [
12
+ "langchain", "langgraph", "comply54", "africa", "compliance",
13
+ "ai-governance", "guardrails", "ndpa", "cbn", "fintech",
14
+ "data-protection", "nigeria", "kenya", "opa", "rego",
15
+ ]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Intended Audience :: Developers",
19
+ "Topic :: Security",
20
+ "Topic :: Office/Business :: Financial",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.9",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ ]
27
+ dependencies = [
28
+ "comply54[langgraph]>=0.3.0",
29
+ ]
30
+
31
+ [project.urls]
32
+ Homepage = "https://comply54.io/langchain"
33
+ Repository = "https://github.com/comply54/langchain-comply54"
34
+ Issues = "https://github.com/comply54/langchain-comply54/issues"
35
+ Changelog = "https://github.com/comply54/langchain-comply54/blob/main/CHANGELOG.md"
36
+
37
+ [build-system]
38
+ requires = ["setuptools>=68", "wheel"]
39
+ build-backend = "setuptools.build_meta"
40
+
41
+ [tool.setuptools.packages.find]
42
+ where = ["."]
43
+ include = ["langchain_comply54*"]
44
+
45
+ [tool.pytest.ini_options]
46
+ minversion = "8.0"
47
+ addopts = "-ra -q --tb=short"
48
+ testpaths = ["tests"]
49
+
50
+ [tool.ruff]
51
+ line-length = 100
52
+ target-version = "py39"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+