Most "AI data analysis" tools are wrappers — you ask a question, it writes SQL, done. This agent is different in one key way: it loops.
Upload CSV
│
▼
🧠 PLAN ──→ ✍️ WRITE CODE ──→ ⚙️ RUN IT
│
┌────────┴────────┐
success error
│ │
▼ ▼
🪞 REFLECT 🔧 FIX IT ──→ ⚙️ RUN AGAIN
│ (max 3 retries)
┌────┴────┐
more to find done
│ │
▼ ▼
🧠 PLAN 📋 SUMMARY
The agent decides what to investigate next based on what it already found. It writes its own pandas code, runs it, reads the error if it fails, rewrites the code, and tries again — all without you touching anything.
Bring your own free Groq API key (takes 2 minutes to get). Upload any CSV.
starting.mp4
The UI shows the agent's internal reasoning in real time — collapsed by default, expandable like ChatGPT's "Thinking" panel:
| Step | What you see |
|---|---|
| 🧠 Plan | "Analyze revenue by sales rep, group by region" |
| ✍️ Code | df.groupby('sales_rep')['revenue'].sum() |
| ⚙️ Execute | Carol: $91,748 · Alice: $88,398 · Bob: $64,348 |
| 🔧 Error fix | Auto-rewrites broken code from traceback (up to 3x) |
| 🪞 Insight | "Carol is the top performer with $91k revenue" |
| 📋 Summary | Full executive report with Key Findings + Recommendations |
Every run can be traced end-to-end through LangSmith. Each node in the graph appears as a span — you can inspect the exact prompt sent, the model's response, token counts, and latency for every LLM call in the loop.
What the trace shows:
▶ RunnableSequence (full agent run)
├─ planner ~1.2s 420 tokens "Analyze revenue by region..."
├─ code_gen ~0.9s 310 tokens df.groupby('region')['revenue']...
├─ executor — — Code ran, no LLM call
├─ reflector ~0.7s 180 tokens "INSIGHT: North leads with $..."
├─ planner ~1.1s 510 tokens "Next: distribution of order sizes"
├─ code_gen ~0.8s 290 tokens px.histogram(df, x='order_value')
├─ executor — — Chart generated
├─ reflector ~0.7s 160 tokens "INSIGHT: Orders cluster around..."
└─ summarizer ~1.5s 620 tokens "Key Findings: ..."
To enable tracing in the app, expand LangSmith Tracing in the sidebar and paste your API key from smith.langchain.com. Traces appear in your project under Projects → ada-agent → Runs after each run.
Tested head-to-head on an adversarial CSV with mixed types, outliers, dirty categoricals, bogus math, and multiple date formats. Same model (gemini-2.5-flash) for both.
| ADA Agent | PandasAI | |
|---|---|---|
| Time | 141s | 199s |
| Traps detected (out of 10) | 8 | 6 |
| Errors / crashes | 0 | 0 |
→ Full benchmark with trap-by-trap results
| Naive approach | This agent |
|---|---|
| Single LLM call → answer | Iterative loop — each finding informs the next question |
| Crashes on bad code | Reads its own traceback, rewrites, retries up to 3x |
| Fixed pipeline (step 1 → step 2 → step 3) | Dynamic graph — agent decides its own next step |
| Shows final answer only | Streams every node live — you watch it think |
| One model hardcoded | BYOK: bring your own Groq/Gemini key from the sidebar |
Agent orchestration → LangGraph (StateGraph with conditional edges)
LLM inference → Groq API (llama-3.3-70b-versatile)
Code execution → Python exec() in isolated namespace with stdout capture
Data manipulation → Pandas
Charts → Plotly (auto-generated, embedded in results)
Observability → LangSmith (token counts + full trace per run)
UI + deployment → Streamlit Community Cloud
Why LangGraph over a plain while loop?
LangGraph gives you stateful nodes, conditional routing, and checkpointing. The error-recovery branch (executor → error_fixer → executor) is a single conditional edge — clean, testable, extendable. A plain loop would need nested try/except and manual state threading.
Why Groq over OpenAI? Free tier, fast inference (~500 tok/s on Llama 3.1), no credit card needed. The agent makes 4–8 LLM calls per run — latency matters in a loop.
git clone https://github.com/AbhAy120204/-Autonomous-Data-Analyst-Agent.git
cd -Autonomous-Data-Analyst-Agent
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
# Add your Groq key
echo "GROQ_API_KEY=gsk_..." > .env
# Launch UI
streamlit run app.py
# Or CLI
python main.py --file data/examples/sales.csv --iterations 5├── agent/
│ ├── graph.py # LangGraph StateGraph — the ReAct loop
│ └── tools.py # load_csv, run_python_code, get_dataframe_info
├── app.py # Streamlit UI (streaming, collapsible thinking panel)
├── main.py # CLI entry point
└── data/examples/ # Sample datasets
- Phase 1 — Core ReAct loop (plan → code → execute → reflect)
- Phase 2 — Error recovery (auto-fix broken code, 3 retries)
- Phase 3 — Streamlit UI with live streaming
- Phase 4 — Plotly chart generation (auto-generated, embedded in results)
- Phase 6 — Token counter + LangSmith tracing
- Phase 7 — Multi-model BYOK (Groq / Gemini)
- Phase 5 — SQL / database support
- Go to console.groq.com
- Sign up (free, no credit card)
- Create an API key
- Paste it in the sidebar → Run analysis