Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Agentic AI Fraud Detection System

An end-to-end AI fraud detection platform combining machine learning, explainable AI, LLM-powered investigation, and a real-time monitoring dashboard.

This project demonstrates how modern financial institutions detect and investigate suspicious transactions using multi-agent AI systems.


Key Highlights

  • Machine Learning Fraud Detection Model (XGBoost)
  • Explainable AI using SHAP
  • LLM-powered Investigation Agent
  • Multi-Agent Architecture
  • FastAPI Fraud Detection API
  • Real-time Monitoring Dashboard (Streamlit)

The system automatically:

  1. Detects suspicious transactions
  2. Explains why they are suspicious
  3. Generates investigation summaries
  4. Displays alerts in a monitoring dashboard

System Architecture

Transaction


Detection Agent (XGBoost ML Model)


Explainability Engine (SHAP)


Investigation Agent (LLM)


Decision Agent (Fraud Policy Engine)


Fraud Monitoring Dashboard
architechture

Technology Stack

Layer Technology
ML Model XGBoost
Explainability SHAP
API FastAPI
Dashboard Streamlit
LLM Agent OpenAI
Data Processing Pandas / NumPy
Deployment Uvicorn

Multi-Agent Design

This project implements 3 cooperating AI agents.

1. Detection Agent

  • Predicts fraud probability using XGBoost
  • Uses behavioral features such as velocity and spending patterns

2. Investigation Agent

  • Uses LLM reasoning to explain suspicious transactions
  • Converts SHAP signals into analyst-friendly explanations

Example:

Transaction flagged because the transaction amount is significantly higher than the user's typical spending behavior and multiple transactions occurred within a short time window.

3. Decision Agent

Applies fraud policy rules:

score > 0.7 → BLOCK
0.4–0.7 → INVESTIGATE
< 0.4 → APPROVE

Monitoring Dashboard

The Streamlit dashboard allows fraud analysts to:

  • Input transaction details
  • View fraud risk scores
  • See automated investigation summaries
  • Visualize risk features

Example output:

Fraud Probability: 0.82
Decision: BLOCK
Reason: Unusual transaction amount and abnormal transaction velocity

streamlit_fraud_detection_system


Fraud Features Used

The model uses behavioral features such as:

TransactionAmt
txn_count_1h
txn_count_24h
txn_count_7d
avg_amt_1h
avg_amt_24h
avg_amt_7d
max_amt_24h
amount_zscore_24h
velocity_risk
is_night_txn

These capture transaction velocity, spending deviation, and behavioral anomalies .


Example API Request

POST /predict_fraud

Request:

{
"TransactionAmt": 500,
"txn_count_1h": 5,
"txn_count_24h": 20,
"txn_count_7d": 40,
"avg_amt_1h": 30,
"avg_amt_24h": 35,
"avg_amt_7d": 28,
"max_amt_24h": 70,
"amount_zscore_24h": 4.5,
"velocity_risk": 0.85,
"is_night_txn": 1
}

Response:

{
"fraud_probability": 0.83,
"decision": "BLOCK",
"investigation_summary": "The transaction amount is significantly higher than the user's normal spending pattern and multiple transactions occurred within a short time window."
}

fraud_prediction_fastapi_1

fraud_prediction_fastapi_2

fraud_prediction_fastapi_3

OpenAI Multi-Agent Response

openai_multi-agent_response_investigate


How to Run the Project

1. Install dependencies

pip install -r requirements.txt

2. Start the Fraud Detection API

uvicorn api.app:app --reload

3. Launch the Dashboard

streamlit run dashboard/dashboard.py

Open:

http://localhost:8501

Future Improvements

  • Real-time streaming fraud detection
  • Fraud graph network analysis
  • Reinforcement learning fraud policies
  • Automated case management system

Author

Kirti Sinha

Data AI Professional

Passionate about building AI systems that solve real business problems in finance and banking.

About

This project analyzes 284,000+ banking transactions to detect suspicious activity using time-series anomaly detection and an Agentic AI investigation workflow.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Contributors

Languages