# deepesh611/multi-agent-fraud-detection-system architecture

> Architecture diagram of the GitHub repository deepesh611/multi-agent-fraud-detection-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/deepesh611/multi-agent-fraud-detection-system
- Repository: https://github.com/deepesh611/multi-agent-fraud-detection-system

## Overview

This is an insurance-claim fraud detection and analysis product. Its main workflow takes claim data through feature engineering, rule-based detection, LLM investigation, and business-friendly explanation; the Streamlit interface supports dashboard exploration and natural-language questions. A separate RAG path builds embeddings from stored claims and combines retrieval with database queries to answer questions. The README documents the end-to-end data pipeline; sampled source confirms several agent calls and storage operations. Some UI and vector-index details are documented but not fully shown in the excerpts.

Main entry points: [`data/processed/fraud_detection.db`](https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/data/processed/fraud_detection.db) (Fraud SQLite Store), [`src/orchestrator.py`](https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/orchestrator.py) (Agent Orchestrator), [`src/agents/query_agent.py`](https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/agents/query_agent.py) (RAG Query Agent), [`src/utils/llm_client.py`](https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/utils/llm_client.py) (LLM Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User Interface"]
  node_ui["Streamlit Dashboard<br/>[app.py]"]
  node_ui_utils["Dashboard Analytics<br/>[ui_utils.py]"]
end

subgraph group_workflow["Fraud Workflow"]
  node_orchestrator["Agent Orchestrator<br/>[orchestrator.py]"]
  node_rules["Fraud Rules<br/>[rules.py]"]
  node_investigation["Claim Investigator"]
  node_explanation["Fraud Explanation"]
  node_query["RAG Query Agent<br/>[query_agent.py]"]
end

subgraph group_data["Data and Retrieval"]
  node_generator["Claims Generator<br/>[generator.py]"]
  node_etl["Claims ETL<br/>[etl.py]"]
  node_database[("Fraud SQLite Store<br/>[fraud_detection.db]")]
  node_sql_agent["SQL Query Helper<br/>[sql_agent.py]"]
  node_embeddings["Embedding Builder<br/>[embeddings.py]"]
  node_vector_store[("Fraud Vector Store<br/>[vector_store.py]")]
end

subgraph group_services["AI Services"]
  node_llm_client["LLM Client<br/>[llm_client.py]"]
  node_openrouter{{"OpenRouter LLM"}}
end

node_user(("Analyst"))

node_user -->|"uses"| node_ui
node_ui -->|"loads analytics"| node_ui_utils
node_ui -->|"submits queries"| node_orchestrator
node_ui_utils -->|"creates"| node_orchestrator
node_generator -->|"produces claims for"| node_etl
node_etl -->|"writes tables"| node_database
node_database -->|"provides claims to"| node_rules
node_rules -->|"stores fraud flags"| node_database
node_orchestrator -->|"runs detection"| node_rules
node_orchestrator -->|"investigates cases"| node_investigation
node_orchestrator -->|"generates reports"| node_explanation
node_orchestrator -->|"routes questions"| node_query
node_investigation -->|"reads claim context"| node_database
node_explanation -->|"reads fraud findings"| node_database
node_investigation -->|"requests analysis"| node_llm_client
node_explanation -->|"requests explanation"| node_llm_client
node_embeddings -->|"reads claim records"| node_database
node_embeddings -.->|"builds retrieval data"| node_vector_store
node_query -->|"retrieves cases"| node_vector_store
node_query -->|"executes statistics query"| node_sql_agent
node_sql_agent -->|"queries records"| node_database
node_query -->|"composes answers"| node_llm_client
node_llm_client -->|"sends chat requests"| node_openrouter

click node_ui "https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/app/app.py"
click node_ui_utils "https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/app/ui_utils.py"
click node_orchestrator "https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/orchestrator.py"
click node_generator "https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/data/generator.py"
click node_etl "https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/data/etl.py"
click node_database "https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/data/processed/fraud_detection.db"
click node_rules "https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/fraud/rules.py"
click node_investigation "https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/agents/investigation_agent.py"
click node_explanation "https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/agents/explanation_agent.py"
click node_query "https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/agents/query_agent.py"
click node_sql_agent "https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/agents/sql_agent.py"
click node_embeddings "https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/rag/embeddings.py"
click node_vector_store "https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/rag/vector_store.py"
click node_llm_client "https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/utils/llm_client.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ui,node_ui_utils toneBlue
class node_orchestrator,node_rules,node_investigation,node_explanation,node_query toneAmber
class node_generator,node_etl,node_database,node_sql_agent,node_embeddings,node_vector_store toneMint
class node_llm_client,node_openrouter toneRose
class node_user toneIndigo
```

## Components

### User Interface

- [Streamlit Dashboard](https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/app/app.py): `src/app/app.py`
- [Dashboard Analytics](https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/app/ui_utils.py): `src/app/ui_utils.py`

### Fraud Workflow

- [Agent Orchestrator](https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/orchestrator.py): `src/orchestrator.py`
- [Fraud Rules](https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/fraud/rules.py): `src/fraud/rules.py`
- [Claim Investigator](https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/agents/investigation_agent.py): `src/agents/investigation_agent.py`
- [Fraud Explanation](https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/agents/explanation_agent.py): `src/agents/explanation_agent.py`
- [RAG Query Agent](https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/agents/query_agent.py): `src/agents/query_agent.py`

### Data and Retrieval

- [Claims Generator](https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/data/generator.py): `src/data/generator.py`
- [Claims ETL](https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/data/etl.py): `src/data/etl.py`
- [Fraud SQLite Store](https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/data/processed/fraud_detection.db): `data/processed/fraud_detection.db`
- [SQL Query Helper](https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/agents/sql_agent.py): `src/agents/sql_agent.py`
- [Embedding Builder](https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/rag/embeddings.py): `src/rag/embeddings.py`
- [Fraud Vector Store](https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/rag/vector_store.py): `src/rag/vector_store.py`

### AI Services

- [LLM Client](https://github.com/deepesh611/multi-agent-fraud-detection-system/blob/main/src/utils/llm_client.py): `src/utils/llm_client.py`
- **OpenRouter LLM**

### Other components

- **Analyst**

## Connections

- Analyst → Streamlit Dashboard: uses (evidence: `README.md`)
- Streamlit Dashboard → Dashboard Analytics: loads analytics (evidence: `src/app/app.py`)
- Streamlit Dashboard → Agent Orchestrator: submits queries (evidence: `src/app/app.py`)
- Dashboard Analytics → Agent Orchestrator: creates (evidence: `src/app/ui_utils.py`)
- Claims Generator → Claims ETL: produces claims for (evidence: `README.md`)
- Claims ETL → Fraud SQLite Store: writes tables (evidence: `README.md`)
- Fraud SQLite Store → Fraud Rules: provides claims to (evidence: `src/fraud/rules.py`)
- Fraud Rules → Fraud SQLite Store: stores fraud flags (evidence: `src/fraud/rules.py`)
- Agent Orchestrator → Fraud Rules: runs detection (evidence: `src/orchestrator.py`)
- Agent Orchestrator → Claim Investigator: investigates cases (evidence: `src/orchestrator.py`)
- Agent Orchestrator → Fraud Explanation: generates reports (evidence: `src/orchestrator.py`)
- Agent Orchestrator → RAG Query Agent: routes questions (evidence: `src/orchestrator.py`)
- Claim Investigator → Fraud SQLite Store: reads claim context (evidence: `src/agents/investigation_agent.py`)
- Fraud Explanation → Fraud SQLite Store: reads fraud findings (evidence: `src/agents/explanation_agent.py`)
- Claim Investigator → LLM Client: requests analysis (evidence: `src/agents/investigation_agent.py`)
- Fraud Explanation → LLM Client: requests explanation (evidence: `src/agents/explanation_agent.py`)
- Embedding Builder → Fraud SQLite Store: reads claim records (evidence: `src/rag/embeddings.py`)
- Embedding Builder → Fraud Vector Store: builds retrieval data (evidence: `README.md`)
- RAG Query Agent → Fraud Vector Store: retrieves cases (evidence: `src/agents/query_agent.py`)
- RAG Query Agent → SQL Query Helper: executes statistics query (evidence: `src/agents/query_agent.py`)
- SQL Query Helper → Fraud SQLite Store: queries records (evidence: `src/agents/sql_agent.py`)
- RAG Query Agent → LLM Client: composes answers (evidence: `src/agents/query_agent.py`)
- LLM Client → OpenRouter LLM: sends chat requests (evidence: `src/utils/llm_client.py`)
