Skip to content

Repository files navigation

FraudAI Agent

FraudAI Agent

AI-powered multi-agent platform for banking fraud detection and AI red teaming in FinTech

Python LangGraph FastAPI Next.js Qdrant Tests Coverage License


What is FraudAI Agent?

A Level 3 agentic AI platform (advisory + analysis + execution) that simulates a fraud investigation law firm. Six specialized AI agents — inspired by the characters of Suits — collaborate to detect fraud, ensure regulatory compliance, investigate criminal networks, and red-team AI systems.

Unlike simple LLM wrappers, FraudAI agents execute real tools: analyze transaction datasets, generate compliance reports, build fraud network graphs, and run adversarial attacks against ML models — all inside sandboxed Docker containers.

Agents

Agent Role Personality
Donna Paulsen Router Classifies intent, routes to the right specialist
Harvey Specter Transaction Fraud Detection Direct, confident. Analyzes transactions, detects anomalies, scores risk
Louis Litt AML / KYC / Compliance Meticulous. Cites exact legal articles, generates SAR reports
Jessica Pearson Fraud Intelligence Strategic. Network graph analysis, identity resolution
Mike Ross AI Red Teaming Creative. Adversarial attacks, prompt injection testing
Rachel Zane Data Engineering Rigorous. ETL pipelines, feature engineering, data quality

Architecture

Architecture

Key components:

  • LangGraph StateGraph orchestrates agent routing with conversational continuity
  • RAG pipeline with 35K+ Spanish legal documents from the BOE (Official State Gazette)
  • Qdrant vector database with hybrid search (dense BGE-M3 + sparse BM25)
  • Sandboxed execution via ephemeral Docker containers (cap_drop=ALL, network isolation)
  • Groq/Anthropic LLM with multi-provider support and 3-tier routing fallback
  • JWT authentication with RBAC per tier (Free/Pro/Enterprise)
  • Prometheus + Grafana monitoring with 23 alert rules

Tech Stack

Layer Technology
LLM Orchestration LangGraph, LangChain
LLM Providers Groq, Anthropic Claude, Ollama (local)
Vector DB Qdrant (hybrid search)
Embeddings BGE-M3 (1024-dim, multilingual)
Backend FastAPI, Python 3.11+
Frontend Next.js 14, React, Tailwind CSS
Auth JWT (PyJWT) with OAuth2
Sandbox Docker containers with seccomp
Monitoring Prometheus, Grafana
CI/CD GitHub Actions (lint, typecheck, test, docker, security)
Database SQLite (sessions/feedback), Qdrant (vectors)

Quick Start

Prerequisites

  • Docker + Docker Compose
  • Python 3.11+
  • Node.js 20+ with pnpm
  • A Groq API key (get one free)

1. Clone and configure

git clone https://github.com/adrianinfantes/FraudAI-Agent.git
cd FraudAI-Agent
cp .env.example .env
# Edit .env and add your GROQ_API_KEY

2. Start infrastructure

docker compose up -d  # Qdrant + Ollama

3. Install and run backend

uv sync --dev
uv run python -m uvicorn fraudai.api.app:create_app --factory --host 0.0.0.0 --port 8000

4. Install and run frontend

cd frontend && pnpm install && pnpm dev

5. Open the app

6. (Optional) Index Spanish legal corpus

uv run python -m fraudai.ingestion --mode full

Project Structure

src/fraudai/
  agents/          # 6 agent definitions, prompts, LangGraph orchestration
  api/             # FastAPI endpoints, auth, session management
  core/            # Config, database, metrics, tracing
  evaluation/      # RAGAS benchmark (50 questions, 5 categories)
  ingestion/       # BOE download pipeline, text extraction, chunking
  rag/             # Retriever, reranker, prompt templates
  tools/           # Sandbox engine, tool implementations

frontend/          # Next.js 14 chat UI with SSE streaming
monitoring/        # Prometheus alerts, Grafana dashboards
docs/              # ADRs, requirements, API reference, runbook
tests/             # 482 unit + 23 live smoke tests

Documentation

Document Description
Requirements (F0) Business, user, system, and ML requirements
Architecture Decisions (F0.5) 6 ADRs: LLM strategy, vector DB, LangGraph, sandboxing, deployment
Backlog (F0.5) 74 user stories, 8 sprints, MVP scope
Technical Spec (F2) Metrics, baselines, SLAs, fairness evaluation
API Reference (F6) All endpoints with curl examples
Deployment Guide (F6) Prerequisites, config, production deploy
Operations Runbook (F6) Common issues, rollback, scaling

Testing

# Unit + integration tests (482 tests, 93% coverage)
uv run python -m pytest tests/ -q

# Live smoke tests (requires running backend)
./scripts/smoke-test.sh

# Coverage report
uv run python -m pytest tests/ --cov=fraudai --cov-report=html

Key Design Decisions

  • Hybrid LLM routing: Keywords (instant) -> Groq API (200ms) -> Ollama (fallback)
  • Conversational continuity: Follow-up messages stay with the current agent
  • RAG with auto-filtering: Mentions of specific laws trigger metadata filters
  • Security-first sandbox: All code execution in Docker with dropped capabilities
  • HITL for red teaming: Mike Ross requires explicit user approval before offensive actions

Status

This is a portfolio project demonstrating AI agent architecture for FinTech fraud detection. It is functional and tested but not production-deployed.

What works:

  • All 6 agents respond with domain expertise
  • RAG with 35K+ BOE legal documents
  • Conversational multi-turn sessions
  • Agent routing and override
  • JWT authentication
  • SQLite persistence
  • Prometheus metrics

Author

Adrian Infantes — Senior AI Engineer specializing in FinTech, fraud detection, and AI red teaming.


License

MIT License. See LICENSE.

About

AI-powered multi-agent platform for banking fraud detection and AI red teaming in FinTech

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages