Skip to content
← All projects

AI/ML · Data Engineering · Full Stack

AEGIS AI

Real-time fraud detection and autonomous investigation

Status
Complete
Year
2026
Live application
Runs locally with Docker Compose (`make demo`). Synthetic data only; not publicly deployed.
AEGIS overview dashboard with live transaction volume and alert counts
F1, gradient boosting (test split)
0.863
F1, gradient boosting (test split)
PR-AUC on 2.18% fraud prevalence
0.926
PR-AUC on 2.18% fraud prevalence
alert rate on normal traffic
0.30%
alert rate on normal traffic

01 Problem

Card fraud has to be caught while the payment is in flight, and analysts need to know why something was flagged. That takes a streaming pipeline that stays correct when events arrive duplicated, out of order or malformed, features that are identical offline and online, honest model metrics and an investigation step that never invents evidence.

02 Product overview

A seeded simulator generates 60,000 customers and 1,200 merchants across two tenants, with five fraud scenarios and deliberately injected defects. Events flow through Redpanda into a consumer that validates, applies watermarks, deduplicates, computes features in Redis, scores with a calibrated model and persists atomically. dbt models the warehouse, LangGraph runs tool-based investigations, and a six-page React dashboard shows it all.

Implemented

  • Idempotent producer → transactions.v1 (3 partitions) → consumer that commits offsets only after the database commit
  • Dead-letter topic plus a quarantine table for malformed events
  • dbt project with 3 staging models, 7 marts and 23 tests
  • Logistic regression vs. histogram gradient boosting with Platt calibration, MLflow tracking, PSI drift and counterfactual explanations
  • LangGraph investigations using 6 tools, with an optional local-LLM narration gate
  • JWT auth with three RBAC roles and Prometheus metrics

Planned, not yet built

  • Incremental dbt models
  • Schema registry
  • Exactly-once DLQ
  • SHAP explanations
  • Scheduled retraining
  • Kubernetes with autoscaling
  • OpenTelemetry tracing

03 System architecture

rejectsatomic writemodelSimulatorseeded scenariosRedpandatransactions.v1Consumervalidate · dedup · scoreRedisonline featuresDLQquarantinePostgreSQLevents · alertsdbtmarts every 2 minTrainerMLflow · modelFastAPIJWT · RBACLangGraphinvestigationsReact UI6 pages
Event path from simulator to dashboard. Offsets are committed only after PostgreSQL commits, so redelivery is safe.clientservicestoremodelqueue

04 Core technologies

Streaming & data

  • Redpanda (Kafka API)
  • PostgreSQL 16
  • Redis 7
  • dbt Core 1.9

ML & agents

  • scikit-learn
  • pandas
  • MLflow 3
  • LangGraph
  • Ollama (optional)

Backend

  • Python 3.11
  • FastAPI
  • Pydantic v2
  • SQLAlchemy 2
  • confluent-kafka
  • Prometheus client

Frontend & ops

  • React 18
  • TypeScript
  • Vite
  • Tailwind
  • TanStack Query
  • Recharts
  • Docker Compose
  • nginx

05 Engineering challenges

A label leak hiding in the simulator

Early results looked too good: 41 of 183 normal transactions were alerting for a reason tied to how scenarios were generated. The simulation artifact was removed before any metric was reported.

Train/serve skew

Merchant features were computed differently offline and online. The fix was to share one feature implementation between the trainer and the streaming scorer.

Watermarks per partition

A global watermark wrongly marked 1,918 of 2,796 burst events as late. Watermarks are now tracked per partition.

Hostile bytes

Malformed events with NUL bytes broke inserts into the quarantine table, so they are escaped before storage.

06 Technical decisions

  1. 01Redpanda instead of Kafka for a single-binary, Kafka-compatible local stack
  2. 02At-least-once delivery with idempotent writes instead of Kafka transactions
  3. 03The same feature code offline and online
  4. 04Calibrated probabilities so the alert threshold means something

07 Verified test results

Backend unit
42
Backend integration
14
Frontend
11
Playwright
7
dbt tests
23
Smoke checks
9

Latest GitHub Actions run on main: passing. Counts as reported in the repository's README and testing docs.

Explore the results interactively in the Lab

08 Screenshots

AEGIS overview dashboard with live transaction volume and alert counts
Overview: live volume, alert rate and pipeline health
Investigation report generated by the LangGraph agent
Investigation report built only from tool evidence
Model intelligence page comparing models and drift
Model intelligence: calibration, comparison and drift
Live transactions table with risk scores
Live transactions with risk scores

Screenshots captured from the running application and published in the repository's docs.

09 Links

No public deployment. Runs locally with Docker Compose (`make demo`). Synthetic data only; not publicly deployed.