AI-Powered Email Fraud Detection System
SentinelAI is a comprehensive, multi-service fraud detection platform that uses advanced AI agents, RAG, and automation to identify and mitigate email-based security threats in real-time.
Deployed Webpage
Our product is live on this URL: https://sentinel-ai-seven.vercel.app/. Do note that only authorized users are granted permission to login due OAuth restrictions in development.
- ๐ค Agentic Workflow: Intelligent multi-agent system with dynamic routing based on confidence levels
- ๐ง Real-time Email Monitoring: Live Gmail integration with automatic email triage and threat detection
- ๐ Multi-format Document Processing: Drag-and-drop support for PDF and image analysis with OCR
- ๐ Vector Search & RAG: Pinecone-powered similarity search for fraud pattern matching
- ๏ฟฝ AI-Powered Chat Assistant: Context-aware chatbot for fraud analysis and cybersecurity guidance
- ๐ฏ Interactive Dashboard: Three-panel interface with email list, report viewer, and chat integration
- โก Real-time Notifications: Live email listening with instant threat alerts and processing
- ๐ Comprehensive Reports: Detailed fraud analysis with confidence scores and explanations
- ๐ Scalable Architecture: Microservices with Celery workers and Redis queuing
- ๏ฟฝ Modern UI/UX: Responsive React interface with custom color scheme and smooth animations
- Python 3.12+
- Node.js 18+ (for frontend)
- Redis Cloud (for Celery)
- Google Cloud Project (for Gmail API & Firestore)
- Pinecone Account (for vector database)
- OpenAI API Key (for AI processing)
- OCR API (for image and pdf parsing)
git clone https://github.com/clarud/SentinelAI
cd SentinelAI# Install Python dependencies
cd services
pip install -r requirements.txt
# Set up environment variables
cp .env.example .env
# Edit .env with your API keys and credentials
# Start the API server
uvicorn api.app.main:app --host 0.0.0.0 --port 8000
# In another terminal, start MCP server
cd ../mcp
uvicorn server:app --reload --host 0.0.0.0 --port 7030
# In another terminal, start Celery worker
cd ../services
celery -A worker.worker.celery_app worker --loglevel=infocd app
npm install
npm run devVisit http://localhost:8080 to access the web interface.
SentinelAI/
โโโ app/ # React Frontend (Vite + TypeScript)
โ โโโ src/
โ โ โโโ components/ # UI Components (shadcn/ui)
โ โ โโโ pages/ # Application pages
โ โ โโโ hooks/ # Custom React hooks
โ โ โโโ lib/ # Utilities and configurations
โ โโโ package.json
โ
โโโ services/ # Backend Services
โ โโโ api/ # FastAPI Application
โ โ โโโ app/
โ โ โ โโโ api/routers/ # API endpoints
โ โ โ โ โโโ gmail_oauth.py # Gmail OAuth flow
โ โ โ โ โโโ gmail_watch.py # Gmail webhook handling
โ โ โ โ โโโ jobs.py # Job management
โ โ โ โ โโโ health.py # Health checks
โ โ โ โโโ services/ # Business logic
โ โ โ โ โโโ firestore_services.py # Database operations
โ โ โ โ โโโ file_service.py # File processing
โ โ โ โโโ main.py # FastAPI app entry point
โ โ โโโ requirements.txt
โ โ
โ โโโ worker/ # Background Processing
โ โโโ worker/
โ โ โโโ agents/ # AI Agent System
โ โ โ โโโ orchestrator.py # Main workflow orchestrator
โ โ โ โโโ prompts.py # Agent prompts
โ โ โ โโโ schemas.py # Pydantic models
โ โ โโโ tasks/ # Celery tasks
โ โ โ โโโ email_task.py # Email processing tasks
โ โ โโโ tools/ # MCP Client Tools
โ โ โ โโโ mcp_client.py # MCP protocol client
โ โ โ โโโ registry.py # Tool registry
โ โ โ โโโ selector.py # Tool selection logic
โ โ โโโ celery_app.py # Celery configuration
โ โโโ requirements.txt
โ
โโโ mcp/ # Model Context Protocol Servers
โ โโโ server.py # Centralized MCP server
โ โโโ mcp/
โ โ โโโ data_processor/ # Document processing tools
โ โ โ โโโ server.py
โ โ โ โโโ tools/
โ โ โ โโโ process_email.py
โ โ โ โโโ process_pdf.py
โ โ โโโ extraction_tools/ # Data extraction tools
โ โ โ โโโ server.py
โ โ โ โโโ tools/
โ โ โ โโโ extract_link.py
โ โ โ โโโ extract_number.py
โ โ โ โโโ extract_organisation.py
โ โ โโโ gmail_tools/ # Gmail & Google Drive tools
โ โ โ โโโ server.py
โ โ โ โโโ tools/
โ โ โ โโโ gmail_tools.py
โ โ โ โโโ google_drive_tool.py
โ โ โ โโโ classify_email.py
โ โ โโโ rag_tools/ # Vector search & storage
โ โ โโโ server.py
โ โ โโโ tools/
โ โ โโโ call_rag.py
โ โ โโโ store_rag.py
โ โโโ requirements.txt
โ
โโโ database/ # Document Processing Pipeline
โ โโโ document_parser.py # Multi-format document parsing
โ โโโ data_normalizer.py # Text cleaning & normalization
โ โโโ document_chunker.py # Intelligent text chunking
โ โโโ metadata_tagger.py # Risk assessment & tagging
โ โโโ vector_indexer.py # Pinecone vector operations
โ โโโ fraud_detection_pipeline.py # Main processing pipeline
โ โโโ documents/ # Input documents
โ โโโ requirements.txt
โ
โโโ test/ # Testing Suite
โ โโโ worker/ # Worker tests
โ โโโ mcp/ # MCP server tests
โ โโโ database/ # Database pipeline tests
โ
โโโ render.yaml # Deployment configuration
โโโ README.md # This file
SentinelAI implements a sophisticated multi-agent workflow that dynamically adapts based on confidence levels:
-
๐ ROUTER Agent - Intelligent workflow orchestrator
- Analyzes initial confidence and decides optimal path
- Routes to fast-track or full analysis based on evidence
-
๐ PLANNER Agent - Tool selection strategist
- Determines which extraction tools to use
- Optimizes evidence gathering strategy
-
๐ ANALYST Agent - Evidence interpreter
- Processes all tool outputs and document content
- Calculates risk metrics and confidence scores
-
โ๏ธ SUPERVISOR Agent - Final decision maker
- Makes classification decisions based on analysis
- Provides explainable reasoning for decisions
-
โก EXECUTER Agent - Action performer
- Executes appropriate actions based on classification
- Handles Gmail labeling, reporting, and data storage
Document โ Processing โ RAG โ ROUTER โ EXECUTER
โฑ๏ธ ~8 seconds
Document โ Processing โ RAG โ ROUTER โ EXECUTER
โฑ๏ธ ~6 seconds
Document โ Processing โ RAG โ ROUTER โ PLANNER โ ANALYST โ SUPERVISOR โ EXECUTER
โฑ๏ธ ~25 seconds
Document โ Processing โ RAG โ ROUTER โ PLANNER โ ANALYST โ SUPERVISOR โ EXECUTER
โฑ๏ธ ~35 seconds (enhanced caution mode)
- FastAPI - High-performance async API framework
- Celery - Distributed task queue for background processing
- Redis - Message broker and caching
- WebSockets - Real-time MCP protocol communication
- Pydantic - Data validation and settings management
- Bedrock - Large language models for analysis
- Pinecone - Vector database for similarity search
- ReportLab - PDF generation for reports
- OCR API - Optical character recognition
- Gmail API - Email access and manipulation
- Google Drive API - Document storage and sharing
- Google Cloud Firestore - NoSQL database
- OAuth2 - Secure authentication
- React - Modern UI framework
- TypeScript - Type-safe JavaScript
- Vite - Fast build tool
- shadcn/ui - Beautiful UI components
- Tailwind CSS - Utility-first styling
- Tanstack Query - Server state management
- OAuth Integration: Seamless Google account login with branded interface
- Logo Branding: SentinelAI logo and "Always Watching, Always Protecting" tagline
- Secure Redirect: Automatic redirection to dashboard after authentication
โโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโ
โ Email List โ Report Viewer โ AI Assistant โ
โ (Left Panel) โ (Center Panel) โ (Right Panel) โ
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโค
โ โข Email Listen โ โข Live/Upload โ โข Context Chat โ
โ โข Email IDs โ โข Fraud Report โ โข Conversation โ
โ โข File Upload โ โข Risk Scores โ โข Help & Guide โ
โโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโ
- ๐ Email Listening Toggle: Real-time email monitoring activation
- ๐ Dynamic Email List: Auto-updating list of incoming emails (every 10s)
- ๐ฏ Clickable Email Buttons: Instant report generation on email selection
- ๐ Drag & Drop Upload: Support for PDF and image file analysis
- โฌ๏ธ Upload Button: Manual file selection with progress indicators
- ๐ Live/Upload Toggle: Switch between real-time emails and uploaded documents
- ๐ง Email Details: Complete email metadata display (sender, subject, date, body)
- ๐จ Fraud Analysis:
- Scam Label: Clear classification (Scam/Not Scam/Suspicious)
- Confidence Level: Numerical confidence score (0.0-1.0)
- Scam Probability: Percentage risk assessment (0-100%)
- Detailed Explanation: AI-generated reasoning and analysis
- ๐ค Context-Aware Responses: Uses current report as conversation context
- ๐ Message History: Persistent conversation tracking
- ๐ฏ Cybersecurity Expertise: Specialized fraud detection and security guidance
- โก Real-time Interaction: Instant responses with typing indicators
- Custom Color Palette:
- Primary:
#d4eaf7(Light Blue),#b6ccd8(Medium Blue),#3b3c3d(Dark Gray) - Accent:
#71c4ef(Bright Blue),#00668c(Deep Blue) - Text:
#1d1c1c(Primary),#313d44(Secondary) - Background:
#fffefb(Primary),#f5f4f1(Secondary),#cccbc8(Tertiary)
- Primary:
- Smooth Animations: Loading states, transitions, and micro-interactions
- Light and Dark Mode: Improves visibility in different environments.
- Live Email Feed: Automatic polling for new emails
- Toast Notifications: Success, error, and warning alerts
- Loading States: Spinners and skeleton screens
- Progress Tracking: File upload and analysis progress bars
- ๐ก๏ธ OAuth2 Authentication - Secure Google account integration
- ๐จ Real-time Monitoring - Gmail webhook notifications
- ๐ Audit Trails - Comprehensive logging and assessment tracking
- ๐ฏ Risk Scoring - Multi-factor fraud probability calculation
- โก Automated Actions - Instant scam labeling and quarantine
- ๐ง Email Messages - Headers, body, etc
- ๐ PDF Documents and Images - OCR and text extraction
- ๐ URL Analysis - Suspicious link detection
- ๐ฑ Phone Number Extraction - Contact information analysis
- ๐ข Organization Recognition - Entity verification
- ๐ Pattern Matching - Vector similarity search
- ๐งฎ Probability Scoring - AI-driven risk assessment
- Real-time Email Polling: Frontend polls for new email IDs every minute
- Email Report Generation: Dynamic report creation based on selected email ID
- Live Dashboard Updates: Automatic UI updates for incoming threats
- โก Fast Response: 95%+ confidence cases processed in <10 seconds
- ๐ฏ High Accuracy: Multi-agent validation for complex cases
- ๐ Scalable: Horizontal scaling with Celery workers
- ๐ Real-time: WebSocket MCP protocol for instant tool communication
- ๐พ Efficient: Vector search for O(log n) similarity matching
- Front End
- API
- Celery Background Task
- MCP Server Deployed on Render
These are some aspects we didn't manage to implement due to time constraints
- Better OAuth and Token handling
- Protection of endpoints
- Scaling to other platforms such as messages, phone calling
- Inclusion of more advanced tools to extend functionality
- Live Demo: SentinelAI Dashboard
- API Documentation: Swagger UI
- MCP Server: WebSocket Endpoint
Built with โค๏ธ by the SentinelAI Team Protecting inboxes, one email at a time ๐ก๏ธโจ


