{"id":35887419,"url":"https://github.com/abh2050/langgraph_data_analytics_agents","last_synced_at":"2026-04-29T10:13:08.702Z","repository":{"id":301201891,"uuid":"1008481584","full_name":"abh2050/langgraph_data_analytics_agents","owner":"abh2050","description":"This repo builds chatGPT like Data analytics agentic framework using Langgraph","archived":false,"fork":false,"pushed_at":"2025-06-25T20:11:17.000Z","size":1032,"stargazers_count":53,"open_issues_count":1,"forks_count":12,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-15T09:58:35.554Z","etag":null,"topics":["agentic-ai","agents","langgraph"],"latest_commit_sha":null,"homepage":"https://langgraphdataanalyticsagents.streamlit.app/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abh2050.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-25T15:56:36.000Z","updated_at":"2025-12-01T07:57:38.000Z","dependencies_parsed_at":"2025-06-25T17:50:18.134Z","dependency_job_id":null,"html_url":"https://github.com/abh2050/langgraph_data_analytics_agents","commit_stats":null,"previous_names":["abh2050/langgraph_data_analytics_agents"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/abh2050/langgraph_data_analytics_agents","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abh2050%2Flanggraph_data_analytics_agents","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abh2050%2Flanggraph_data_analytics_agents/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abh2050%2Flanggraph_data_analytics_agents/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abh2050%2Flanggraph_data_analytics_agents/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abh2050","download_url":"https://codeload.github.com/abh2050/langgraph_data_analytics_agents/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abh2050%2Flanggraph_data_analytics_agents/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32420624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T06:29:02.080Z","status":"ssl_error","status_checked_at":"2026-04-29T06:29:00.631Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agentic-ai","agents","langgraph"],"created_at":"2026-01-08T22:00:39.537Z","updated_at":"2026-04-29T10:13:08.669Z","avatar_url":"https://github.com/abh2050.png","language":"Python","funding_links":[],"categories":["Agent Categories"],"sub_categories":["\u003ca name=\"Unclassified\"\u003e\u003c/a\u003eUnclassified"],"readme":"# Multi-Agent Data Analytics System\n\nA robust, intelligent multi-agent system for comprehensive data analytics with context-aware query routing, dynamic chart generation, and flexible data exploration. Built with LangGraph, LangChain, and Streamlit.\n\n## Overview\n\nThis system uses a sophisticated swarm of specialized agents with intelligent orchestration to handle complex data analytics tasks:\n\n- **Router Agent**: Intelligently classifies and routes queries to appropriate specialist agents\n- **Query Context Agent**: Expands abbreviations, maps terms to columns, and provides context hints\n- **Memory Agent**: Maintains conversation context and session management\n- **Pandas Agent**: Performs dataframe operations, statistics, and data analysis\n- **Charting Agent**: Creates dynamic visualizations with LLM-driven code generation\n- **Data Search Agent**: Context-aware searching, filtering, and data exploration\n- **Python IDE Agent**: Executes custom Python code for advanced analysis\n- **Coordinator Agent**: Orchestrates multi-agent workflows and result aggregation\n\n## Key Features\n\n### 🧠 Intelligent Query Understanding\n- **Context-Aware Routing**: Automatically routes queries to the most appropriate agent(s)\n- **Abbreviation Expansion**: Understands \"hp\" → \"horsepower\", \"mpg\" → \"miles per gallon\", etc.\n- **Column Mapping**: Maps query terms to actual dataset columns intelligently\n- **Domain Agnostic**: Works with any CSV/Excel dataset structure\n\n### 📊 Dynamic Visualization\n- **LLM-Driven Chart Generation**: Creates custom Python code for any visualization request\n- **Adaptive Chart Types**: Analyzes data structure to suggest appropriate charts\n- **Base64 Image Output**: Seamless integration with web interfaces\n- **Chart Types**: Bar, line, scatter, histogram, box, pie, heatmap, violin plots, and custom visualizations\n\n### 🔍 Powerful Data Exploration\n- **Context-Enhanced Search**: Uses query context for more accurate results\n- **Flexible Filtering**: Supports all comparison operators and text matching\n- **Statistical Analysis**: Comprehensive dataframe operations and insights\n- **Multi-Step Reasoning**: Chains multiple operations for complex analysis\n\n### 💭 Conversation Memory\n- **Session Persistence**: Maintains context across interactions\n- **Chat-Style Interface**: Natural conversation flow with the system\n- **Query History**: Learns from previous interactions\n- **Multi-Turn Conversations**: Supports follow-up questions and refinements\n\n## Quick Start\n\n### 1. Install Dependencies\n```bash\npip install -r requirements.txt\n```\n\n### 2. Set Environment Variables\n```bash\nexport OPENAI_API_KEY=\"your-openai-api-key\"\n```\n\n### 3. Run the Streamlit Web Interface\n```bash\nstreamlit run streamlit_app.py\n```\n\n### 4. Or Use Terminal Chat Interface\n```bash\npython chat_interface.py\n```\n\n### 5. Or Run Demo Conversations\n```bash\npython demo_chat.py\n```\n\n## App\nhttps://langgraphdataanalyticsagents.streamlit.app/\n![](https://github.com/abh2050/langgraph_data_analytics_agents/blob/main/assets/1.png)\n![](https://github.com/abh2050/langgraph_data_analytics_agents/blob/main/assets/2.png)\n\n## Agent Architecture \u0026 Capabilities\n\n### 🎯 Router Agent\n- **Intent Classification**: Analyzes query to determine appropriate routing\n- **Multi-Agent Coordination**: Can route to multiple agents for complex queries\n- **Fallback Handling**: Graceful handling of ambiguous or unclear requests\n\n### 🧠 Query Context Agent  \n- **Abbreviation Expansion**: hp → horsepower, mpg → miles_per_gallon, etc.\n- **Column Mapping**: Maps query terms to actual dataset columns\n- **Context Hints**: Provides guidance for downstream agents\n- **Domain Analysis**: Understands dataset structure and content\n\n### 💾 Memory \u0026 Session Management\n- **Conversation Context**: Maintains chat history and context\n- **Session Persistence**: Tracks user interactions across sessions\n- **Context Formatting**: Prepares responses for UI display\n\n### 🐼 Pandas Agent\n- **DataFrame Operations**: Advanced pandas operations and transformations\n- **Statistical Analysis**: Descriptive statistics, correlations, aggregations\n- **Data Quality**: Missing value analysis, data type validation\n- **Performance Optimization**: Efficient operations on large datasets\n\n### 📈 Charting Agent\n- **Dynamic Code Generation**: LLM creates custom Python plotting code\n- **Intelligent Chart Selection**: Analyzes data to suggest appropriate visualizations\n- **Fallback Charts**: Predefined chart types for reliability\n- **Custom Styling**: Professional styling and formatting\n\n### 🔍 Data Search Agent\n- **Context-Enhanced Search**: Uses QueryContext for improved accuracy\n- **Advanced Filtering**: Multiple operators and complex conditions\n- **Smart Summaries**: Intelligent data summaries and insights\n- **JSON Responses**: Structured output for programmatic use\n\n### 🐍 Python IDE Agent\n- **Code Execution**: Safe execution of custom Python code\n- **Library Access**: pandas, numpy, matplotlib, seaborn pre-loaded\n- **Debugging Support**: Error handling and code analysis\n- **Custom Analysis**: User-defined data transformations and calculations\n\n## Example Queries\n\n### Smart Context Understanding\n- \"Which car has the highest hp?\" → System understands \"hp\" = \"horsepower\" and handles domain mismatch gracefully\n- \"Show me top revenue\" → Maps to revenue column and creates ranking visualization\n- \"What's the avg customer count by region?\" → Aggregates and groups data appropriately\n\n### Dynamic Visualizations  \n- \"Create a violin plot of customer distribution\" → Generates custom matplotlib code\n- \"Show revenue vs expenses with trend line\" → Creates scatter plot with regression\n- \"Make a stacked bar chart of products by region\" → Complex multi-dimensional visualization\n\n### Data Exploration\n- \"Find records where revenue \u003e 1400 and region = 'North'\" → Complex filtering\n- \"Show me data summary and missing values\" → Comprehensive dataset analysis\n- \"What are the correlations between all numeric columns?\" → Statistical relationships\n\n### Conversation Flow\n- User: \"Show me revenue trends\"\n- System: *Creates line chart*\n- User: \"Now filter for just Product_A\" \n- System: *Remembers context and filters previous analysis*\n\n## System Architecture\n\n```\n┌─────────────────────────────────────────────────────────────┐\n│                    STREAMLIT WEB INTERFACE                 │\n│         File Upload | Chat Input | Results Display         │\n└─────────────────────┬───────────────────────────────────────┘\n                      │ User Query\n                      ▼\n┌─────────────────────────────────────────────────────────────┐\n│                  ORCHESTRATION LAYER                       │\n│    ┌─────────────┐              ┌─────────────────┐        │\n│    │ROUTER AGENT │◄────────────►│COORDINATOR AGENT│        │\n│    │Query Intent │              │Workflow Mgmt    │        │\n│    │Classification│              │Result Aggregation│        │\n│    └─────────────┘              └─────────────────┘        │\n└─────────────────────┬───────────────────────────────────────┘\n                      │\n                      ▼\n┌─────────────────────────────────────────────────────────────┐\n│                CONTEXT \u0026 MEMORY LAYER                      │\n│ ┌─────────────┐┌─────────────┐┌─────────────┐┌───────────┐ │\n│ │QUERY CONTEXT││MEMORY AGENT ││CHAT FORMAT  ││TOOL EXEC  │ │\n│ │Abbreviation ││Conversation ││Response     ││Tool Route │ │\n│ │Expansion    ││Context      ││Formatting   ││Execution  │ │\n│ └─────────────┘└─────────────┘└─────────────┘└───────────┘ │\n└─────────────────────┬───────────────────────────────────────┘\n                      │\n                      ▼\n┌─────────────────────────────────────────────────────────────┐\n│               SPECIALIZED AGENTS LAYER                     │\n│┌────────────┐┌────────────┐┌────────────┐┌──────────────┐  │\n││DATA SEARCH ││PANDAS AGENT││CHARTING    ││PYTHON IDE    │  │\n││Text Search ││DataFrame   ││Dynamic     ││Code Execution│  │\n││Filtering   ││Operations  ││Charts      ││Analysis      │  │\n││Context-    ││Statistics  ││LLM Code    ││Debugging     │  │\n││Aware       ││Analysis    ││Generation  ││              │  │\n│└────────────┘└────────────┘└────────────┘└──────────────┘  │\n└─────────────────────────────────────────────────────────────┘\n                      │\n                      ▼\n┌─────────────────────────────────────────────────────────────┐\n│                   DATA \u0026 OUTPUT LAYER                      │\n│ ┌─────────────────┐ ┌─────────────────┐ ┌───────────────┐ │\n│ │ DataFrame Mgmt  │ │ Visualizations  │ │ LLM Backend   │ │\n│ │ CSV/Excel       │ │ Base64 Images   │ │ GPT-4o-mini   │ │\n│ │ Session State   │ │ JSON Results    │ │ Intelligence  │ │\n│ └─────────────────┘ └─────────────────┘ └───────────────┘ │\n└─────────────────────────────────────────────────────────────┘\n```\n\n### Data Flow\n1. **User Input** → Streamlit UI or Terminal Chat\n2. **Query Routing** → Router classifies intent\n3. **Context Enhancement** → QueryContext expands abbreviations \n4. **Memory Integration** → Conversation context added\n5. **Agent Processing** → Specialized agents handle requests\n6. **Coordination** → Results aggregated and formatted\n7. **Response Delivery** → Charts, data, analysis displayed\n\n## Major Improvements \u0026 Features\n\n### 🎯 **Context-Aware Query Understanding**\n- **QueryContextAgent**: New agent that expands abbreviations (hp → horsepower) and maps query terms to dataset columns\n- **Domain Agnostic**: Works with any CSV structure, not limited to specific domains\n- **Intelligent Routing**: Enhanced router with better query classification\n\n### 📊 **Dynamic Chart Generation** \n- **LLM-Driven Visualization**: ChartingAgent generates custom Python code for any chart request\n- **Adaptive Charts**: Analyzes dataset structure to suggest appropriate visualizations\n- **Fallback System**: Robust error handling with predefined chart types\n\n### 🧠 **Multi-Agent Orchestration**\n- **LangGraph Integration**: Sophisticated workflow management with conditional routing\n- **Memory Management**: Conversation context maintained across interactions\n- **Coordinator Agent**: Orchestrates complex multi-agent workflows\n\n### 🔧 **Enhanced Data Operations**\n- **Context-Enhanced Search**: DataSearchAgent uses query context for better accuracy\n- **Advanced Pandas Operations**: Comprehensive dataframe manipulation and analysis\n- **Error Recovery**: Graceful handling of domain mismatches and data issues\n\n### 💻 **Multiple Interfaces**\n- **Streamlit Web App**: Modern web interface with file upload and chat\n- **Terminal Chat**: Command-line interface for quick interactions  \n- **Demo Scripts**: Automated demonstrations of system capabilities\n\n## Technology Stack\n\n- **Frontend**: Streamlit (Web), Terminal (CLI)\n- **Agent Framework**: LangGraph + LangChain  \n- **LLM Backend**: OpenAI GPT-4o-mini\n- **Data Processing**: Pandas + NumPy\n- **Visualization**: Matplotlib + Seaborn\n- **Language**: Python 3.8+\n\n## Testing \u0026 Development\n\n### Running Tests\n```bash\n# Run all tests with coverage\npytest --cov=src --cov-report=html\n\n# Run specific test categories  \npytest tests/test_router_agent.py\npytest tests/test_charting_agent.py\npytest tests/test_data_search_agent.py\n\n# Use custom test runner\npython run_tests.py\n```\n\n### Development Setup\n```bash\n# Clone and setup\ngit clone \u003crepository\u003e\ncd agent_swarm_analytics\npip install -r requirements.txt\n\n# Set environment variables\necho \"OPENAI_API_KEY=your-key-here\" \u003e .env\n\n# Run tests to verify setup\npytest\n\n# Start development\nstreamlit run streamlit_app.py\n```\n\n### System Validation\n```bash\n# Test memory and conversation\npython test_memory.py\n\n# Test basic functionality  \npython test_simple.py\n\n# Interactive demo\npython demo_chat.py\n```\n\n## File Structure\n\n```\nagent_swarm_analytics/\n├── src/\n│   ├── agents/                 # All agent implementations\n│   │   ├── router_agent.py     # Query routing and classification\n│   │   ├── query_context_agent.py  # Context analysis and expansion\n│   │   ├── memory_agent.py     # Conversation memory management\n│   │   ├── charting_agent.py   # Dynamic visualization generation\n│   │   ├── data_search_agent.py # Context-aware data search\n│   │   ├── pandas_agent.py     # DataFrame operations\n│   │   └── python_ide_agent.py # Code execution\n│   ├── langgraph_engine/       # Workflow orchestration\n│   │   └── graph_builder.py    # Agent graph construction\n│   ├── data/                   # Sample datasets\n│   │   └── sample.csv          # Business sample data\n│   └── api/                    # FastAPI backend (optional)\n├── tests/                      # Comprehensive test suite\n├── streamlit_app.py           # Web interface\n├── chat_interface.py          # Terminal chat interface\n├── demo_chat.py              # Demo conversations\n├── architecture_ascii.txt     # System architecture diagram\n└── requirements.txt          # Dependencies\n```\n\n## Future Roadmap\n\n- **Database Integration**: PostgreSQL, MySQL, MongoDB connectors\n- **Real-time Analytics**: Streaming data processing\n- **ML Integration**: Scikit-learn, TensorFlow model training\n- **Export Features**: PDF reports, Excel dashboards\n- **API Extensions**: RESTful API for external integrations\n- **Performance**: Caching, async processing, parallel execution\n\n---\n\nFor detailed technical documentation, see [TESTING.md](TESTING.md) and the architecture diagram in [architecture_ascii.txt](architecture_ascii.txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabh2050%2Flanggraph_data_analytics_agents","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabh2050%2Flanggraph_data_analytics_agents","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabh2050%2Flanggraph_data_analytics_agents/lists"}