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.

- 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
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
- 01Redpanda instead of Kafka for a single-binary, Kafka-compatible local stack
- 02At-least-once delivery with idempotent writes instead of Kafka transactions
- 03The same feature code offline and online
- 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 Lab08 Screenshots
09 Links
No public deployment. Runs locally with Docker Compose (`make demo`). Synthetic data only; not publicly deployed.


