How kamalesh346/data_analyst_agent works
This repository is an AI data-analysis platform that turns an uploaded CSV into verified findings and a shareable interactive report. The documented workflow profiles the dataset, plans and executes sandboxed analyses, reflects on whether more tasks are needed, verifies evidence, and generates insights and reports. FastAPI and two UIs expose the workflow. The graph and selected source excerpts support the main orchestration and upload links; several insight, chat, and frontend details are documented in the README but their implementation was not sampled.
Main entry points: graph.py State graph · insight_node.py Insight generation · llm.py LLM failover and cache · main.py REST API
Components 23
User interfaces
- React dashboard
frontend/src - Streamlit dashboard
app.py - REST API
api/main.py - Upload handling
ui/services/pipeline_service.py
Pipeline orchestration
- State graph
graph.py - Shared agent state
state/graph_state.py
Data analysis
- CSV profiler
agents/profiler/agent.py - Sweetviz profiling
tools/profiling_tool.py - Analysis planner
agents/analysis/agent.py - Sandbox executor
agents/analysis/agent.py - Plan reflector
agents/analysis/agent.py - Python sandbox
tools/python_executor.py
Evidence and reporting
- Evidence validation
agents/insight/validation.py - Recompute verification
agents/insight/verify.py - Insight generation
agents/insight/insight_node.py - Report generation
agents/insight/report_generator.py - Grounded chatbot
agents/insight/chat.py - Sweetviz HTML report
Shared services
- LLM failover and cache
llm.py
Other components
- Analyst
- CSV dataset
- LLM providers
- LangSmith tracing
Connections 26
- Analyst → React dashboard: uploads CSV
- Analyst → Streamlit dashboard: uploads CSV
- React dashboard → REST API: uses API
- Streamlit dashboard → Upload handling: selects dataset
- Upload handling → State graph: runs pipeline
ui/services/pipeline_service.py - REST API → State graph: runs pipeline
api/main.py - REST API → Grounded chatbot: answers questions
- State graph → CSV profiler: dispatches
graph.py - State graph → Analysis planner: dispatches
graph.py - State graph → Sandbox executor: dispatches
graph.py - State graph → Plan reflector: routes conditionally
graph.py - State graph → Insight generation: dispatches
graph.py - CSV profiler → Sweetviz profiling: generates profile
agents/profiler/agent.py - Sandbox executor → Python sandbox: executes code
agents/analysis/agent.py - CSV profiler → LLM failover and cache: invokes model
agents/profiler/agent.py - Analysis planner → LLM failover and cache: plans tasks
agents/analysis/agent.py - Sandbox executor → LLM failover and cache: generates analysis
agents/analysis/agent.py - Plan reflector → LLM failover and cache: reviews plan
agents/analysis/agent.py - Insight generation → Evidence validation: validates results
- Insight generation → Recompute verification: recomputes evidence
- Insight generation → Report generation: compiles reports
- Report generation → Sweetviz HTML report: writes HTML
- Grounded chatbot → Insight generation: uses verified output
- LLM failover and cache → LLM providers: fails over
- State graph → Shared agent state: shares state
- State graph → LangSmith tracing: traces runs