Multi-Agent Data Analyst System
Production-grade AI system that analyzes CSV data using natural language queries with 8 specialized LLM agents orchestrated by LangGraph
🚀 Live Demo | 📂 Architecture
Transform your CSV data into actionable insights through conversational AI. Features semantic caching (80% similarity) for instant responses, military-grade PII encryption, intelligent answerability checks, multi-step planning, and self-healing query refinement.
Table of Contents
Why This System?
The Problem
SQL/Python expertise required
Manual data cleaning
Time-consuming query writing
No PII protection
Expensive repeated queries
The Solution
✅ Natural language queries (no SQL)
✅ Intelligent caching (99.7% faster)
✅ Automatic PII protection
✅ Self-healing refinement
✅ Transparent cost tracking
Key Features
1. Multi-Agent Intelligence (8 Specialized Agents)
Agent Model Key Feature Safety Guard llama-3.1-8b-instant Validates query safety File Router llama-3.1-8b-instant File selection + Answerability check Planner llama-3.3-70b-versatile Multi-step strategy generation Data Analyst openai/gpt-oss-120b Pandas code generation Insights Generator llama-3.3-70b-versatile Creates insights first Logic Critic openai/gpt-oss-120b Validates code logic Data Critic openai/gpt-oss-120b Validates data quality Insights Critic llama-3.3-70b-versatile Validates insights
Agent Flow: Safety → Router (Answerability) → Planner (Multi-step) → Analyst → Insights First → Critics (3×) → Refinement (if needed)
File Router - Answerability Check
Before selecting files, the router asks:
"Can we answer this question with available data?"
"Do we have the necessary columns?"
If NO → Returns honest "Cannot answer" instead of hallucinating
Planner - Multi-Step Strategy
Creates detailed, hierarchical plans:
Self-Healing Refinement Process
When confidence < 80%:
Analyze feedback - "Missing null check in join"
Regenerate code - Data Analyst fixes the issue
Re-validate - Critics re-evaluate solution
Repeat if needed - Max 2 attempts total
Example: Wrong join → Add null handling → Critics approve ✅
2. Semantic Caching (80% Similarity)
Intelligent Matching:
Performance:
First query: 18.3s, $0.0028
Similar query: 45ms, $0.0000
99.7% faster, 100% cost reduction
3. PII Protection
Auto-Detection & Encryption:
Emails:
john@email.com → [EMAIL_a3f2b1c4]SSNs:
123-45-6789 → [US_SSN_b7e8c2f1]Names:
John Smith → [PERSON_d4a9f3e2]Phones:
555-123-4567 → [PHONE_c8b2e1a5]Security:
Fernet encryption (AES-128-CBC with HMAC)
SHA256 token generation
Per-user isolation in SQLite
4. Complete Observability
Downloadable Metrics:
📋
llm_calls.jsonl - Detailed call logs📈
query_rollup.xlsx - Query summaryTracks:
8 agent calls per query
Tokens, costs, latency
Cache hits/misses
Refinement attempts
Confidence scores
System Architecture
High-Level Flow
Installation
Security & Privacy
PII Redaction Flow
Why Both hashlib AND cryptography?
hashlib - Creates SHA256 tokens (
a3f2b1c4)cryptography - Encrypts values with Fernet (AES-128)
Observability
Downloadable Files
llm_calls.jsonl (Line-delimited JSON):query_rollup.xlsx (Excel Summary):One row per query
8 agent call metrics (model, tokens, latency, cost per agent)
Total tokens, cost, time
Confidence, refinements, cache hits
Files used, execution path
Deployment
Streamlit Cloud
Push to GitHub
Deploy on share.streamlit.io
Add secret:
GROQ_API_KEY=your_keyDeploy! ✅
Tech Stack
Core: Python 3.11, LangGraph 0.2.45, LangChain 0.3.0, Streamlit 1.40.2
LLMs: GROQ (llama-3.1-8b-instant, llama-3.3-70b-versatile, openai/gpt-oss-120b)
ML/NLP: sentence-transformers (all-MiniLM-L6-v2), Presidio 2.2.355, spaCy 3.8.2 (en_core_web_sm)
Data: pandas 2.1.0, openpyxl 3.1.5, python-dotenv 1.0.0
Storage: SQLite (PII encrypted database), JSON (semantic cache)
Security:
cryptography 44.0.0 - Fernet encryption (AES-128-CBC with HMAC) for PII valueshashlib (built-in) - SHA256 hashing for PII token generation0 likes · 2 views · Sep 22, 2026
Developed an AI system for CSV data analysis using natural language queries.