AgenThink: Autonomous SME Credit Intelligence System
An autonomous, multi-agent system for real-time SME credit scoring and Sharia-compliant financial auditing, designed for the Kuwaiti banking sector.
Overview
AgenThink is a production-grade FinTech solution that orchestrates 20 specialized AI agents to perform comprehensive due diligence on Small and Medium-sized Enterprises (SMEs). The system automates data collection, financial analysis, Sharia governance audits, and adversarial validation to deliver a reliable, auditable credit recommendation in minutes, not days.
This system is built for easy white-label deployment by financial institutions, particularly those in the Islamic banking sector like Kuwait Finance House (KFH) and Warba Bank.
Core Features
- Autonomous Multi-Agent System: Leverages a swarm of 20 specialized agents for parallel processing and deep analysis.
- Real-Time Data Aggregation: Crawls official government sources, financial news, social media, and Open Banking APIs.
- Comprehensive Financial Analysis: Calculates key metrics including Debt-to-Equity, Cash Flow, Burn Rate, and generates financial projections.
- Sharia Governance Engine: Audits business activities and financial structures against AAOIFI standards, flagging non-compliant income sources like Riba (interest).
- Adversarial Red Team Auditing: Includes two dedicated agents to scrutinize the outputs of all other agents for hallucinations, inconsistencies, and factual errors.
- Human-in-the-Loop (HITL) Gate: Automatically escalates high-risk or non-compliant cases for mandatory human review.
- CBK Compliance: Engineered to meet the stringent requirements of the Central Bank of Kuwait (CBK) Cybersecurity Framework.
- Full Audit Trail: Logs every agent action in a tamper-evident, hash-chained log for complete transparency and regulatory compliance.
System Architecture
The system is built around a Chief Orchestrator that manages a state machine workflow, passing SME data through four distinct agent swarms in a structured pipeline.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CHIEF ORCHESTRATOR β
β β
β ββββββββββββββββ βββββββββββββββββββ ββββββββββββββββββββ β
β β DATA SWARM β β FINANCIAL SWARM β β SHARIA SWARM β β
β β (8 Agents) ββ β (6 Agents) ββ β (4 Agents) β β
β ββββββββββββββββ βββββββββββββββββββ ββββββββββββββββββββ β
β β β
β βββββββββββΌβββββββββββ β
β β RED TEAM AUDITORS β β
β β (2 Agents) β β
β βββββββββββ¬βββββββββββ β
β β β
β βββββββββββΌβββββββββββ β
β β HITL GATE (if β β
β β high-risk) β β
β βββββββββββ¬βββββββββββ β
β β β
β βββββββββββΌβββββββββββ β
β β FINAL DECISION β β
β ββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Agent Swarms
The 20 agents are organized into four specialized swarms:
| Swarm | # of Agents | Primary Function |
|---|---|---|
| Data Swarm | 8 | Parallel data crawling from official registries, news, social, and banking APIs. |
| Financial Analysis Swarm | 6 | Calculation of financial ratios, credit scoring, and future projections. |
| Sharia Governance Swarm | 4 | Auditing against AAOIFI standards and identifying non-compliant revenue streams. |
| Red Team Auditors | 2 | Adversarial validation, hallucination detection, and final output verification. |
Technical Stack
- Framework: Python 3.11+
- Orchestration: LangGraph-style state machine
- AI Agents: CrewAI / Custom Agent implementation with OpenAI GPT-4.1-mini
- Vector Database: ChromaDB (default, local) / Pinecone (production, cloud)
- Data Handling: Pandas, NumPy
- Security: Cryptography (AES-256-GCM), Bcrypt
- Testing: Pytest, Pytest-Cov, Mock
Compliance
AgenThink is designed with regulatory compliance at its core.
- Central Bank of Kuwait (CBK): Adheres to the CBK Cybersecurity Framework, including requirements for data encryption, access control, audit logging (with a tamper-evident hash chain), and data residency.
- AAOIFI: The Sharia Governance Swarm cross-references all business activities and financing structures against the standards published by the Accounting and Auditing Organization for Islamic Financial Institutions.
Getting Started
Prerequisites
- Python 3.11+
pipandvirtualenv
Installation
Clone the repository:
git clone https://github.com/your-org/AgenThink-SME-Lending.git cd AgenThink-SME-LendingCreate and activate a virtual environment:
python3 -m venv venv source venv/bin/activateInstall the required dependencies:
pip install -r requirements.txtSet up environment variables: Copy the example environment file and fill in your API keys and configuration details.
cp .env.example .env nano .env
Configuration
The system is configured via environment variables defined in the .env file. Key variables include:
OPENAI_API_KEY: Your API key for OpenAI.VECTOR_DB_PROVIDER:chromadb(local) orpinecone(cloud).ENCRYPTION_KEY: A secret key for encrypting sensitive data at rest.X_BEARER_TOKEN: Your bearer token for the X (Twitter) API.HITL_WEBHOOK_URL: An endpoint to receive notifications for human review cases.
Usage
The system can be run directly from the command line.
python main.py --cr <CR_NUMBER> --name "<COMPANY_NAME>" --amount <FINANCING_AMOUNT>
Example
python main.py --cr 123456 --name "Future Technologies Co." --amount 150000 --output text
This will execute the full credit evaluation pipeline and print a summary of the final decision.
Testing
The project includes a comprehensive test suite using pytest. To run the tests and generate a coverage report:
pytest
This will run all unit and integration tests, and create an HTML coverage report in the coverage_report/ directory.
White-Label Deployment
To deploy AgenThink as a white-label solution for a new financial institution:
- Fork the Repository: Create a private fork of this repository for the target institution.
- Update Configuration: Modify
config/settings.jsonto adjust system-wide parameters, agent behavior, and risk thresholds. - Customize Bank APIs: Add new bank configurations to
config/settings.jsonand implement any necessary API clients in thetools/directory. - Theme and Branding: Replace the placeholder banner and update the UI/reporting templates (if applicable) with the institution's branding.
- Deploy: Deploy the application to a secure cloud environment (e.g., AWS, Azure) following the institution's infrastructure guidelines.
License
This project is licensed under the MIT License. See the LICENSE file for details.
