A production-ready fraud intelligence platform using 5 specialised multi-agents with collaborative retrieval-augmented generation (MARAG). Features a 15-phase detection pipeline, multi-dataset benchmarking and comprehensive visualisation system.
THEIA is an advanced fraud detection system that combines:
- 5 Specialised MARAG Agents working collaboratively
- 15-Phase Detection Pipeline with quality gates
- Multi-Dataset Benchmarking with statistical analysis
- Real-time visualisation of fraud patterns
- Production-Quality UI/UX with responsive design
Unlike traditional single-agent systems, THEIA uses 5 specialised agents that work together by cross-checking evidence from multiple sources. Each agent retrieves relevant information and adds its own analysis (Retrieval-Augmented Generation or RAG):
- TIRA - Threat Intelligence Retrieval Agent (Red
#EF4444) - RCRA - Regulatory Compliance Retrieval Agent (Blue
#3B82F6) - HPRA - Historical Pattern Retrieval Agent (Purple
#A855F7) - ERRA - Entity Relationship Retrieval Agent (Green
#10B981) - BARA - Behavioural Analysis Retrieval Agent (Orange
#F97316)
Agents reach agreement through weighted voting, where each agent's contribution is evaluated based on its confidence level and past accuracy. If agents disagree, the system uses conflict resolution rules to make a final decision.
- MARAG Multi-Agent System - 5 collaborative AI agents
- 15-Phase Detection Pipeline - Sequential/parallel/convergent execution
- Enhanced Fraud Reports - Comprehensive analysis with 6 tabbed sections
- Risk Scoring - 0-100 scale with 5-levels of categorisation
- Real-time Status Tracking - Live pipeline updates
- Multi-Dataset Comparison - Test against multiple fraud datasets
- Performance Metrics - Precision, Recall, F1-Score, AUC-ROC
- Statistical Significance - P-values and effect sizes
- Visualisation Gallery - Downloadable charts with explanations
- Analytics Dashboard - Performance monitoring
- Modern Chat Interface - AI-powered conversations
- Mode Selection - Auto/Fast/Expert/Heavy modes
- File Attachments - Upload fraud datasets
- Responsive Design - Mobile/tablet/desktop optimised
- Keyboard Shortcuts - Power user features
- Case Management - Track investigations from detection to resolution
- Audit Trails - Complete compliance logging
- Error Recovery - Automatic retry with fallback strategies
- Dataset Manager - Upload and manage multiple datasets
- Workflow Dashboard - Visualise agent collaboration
- Framework: Preact (React-compatible, lightweight)
- Language: TypeScript
- Styling: Tailwind CSS 4.x
- UI Components: Radix UI (accessible, unstyled)
- Icons: Lucide React
- State Management: Preact Signals
- Build Tool: Vite (fast, modern)
- Testing: Vitest and Testing Library
- Linter: Biome (fast linter/formatter)
- Type Checking: TypeScript strict mode
- AI Platform: Relevance AI SDK
- Multi-Agent: Workforce orchestration
- RAG: Retrieval-augmented generation
- Datasets: Credit card, PaySim, MomtSim fraud data (Kaggle)
theia-fraud-intelligence/
├── src/
│ ├── components/ # UI components
│ │ ├── marag-status-panel.tsx
│ │ ├── marag-consensus-radar.tsx
│ │ ├── enhanced-fraud-report-display.tsx
│ │ ├── benchmark-comparison.tsx
│ │ ├── visualisation-gallery.tsx
│ │ ├── phase-pipeline.tsx
│ │ └── ... 42 more components
│ ├── types/ # Type definitions
│ │ ├── marag.ts
│ │ ├── benchmarking.ts
│ │ └── fraud-report.ts
│ ├── utils/ # Utilities
│ │ ├── parse-fraud-report.ts
│ │ └── backend-integration-test.ts
│ ├── hooks/ # Custom hooks
│ │ ├── useMediaQuery.ts
│ │ └── useMediaQuery.test.ts
│ ├── test/ # Test files
│ │ ├── setup.ts
│ │ └── responsive-layout.test.tsx
│ └── test-data/ # Sample data
│ └── enhanced-fraud-report-sample.json
├── datasets/ # Fraud datasets
│ ├── creditcard.csv
│ ├── paysim.csv
│ └── momtsim.csv
└── README.md # This file
| Requirement | Minimum Version | Notes |
|---|---|---|
| Node.js | 18.x LTS | 20.x or 22.x LTS recommended |
| npm | 9.x | Included with Node.js; upgrade with npm install -g npm@latest |
| Git | 2.x | For cloning the repository |
| Relevance AI account | — | Required for live MARAG agents; API keys needed |
Tip: Use nvm (macOS/Linux) or nvm-windows to manage Node.js versions.
git clone https://github.com/techgirldiaries/theia.git
cd theianpm installThis installs all production and development dependencies defined in package.json, including Preact, Tailwind CSS 4.x, Radix UI, Lucide, Vitest and the Relevance AI SDK.
Create a .env file in the project root (or populate the existing one):
# Copy the example template (if provided)
cp .env.example .envThen open .env and fill in your Relevance AI credentials:
# Relevance AI region (e.g. "us-east-1" or "au-east-1")
VITE_REGION=your-region
# Your Relevance AI project ID
VITE_PROJECT_ID=your-project-id
# The MARAG Workforce / Agent ID to invoke
VITE_WORKFORCE_ID=your-workforce-id
Note for assessment: A pre-configured
.envfile with working credentials is included in the submission zip file. No manual setup is required to evaluate the system.
npm run devVite will start a local server. Open your browser to:
http://localhost:5173
The app hot-reloads automatically on any file change — no restart needed.
Once the browser loads, confirm:
- The THEIA header and chat interface are visible
- The MARAG status panel shows 5 agents (TIRA, RCRA, HPRA, ERRA, BARA)
- Typing a message triggers the 15-phase pipeline
- The connection status indicator shows Connected
If agents fail to respond, double-check your .env credentials and ensure the project is active.
The app hot-reloads automatically on any file change — no restart needed.
Once the browser loads, confirm:
- The THEIA header and chat interface are visible
- The MARAG status panel shows 5 agents (TIRA, RCRA, HPRA, ERRA, BARA)
- Typing a message triggers the 15-phase pipeline
- The connection status indicator shows Connected
If agents fail to respond, double-check your .env credentials and ensure the project is active.
# Run all tests (unit + integration)
npm test
# Run tests in watch mode during development
npm run test -- --watch
# Run tests with the Vitest UI (browser-based reporter)
npm run test:ui
# Generate a coverage report
npm run test:coverageTest files are located in src/hooks/ and src/test/. Coverage output is written to coverage/.
# Compile and bundle for production
npm run buildThe optimised output is written to dist/. To preview the production build locally before deployment:
npm run preview
# Opens http://localhost:4173# Run TypeScript compiler in check-only mode (no output files)
npx tsc --noEmitThe project uses TypeScript strict mode. All type errors must be resolved before building.
# Check for lint errors and formatting issues
npx biome check .
# Auto-fix safe issues
npx biome check --write .Biome is configured via biome.json and replaces both ESLint and Prettier.
| Problem | Likely Cause | Fix |
|---|---|---|
npm install fails |
Node.js version too old | Upgrade to Node.js 18+ |
Blank page on npm run dev |
.env missing or malformed |
Re-check all three VITE_* variables |
| Agents not responding | Invalid API key or region | Verify credentials in Relevance AI dashboard |
| TypeScript errors on install | Stale node_modules |
Delete node_modules/ and re-run npm install |
| Port 5173 already in use | Another Vite dev server running | Kill the other process or run npm run dev -- --port 5174 |
crypto shim errors |
Node version mismatch | Ensure Node.js 18+ and clear Vite cache with npx vite --force |
VITE_REGION=...
VITE_PROJECT_ID=...
VITE_WORKFORCE_ID=...tsconfig.json- Strict mode enabled- Full type coverage across codebase
- 249 lines of custom type definitions
vite.config.ts- Vite build settingsbiome.json- Linter or formatter configurationvitest.config.ts- Test configuration
Status: Types defined, calculations require verified fraud data for comparison
Impact: Low - this is a common limitation in real-world fraud systems
Missing Components:
| Metric | Status | Impact | Academic Justification |
|---|---|---|---|
| Accuracy | Missing | Cannot measure correctness without verified fraud data | Common in deployed systems without labelled validation data |
| Precision | Live tracking missing | Cannot assess false positive rate in real-time | Requires manual fraud validation (3-7 days) |
| Recall | Live tracking missing | Cannot measure fraud catch rate dynamically | Verified data emerges after investigation |
| F1 Score | Live calculation missing | Cannot optimise threshold in real-time | Requires retrospective analysis |
| False Positives | Real-time tracking missing | Unknown investigation waste initially | Validated through case resolution |
| False Negatives | Real-time tracking missing | Unknown fraud leakage initially | Discovered through customer reports/audits |
Justification: Fully implemented in benchmarking context (see test data with 92-97% precision). Production systems require manual validation loops that take 3-7 days to establish verified fraud data.
Status: Documented but not implemented in live metrics
Impact: Low - visualisation gap, not algorithmic limitation
Alternative: Static confusion matrix can be generated from benchmarking results
Academic Value: Demonstrates understanding through benchmarking implementation
Status: Core visualisations present, advanced charts as future work
Impact: None - documented as optional enhancements
Missing Components:
- Evidence Network Graph (3D agent correlation visualisation)
- Performance Radar Chart (multi-dimensional comparison)
- Statistical Heatmap (p-value significance matrix)
Justification: Shows project scoping and prioritisation. Core visualisation gallery operational with 6 chart types implemented.
Critical: None
Major: None
Minor: 3 gaps (all academically justified and documented)
Blockers: None
All limitations are academically justified, well-documented and represent common industry constraints rather than implementation failures.
-
Evidence Network Graph
- Interactive agent correlation visualisation
- Conflict resolution indicators
-
Performance Radar Chart
- Multi-dimensional dataset comparison
- Overlaid performance metrics
-
Statistical Heatmap
- P-value significance matrix
- Effect size visualisation
-
Advanced MARAG Panel
- Expandable agent findings
- Evidence drill-down
- Repository: github.com/techgirldiaries/theia
- Issues: GitHub Issues
- Discussions: GitHub Discussions
See LICENSE.md for details
- Project Supervisor
- Relevance AI - Multi-agent workforce platform
- Preact Team - Lightweight React alternative
- Radix UI - Accessible component primitives
- Datasets: Credit card fraud, PaySim, MomtSim (Kaggle)