Compliance black box for AI agents - RBI FREE-AI, PMLA 2002, and KYC compliance monitoring
Project description
🛡️ AgentBridge SDK
Compliance Black Box for AI Agents in Indian Fintech
AgentBridge provides transparent compliance monitoring for AI agents operating in Indian financial services, automatically enforcing:
- RBI FREE-AI Framework (2025) - All 7 Sutras
- PMLA 2002 - Anti-Money Laundering
- KYC Master Direction - Customer verification requirements
🚀 Quick Start
Installation
pip install agentbridge
Basic Usage
from agentbridge import monitor
# Your existing AI agent
class LoanApprovalAgent:
def approve_loan(self, amount, kyc_verified, reasoning):
# Your approval logic
return {"status": "approved", "amount": amount}
# Wrap with AgentBridge (2 lines!)
agent = LoanApprovalAgent()
monitored_agent = monitor(agent, api_key="ab_your_key_here")
# Use exactly like before
result = monitored_agent.approve_loan(
amount=45000,
kyc_verified=True,
reasoning="Verified income ₹80k/month, CIBIL 750+"
)
That's it! Your agent now has:
- ✅ Real-time compliance enforcement
- ✅ Behavioral drift detection
- ✅ Structuring pattern monitoring
- ✅ Automated audit logging
- ✅ AI-powered risk analysis
📊 What You Get
1. Behavioral Drift Detection
Automatically flags when your agent's decision-making patterns change:
{
"behavioral_drift": {
"status": "drift_detected",
"finding_count": 2,
"findings": [
{
"signal": "approval_rate",
"previous": "45%",
"recent": "78%",
"delta": "+33%",
"severity": "high"
}
]
}
}
2. Structuring Detection
Catches money laundering patterns like:
- Transactions just below ₹50,000 threshold
- Repeated identical amounts
- Velocity bursts (rapid-fire approvals)
- Cross-customer smurfing
{
"structuring_detected": {
"findings": [
{
"pattern": "threshold_structuring",
"severity": "high",
"description": "8 approvals between ₹40,000–₹49,999",
"str_trigger": true // STR filing required
}
]
}
}
3. AI-Powered Analysis
Groq LLM analyzes patterns and generates compliance reports:
{
"ai_analysis": {
"drift_narrative": "Agent showing increased leniency...",
"structuring_narrative": "Threshold avoidance pattern detected...",
"recommended_action": "escalate",
"compliance_officer_notes": "Review last 50 decisions..."
}
}
🔧 Advanced Configuration
Enable Verbose Logging
monitored_agent = monitor(
agent,
api_key="ab_xxx",
verbose=True # Print detailed compliance checks
)
Output:
[AgentBridge] Monitoring agent: LoanApprovalAgent
[AgentBridge] Session ID: sess_a3f9b21c
[AgentBridge] Checking compliance for approve_loan...
Action: approve
Amount: ₹45,000
KYC: True
Verdict: APPROVE
Risk: LOW
[AgentBridge] ✓ Compliance passed (120ms)
Custom Session Tracking
monitored_agent = monitor(
agent,
api_key="ab_xxx",
session_id="loan_batch_2024_04", # Track related decisions
agent_id="production_agent_v2" # Identify agent version
)
Disable Strict Mode (Allow execution on errors)
monitored_agent = monitor(
agent,
api_key="ab_xxx",
strict_mode=False # Don't block on gateway errors
)
🎯 Use Cases
1. Loan Approval Agents
@monitor(api_key="ab_xxx")
class LoanAgent:
def decide(self, application):
# Your ML model
score = self.model.predict(application)
if score > 0.7:
return self.approve(
amount=application.amount,
kyc_verified=application.kyc_done,
reasoning=f"ML score: {score}, verified income"
)
2. Transaction Monitoring
monitored_monitor = monitor(TransactionMonitor(), api_key="ab_xxx")
for txn in transactions:
result = monitored_monitor.classify_transaction(
amount=txn.amount,
confidence=0.92,
reasoning="Pattern matches known laundering typology"
)
if result['verdict'] == 'reject':
# Automatically blocked by compliance rules
flag_for_investigation(txn)
3. KYC Verification
kyc_agent = monitor(KYCAgent(), api_key="ab_xxx")
verification = kyc_agent.verify_customer(
pan="ABCDE1234F",
aadhaar_verified=True,
reasoning="Documents verified via DigiLocker"
)
🔐 Security & Privacy
- End-to-end encryption for all gateway communication
- Zero data retention option available
- On-premise deployment for regulated entities
- Role-based access control for audit logs
📈 Dashboard & Reporting
Access your compliance dashboard at https://agentbridge.in/dashboard
- Real-time decision monitoring
- Behavioral drift alerts
- Structuring pattern reports
- AI-generated compliance summaries
- Downloadable audit trails (PDF/CSV)
🛠️ API Reference
monitor(agent, api_key, **options)
Wrap an agent with compliance monitoring.
Parameters:
agent(Any): Your AI agent instanceapi_key(str): AgentBridge API keybase_url(str): Gateway URL (default: production)session_id(str): Optional session identifieragent_id(str): Optional agent identifierenable_behavioral_analysis(bool): Enable drift detection (default: True)enable_structuring_detection(bool): Enable pattern detection (default: True)strict_mode(bool): Raise errors on violations (default: True)verbose(bool): Print detailed logs (default: False)
Returns: Wrapped agent with compliance enforcement
Raises:
ComplianceError: When decision violates compliance rulesAuthenticationError: Invalid API keyAgentBridgeError: Gateway communication errors
🧪 Testing
# Install dev dependencies
pip install agentbridge[dev]
# Run tests
pytest tests/
# Type checking
mypy agentbridge/
📝 License
MIT License - see LICENSE file
🤝 Support
- Email: support@nova.team
- Docs: https://docs.agentbridge.in
- Issues: https://github.com/nova-tech/agentbridge/issues
🎉 About
Built by NOVA • Designed for Indian fintech compliance
Get your API key: https://agentbridge.in/signup
Read the docs: https://docs.agentbridge.in
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentbridge_build_sdk-0.6.0-py3-none-any.whl.
File metadata
- Download URL: agentbridge_build_sdk-0.6.0-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccdf287a75437c057ab468419dc0020e2a48076c54e2dee7041a78a59aaf7023
|
|
| MD5 |
aa4776ec63d76dd7513e2fd951167e8f
|
|
| BLAKE2b-256 |
fff0449d365d5282ab0f035936095e3fc1ce6ff19a91af62f55b946f74b0487c
|