How aammartufail/data_analysis_ai_agent_01 works
This is a LangGraph data-analysis agent: a user supplies a dataset and question, and the agent produces an auditable Markdown report with computed results, charts, cleaning notes, and interpretation. Its workflow loads and profiles data, then fans out into deterministic cleaning and LLM planning. Analysis code is generated, run in a subprocess, and may loop through repair before interpretation and report assembly. The graph wiring and sampled node code support the main workflow; some subsystem details, including cleaning and reporting branches, are documented in the README rather than fully sampled.
Main entry points: graph.py Graph Orchestrator · llm_integration.py LLM Stages · llm.py LLM Backend Factory · analysis.py Analysis Controller
Components 16
User Interface
- Command Line
agent/cli.py
Analysis Workflow
- Graph Orchestrator
agent/graph.py - Dataset Ingest
agent/nodes/ingest.py - Load + Profile
agent/profiling.py - Data Cleaning
agent/nodes/cleaning.py - LLM Stages
agent/nodes/llm_integration.py - Report Assembly
agent/nodes/report.py
Analysis Execution
- Analysis Controller
agent/nodes/analysis.py - Code Sandbox
agent/sandbox.py
Shared Runtime
- Shared State
agent/state.py - Prompt Templates
agent/prompts.py - LLM Backend Factory
agent/llm.py - Runtime Settings
agent/config.py
Other components
- Dataset + Question
- Ollama
- OpenAI API
Connections 19
- Dataset + Question → Command Line: submits request
README.md - Command Line → Graph Orchestrator: runs workflow
agent/cli.py - Graph Orchestrator → Dataset Ingest: dispatches first
agent/graph.py - Graph Orchestrator → Data Cleaning: fans out
agent/graph.py - Graph Orchestrator → LLM Stages: fans out
agent/graph.py - Graph Orchestrator → Analysis Controller: routes branches
agent/graph.py - Graph Orchestrator → Report Assembly: routes completion
agent/graph.py - Dataset Ingest → Load + Profile: loads and profiles
agent/nodes/ingest.py - Data Cleaning → Load + Profile: cleans data
agent/nodes/cleaning.py - LLM Stages → Prompt Templates: formats requests
agent/nodes/llm_integration.py - LLM Stages → LLM Backend Factory: requests completions
agent/nodes/llm_integration.py - LLM Backend Factory → Runtime Settings: reads settings
agent/llm.py - LLM Backend Factory → Ollama: invokes model
README.md - LLM Backend Factory → OpenAI API: invokes API
README.md - Analysis Controller → Code Sandbox: executes code
agent/nodes/analysis.py - Analysis Controller → LLM Stages: requests code or repair
- LLM Stages → Analysis Controller: routes generated code
agent/nodes/llm_integration.py - LLM Stages → Report Assembly: routes interpretation
agent/nodes/llm_integration.py - Report Assembly → Command Line: returns report path
README.md