| π° 4-Tier LLM Provider Router |
backend/llm/llm_router.py |
Prioritizes local Ollama β Cloud APIs β Hugging Face Space (token authenticated) β
Rule Engine |
| π¦ Analysis Planner Agent |
backend/agents/planner_agent.py |
LLM Zero-Shot intent classification (general_chat, root_cause, comparative,
descriptive) |
| ποΈ Text-to-SQL Analyst Agent |
backend/agents/sql_agent.py |
AST parse tree validation (100% read-only) + PostgreSQL/SQLite execution across 581K
records |
| π Python Statistical Analytics |
backend/agents/analytics_agent.py |
MoM/YoY variance, growth trends, and inventory stockout anomaly scoring |
| π Vector RAG Knowledge Agent |
backend/agents/rag_agent.py |
Document vector retrieval & causal event ID discovery (SC-2025-003, PL-2025-001)
|
| π€ Insight Synthesizer Agent |
backend/agents/insight_agent.py |
Quantitative metric + RAG document evidence synthesis & hypothesis generation
|
| π‘οΈ Critic Fact Validator Agent |
backend/agents/critic_agent.py |
Zero-hallucination verification against raw SQL query results with bounded retry
loops |
| π Plotly Visualizer Agent |
backend/agents/visualization_agent.py |
Plotly chart specification generator with entity selection & formatted bar
labels |
| π Executive Report Generator |
backend/agents/report_agent.py |
ReportLab PDF report synthesis & openpyxl Excel spreadsheet deliverable
generation |
| πΎ Database Audit Persistence |
backend/database/conversations.py |
SQL persistence for users, conversations, messages, analysis_runs, and
generated_artifacts |