# akash-aiml/data_analyst_agent architecture

> Architecture diagram of the GitHub repository akash-aiml/data_analyst_agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/akash-aiml/data_analyst_agent
- Repository: https://github.com/akash-aiml/data_analyst_agent

## Overview

AI Data Analyst is a CSV-to-validated-report platform, exposed through a FastAPI/React dashboard and a Streamlit app. The principal workflow ingests and profiles a dataset, plans and executes sandboxed analyses with a reflection loop, verifies evidence, then produces insights and a shareable Sweetviz report. The README documents the stages and major capabilities; sampled source confirms key upload, pipeline invocation, profiler-tool, and API boundaries. Several insight and web-dashboard implementation details were not sampled, so those connections are shown only where documented.

Main entry points: [`graph.py`](https://github.com/akash-aiml/data_analyst_agent/blob/main/graph.py) (LangGraph Orchestrator), [`agents/insight/insight_node.py`](https://github.com/akash-aiml/data_analyst_agent/blob/main/agents/insight/insight_node.py) (Insight Agent), [`agents/profiler/agent.py`](https://github.com/akash-aiml/data_analyst_agent/blob/main/agents/profiler/agent.py) (Data Profiler), [`llm.py`](https://github.com/akash-aiml/data_analyst_agent/blob/main/llm.py) (LLM Failover and Cache)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User Interfaces"]
  node_web["React Dashboard<br/>[Profile.tsx]"]
  node_streamlit["Streamlit App<br/>[app.py]"]
  node_upload["Upload and Run<br/>[pipeline_runner.py]"]
  node_service["Pipeline Service"]
end

subgraph group_pipeline["Analysis Pipeline"]
  node_orchestrator["LangGraph Orchestrator<br/>[graph.py]"]
  node_state["Shared Agent State<br/>[graph_state.py]"]
  node_profiler["Data Profiler<br/>[agent.py]"]
  node_profile_tool["EDA Report Tool<br/>[profiling_tool.py]"]
  node_planner["Analysis Planner<br/>[agent.py]"]
  node_executor["Sandbox Executor<br/>[python_executor.py]"]
  node_reflector["Plan Reflector<br/>[agent.py]"]
end

subgraph group_evidence["Evidence and Reports"]
  node_insight["Insight Agent<br/>[insight_node.py]"]
  node_validation["Evidence Validation<br/>[validation.py]"]
  node_verify["Recompute Verification<br/>[verify.py]"]
  node_report["Report Generator"]
  node_chat["Grounded Chat<br/>[chat.py]"]
  node_sweetviz["Sweetviz HTML Report"]
  node_summary["Summary Report"]
end

subgraph group_services["Platform Services"]
  node_api["REST API<br/>[main.py]"]
  node_llm["LLM Failover and Cache<br/>[llm.py]"]
end

node_user(("Analyst"))
node_provider(("Model Providers"))
node_csv["CSV Dataset"]
node_browser(("Browser"))

node_user -->|"uses dashboard"| node_web
node_user -->|"uses app"| node_streamlit
node_web -->|"calls API"| node_api
node_user -->|"uploads CSV"| node_upload
node_upload -->|"runs pipeline"| node_service
node_service -->|"invokes graph"| node_orchestrator
node_service -->|"builds state"| node_state
node_api -->|"runs pipeline"| node_orchestrator
node_api -->|"serves report"| node_browser
node_browser -->|"views report"| node_sweetviz
node_orchestrator -->|"routes stage"| node_profiler
node_orchestrator -->|"routes stage"| node_planner
node_orchestrator -->|"routes stage"| node_executor
node_orchestrator -->|"routes stage"| node_reflector
node_orchestrator -->|"routes stage"| node_insight
node_profiler -->|"generates profile"| node_profile_tool
node_profiler -->|"updates state"| node_state
node_planner -->|"plans tasks"| node_executor
node_executor -->|"returns results"| node_reflector
node_reflector -->|"adds tasks"| node_executor
node_insight -->|"validates output"| node_validation
node_insight -->|"recomputes evidence"| node_verify
node_insight -->|"compiles reports"| node_report
node_report -->|"delivers profile"| node_sweetviz
node_report -->|"writes summary"| node_summary
node_chat -->|"grounds answers"| node_insight
node_profiler -->|"requests model"| node_llm
node_planner -->|"requests model"| node_llm
node_insight -.->|"requests model"| node_llm
node_chat -.->|"requests model"| node_llm
node_llm -->|"fails over"| node_provider
node_csv -->|"reads dataset"| node_profiler

click node_web "https://github.com/akash-aiml/data_analyst_agent/blob/main/frontend/src/pages/Profile.tsx"
click node_streamlit "https://github.com/akash-aiml/data_analyst_agent/blob/main/app.py"
click node_upload "https://github.com/akash-aiml/data_analyst_agent/blob/main/ui/components/pipeline_runner.py"
click node_service "https://github.com/akash-aiml/data_analyst_agent/blob/main/ui/services/pipeline_service.py"
click node_api "https://github.com/akash-aiml/data_analyst_agent/blob/main/api/main.py"
click node_orchestrator "https://github.com/akash-aiml/data_analyst_agent/blob/main/graph.py"
click node_state "https://github.com/akash-aiml/data_analyst_agent/blob/main/state/graph_state.py"
click node_profiler "https://github.com/akash-aiml/data_analyst_agent/blob/main/agents/profiler/agent.py"
click node_profile_tool "https://github.com/akash-aiml/data_analyst_agent/blob/main/tools/profiling_tool.py"
click node_planner "https://github.com/akash-aiml/data_analyst_agent/blob/main/agents/analysis/agent.py"
click node_executor "https://github.com/akash-aiml/data_analyst_agent/blob/main/tools/python_executor.py"
click node_reflector "https://github.com/akash-aiml/data_analyst_agent/blob/main/agents/analysis/agent.py"
click node_insight "https://github.com/akash-aiml/data_analyst_agent/blob/main/agents/insight/insight_node.py"
click node_validation "https://github.com/akash-aiml/data_analyst_agent/blob/main/agents/insight/validation.py"
click node_verify "https://github.com/akash-aiml/data_analyst_agent/blob/main/agents/insight/verify.py"
click node_report "https://github.com/akash-aiml/data_analyst_agent/blob/main/agents/insight/report_generator.py"
click node_chat "https://github.com/akash-aiml/data_analyst_agent/blob/main/agents/insight/chat.py"
click node_llm "https://github.com/akash-aiml/data_analyst_agent/blob/main/llm.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web,node_streamlit,node_upload,node_service,node_browser toneBlue
class node_orchestrator,node_state,node_profiler,node_profile_tool,node_planner,node_executor,node_reflector toneAmber
class node_insight,node_validation,node_verify,node_report,node_chat,node_sweetviz,node_summary toneMint
class node_api,node_llm toneRose
class node_user,node_provider,node_csv toneIndigo
```

## Components

### User Interfaces

- [React Dashboard](https://github.com/akash-aiml/data_analyst_agent/blob/main/frontend/src/pages/Profile.tsx): `frontend/src/pages/Profile.tsx`
- [Streamlit App](https://github.com/akash-aiml/data_analyst_agent/blob/main/app.py): `app.py`
- [Upload and Run](https://github.com/akash-aiml/data_analyst_agent/blob/main/ui/components/pipeline_runner.py): `ui/components/pipeline_runner.py`
- [Pipeline Service](https://github.com/akash-aiml/data_analyst_agent/blob/main/ui/services/pipeline_service.py): `ui/services/pipeline_service.py`

### Analysis Pipeline

- [LangGraph Orchestrator](https://github.com/akash-aiml/data_analyst_agent/blob/main/graph.py): `graph.py`
- [Shared Agent State](https://github.com/akash-aiml/data_analyst_agent/blob/main/state/graph_state.py): `state/graph_state.py`
- [Data Profiler](https://github.com/akash-aiml/data_analyst_agent/blob/main/agents/profiler/agent.py): `agents/profiler/agent.py`
- [EDA Report Tool](https://github.com/akash-aiml/data_analyst_agent/blob/main/tools/profiling_tool.py): `tools/profiling_tool.py`
- [Analysis Planner](https://github.com/akash-aiml/data_analyst_agent/blob/main/agents/analysis/agent.py): `agents/analysis/agent.py`
- [Sandbox Executor](https://github.com/akash-aiml/data_analyst_agent/blob/main/tools/python_executor.py): `tools/python_executor.py`
- [Plan Reflector](https://github.com/akash-aiml/data_analyst_agent/blob/main/agents/analysis/agent.py): `agents/analysis/agent.py`

### Evidence and Reports

- [Insight Agent](https://github.com/akash-aiml/data_analyst_agent/blob/main/agents/insight/insight_node.py): `agents/insight/insight_node.py`
- [Evidence Validation](https://github.com/akash-aiml/data_analyst_agent/blob/main/agents/insight/validation.py): `agents/insight/validation.py`
- [Recompute Verification](https://github.com/akash-aiml/data_analyst_agent/blob/main/agents/insight/verify.py): `agents/insight/verify.py`
- [Report Generator](https://github.com/akash-aiml/data_analyst_agent/blob/main/agents/insight/report_generator.py): `agents/insight/report_generator.py`
- [Grounded Chat](https://github.com/akash-aiml/data_analyst_agent/blob/main/agents/insight/chat.py): `agents/insight/chat.py`
- **Sweetviz HTML Report**
- **Summary Report**

### Platform Services

- [REST API](https://github.com/akash-aiml/data_analyst_agent/blob/main/api/main.py): `api/main.py`
- [LLM Failover and Cache](https://github.com/akash-aiml/data_analyst_agent/blob/main/llm.py): `llm.py`

### Other components

- **Analyst**
- **Model Providers**
- **CSV Dataset**
- **Browser**

## Connections

- Analyst → React Dashboard: uses dashboard
- Analyst → Streamlit App: uses app
- React Dashboard → REST API: calls API
- Analyst → Upload and Run: uploads CSV
- Upload and Run → Pipeline Service: runs pipeline (evidence: `ui/components/pipeline_runner.py`)
- Pipeline Service → LangGraph Orchestrator: invokes graph (evidence: `ui/services/pipeline_service.py`)
- Pipeline Service → Shared Agent State: builds state (evidence: `ui/services/pipeline_service.py`)
- REST API → LangGraph Orchestrator: runs pipeline (evidence: `api/main.py`)
- REST API → Browser: serves report (evidence: `api/main.py`)
- Browser → Sweetviz HTML Report: views report
- LangGraph Orchestrator → Data Profiler: routes stage (evidence: `graph.py`)
- LangGraph Orchestrator → Analysis Planner: routes stage (evidence: `graph.py`)
- LangGraph Orchestrator → Sandbox Executor: routes stage
- LangGraph Orchestrator → Plan Reflector: routes stage (evidence: `graph.py`)
- LangGraph Orchestrator → Insight Agent: routes stage (evidence: `graph.py`)
- Data Profiler → EDA Report Tool: generates profile (evidence: `agents/profiler/agent.py`)
- Data Profiler → Shared Agent State: updates state
- Analysis Planner → Sandbox Executor: plans tasks (evidence: `agents/analysis/agent.py`)
- Sandbox Executor → Plan Reflector: returns results (evidence: `agents/analysis/agent.py`)
- Plan Reflector → Sandbox Executor: adds tasks (evidence: `agents/analysis/agent.py`)
- Insight Agent → Evidence Validation: validates output
- Insight Agent → Recompute Verification: recomputes evidence
- Insight Agent → Report Generator: compiles reports
- Report Generator → Sweetviz HTML Report: delivers profile
- Report Generator → Summary Report: writes summary
- Grounded Chat → Insight Agent: grounds answers
- Data Profiler → LLM Failover and Cache: requests model (evidence: `agents/profiler/agent.py`)
- Analysis Planner → LLM Failover and Cache: requests model (evidence: `agents/analysis/agent.py`)
- Insight Agent → LLM Failover and Cache: requests model
- Grounded Chat → LLM Failover and Cache: requests model
- LLM Failover and Cache → Model Providers: fails over
- CSV Dataset → Data Profiler: reads dataset (evidence: `agents/profiler/agent.py`)
