Spaces:
Running
Running
File size: 7,295 Bytes
392346c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | ---
title: CustomerCore API
emoji: π
colorFrom: blue
colorTo: indigo
sdk: docker
app_port: 7860
pinned: false
---
# CustomerCore Intelligence Platform
Real-time multi-tenant customer intelligence powered by streaming (Redpanda), lakehouse storage (Iceberg/R2), multi-agent AI (LangGraph), and full MLOps (MLflow/DagsHub).
[](https://www.python.org/)
[](https://github.com/saibalajinamburi/CustomerCore/actions)
[](https://opensource.org/licenses/MIT)
[](#responsible-ai)
[](https://huggingface.co/spaces/saibalajinamburi/customercore-api)
CustomerCore is an enterprise-grade customer intelligence system designed to automate ticket classification, prioritize issues, calculate churn and SLA breach risks, recall agent memories, retrieve grounded facts, and run automated human-in-the-loop triage flows.
---
## Live System Links
| Asset | Link | Status |
|---|---|---|
| **Live API (HF Spaces)** | [customercore-api.hf.space](https://huggingface.co/spaces/saibalajinamburi/customercore-api/health) |  |
| **DagsHub Repo** | [dagshub.com/saibalajinamburi/CustomerCore](https://dagshub.com/saibalajinamburi/CustomerCore) | Connected |
| **MLflow Experiments** | [dagshub.com/saibalajinamburi/CustomerCore/mlflow](https://dagshub.com/saibalajinamburi/CustomerCore/mlflow) | 8 model experiments tracked |
| **CI Pipeline** | [github.com/saibalajinamburi/CustomerCore/actions](https://github.com/saibalajinamburi/CustomerCore/actions) | 10-stage GHA pipeline |
---
## Architecture Overview
See [ARCHITECTURE.md](ARCHITECTURE.md) for the full system diagram and description of the data flow pipeline.
### Core Pipelines
1. **Streaming Data Flow:** Kafka-compatible Redpanda topics (`tickets`, `product`, `billing`, `incidents`) ingest event micro-batches.
2. **Spark Lakehouse:** PySpark Structured Streaming processes raw data from Bronze to Silver layers with real-time PII masking and schema validation, writing to Apache Iceberg format.
3. **dbt Gold Layer:** Transforms silver tables into 7 curated business marts for analytics, features, and model training.
4. **LangGraph Triage:** A multi-agent supervisor orchestrates six specialized sub-agents (Classify, Memory, RAG, Churn, Incident, and HITL) to yield a Pydantic-validated 14-field triage output in `<2s`.
---
## What It Does
When a support ticket is received at `/api/v1/triage`, the LangGraph supervisor executes the following sequence:
1. **Classify Agent:** Determines ticket category and initial priority.
2. **Memory Agent:** Recalls customer profile and past session memories from Mem0 (Supabase pgvector).
3. **RAG Agent:** Injects context using hybrid retrieval (Dense + BM25 sparse) from the Knowledge Base and product documentation, reranked by a cross-encoder model.
4. **Churn Agent:** Evaluates churn risk using a LightGBM classifier.
5. **Incident Agent:** Inspects incident patterns and flags SLA-breach risks.
6. **HITL Agent:** Interrupts the graph and pauses execution if safety flags are violated or if classifier confidence falls below `0.65`, routing the ticket to the Supabase-backed human-in-the-loop review queue.
7. **Finalize & Log:** Consolidates state, applies PII scrubbing, logs the audit trail, and pushes a structured trace to Langfuse.
---
## Technology Stack
| Layer | Technology |
|---|---|
| **Streaming Backbone** | Redpanda (Kafka-compatible event broker) |
| **Lakehouse Storage** | Apache Iceberg on Cloudflare R2 |
| **Stream Processing** | PySpark Structured Streaming |
| **Transformation** | dbt-core with DuckDB adapter (7 Gold marts) |
| **Vector Database** | ChromaDB (BM25 sparse + BGE-M3 dense hybrid retrieval) |
| **LLM Gateway** | LiteLLM routing proxy & Semantic Cache (L1/L2/L3) |
| **Agent Framework** | LangGraph multi-agent supervisor |
| **Long-Term Memory** | Mem0 backed by Supabase pgvector |
| **ML Models** | 8 models (LightGBM, Isolation Forest, Prophet, etc.) |
| **Experiment Tracking**| MLflow hosted on DagsHub |
| **LLM Observability** | Langfuse (prompt management and tracing) & LangSmith |
| **Observability** | OpenTelemetry, Prometheus metrics, Grafana Cloud |
| **CI/CD** | GitHub Actions with CML (Continuous Machine Learning) reporting |
| **Hosting** | Hugging Face Spaces Docker (Inference) & Supabase |
---
## Quick Start (Local)
### 1. Prerequisites
- Docker & Docker Compose
- Python 3.12
- Doppler CLI (optional, for secret injection)
### 2. Installation
```bash
git clone https://github.com/saibalajinamburi/CustomerCore.git
cd CustomerCore
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -r requirements.txt
```
### 3. Running Locally
Run the dependent infrastructure services:
```bash
docker compose up -d
```
Start the FastAPI gateway:
```bash
uvicorn src.api.main:app --reload --port 8080
```
Check health:
```bash
curl http://localhost:8080/api/v1/health
```
---
## Project Structure
```text
customercore/
βββ .github/workflows/ # CI/CD Workflows (Lint, Pytest, HF Deploy, CML Train)
βββ infra/
β βββ k8s/ # Kubernetes YAML manifests (Deployment, Ingress, Secrets)
β βββ kind-config.yaml # Kind local multi-node cluster configuration
β βββ otel-collector.yaml
βββ src/
β βββ api/ # FastAPI Application endpoints and middleware
β βββ agent/ # LangGraph supervisor and agent nodes
β βββ rag/ # ChromaDB, Hybrid Retriever, Semantic Cache
β βββ ml/ # Model training scripts
β βββ streaming/ # Redpanda Producers and PySpark pipeline
β βββ dbt/ # dbt transform pipeline (Gold marts)
β βββ db/ # Supabase database repositories and clients
β βββ responsible_ai/ # Model cards, fairness evaluation, audit logger
βββ tests/ # Unit and integration test suites
βββ Dockerfile # Default Production Dockerfile
βββ Dockerfile.hf # Hugging Face optimized Dockerfile
```
---
## Responsible AI & EU AI Act Compliance
CustomerCore is designed with compliance in mind for the **EU AI Act (effective August 2026)**:
- **Article 10 (Data Governance):** Schema enforcement and automated PII masking via Presidio.
- **Article 12 (Traceability):** Structured audit logging of all constitutional violations and inputs/outputs to Supabase PostgreSQL.
- **Article 14 (Human Oversight):** LangGraph-native `interrupt()` gates that pause low-confidence decisions for manual human sign-off.
- **Article 15 (Accuracy & Security):** Model card documentation for all 8 ML models (`src/responsible_ai/model_cards/`) and demographic fairness accuracy gaps calculated in `fairness.py`.
---
## Author
**Saibalaji Namburi**
MSc Data Analytics, University of Hildesheim
- GitHub: [@saibalajinamburi](https://github.com/saibalajinamburi)
|