How jayandhan03/data-analyst-agent works
Project Type and Purpose
• This is a full-stack, multi-agent AI system (“Data Analyst Agent”) that automates end-to-end BI workflows.
• It orchestrates a series of AI sub-agents (preprocessor planner, cleaner, reporter, visualizer) under a Supervisor Agent, powered by LangGraph, LangChain Agents, and Gemini API, with a Streamlit UI.
File Structure Analysis
• Top-level agent scripts: Cleaner_Agent.py, Report_agent.py, Visualizer_agent.py, Report_agent.py
• Core orchestrator and entrypoints: app.py (Streamlit UI), main.py, llm.py
• Toolkit and guardrails: Toolkit/Tools.py, Guardrails/*.py
• Experiment folder: Jupyter notebooks and standalone scripts (scraper, database, run), illustrating data pipelines and proof-of-concepts
• Devops: Dockerfile, .dockerignore, GitHub Actions workflow for deploying to Streamlit Cloud
• Config & orchestration: Prompts.py, requirements.txt
Insights from README
• Supervisor Agent routes tasks, maintains memory
• Sub-agents: Planner → Cleaner → Reporter → Visualizer
• Orchestration: LangGraph
• Memory & chains: LangChain
• LLM provider: Gemini API
• UI layer: Streamlit (app.py)
• Deployment: Streamlit Cloud via Docker/GitHub Actions
a. Main Components
• Frontend UI (Streamlit app.py)
• Supervisor Agent (main orchestration layer)
• Preprocessor Planner Agent module
• Cleaner Agent module
• Report Agent module
• Visualizer Agent module
• Language Model API (Gemini)
• Memory store (LangChain memory)
• Toolkit & Guardrails (Tools.py and guardrails modules)
• Data storage (CSV/Excel input, ephemeral in-memory)
• Deployment infra (Docker container, GitHub Actions)
b. Relationships and Data Flows
• User uploads dataset via UI → Streamlit frontend
• UI sends user intent + data to Supervisor Agent
• Supervisor consults Prompts.py & memory store → decides next agent
• Planner Agent returns a preprocessing plan → passed back to Supervisor
• Supervisor invokes Cleaner Agent with plan → validation feedback loops via Guardrails
• Cleaned data forwarded to Report Agent → insights & story generated
• Insights fed to Visualizer Agent → plots returned
• Supervisor aggregates outputs → UI renders report + visuals
• All LLM calls route through llm.py → Gemini API
c. Architectural Patterns & Principles
• Modular, pipeline-based agent microservices
• Orchestration with a central Supervisor Agent (controller)
• Separation of concerns: planning, cleaning, analyzing, visualizing
• Guardrails as an orthogonal cross-cutting concern for quality and validation
• Memory-driven reasoning: shared state across multi-turn interactions
d. Key Technologies & Frameworks
• Orchestration: LangGraph
• Agent framework & memory: LangChain Agents
• LLM provider: Gemini API
• UI: Streamlit (app.py)
• Containerization: Dockerfile
• CI/CD: GitHub Actions workflow (deploy-to-hf-space.yml)