MU
← All Projects
4.1

AI Data Analysis Agent

AI-Powered
AI-Powered Tools

A production AI agent that enables conversational data analysis with real-time code execution. Users upload CSV/Excel files and ask questions in natural language. The agent writes and executes Python code in a secure E2B sandbox, generating visualizations and insights streamed back in real-time via SSE.

Technology Stack
FastAPIE2B Code InterpreterGroqGroq APIGoogle Cloud RunSSE StreamingNext.jspandasmatplotlib
System Architecture
Loading diagram...
Specifications
  • Natural Language Queries: Ask questions about your data in plain English
  • Secure Code Execution: Python runs in isolated E2B sandbox with pandas, numpy, matplotlib, seaborn, scipy
  • Real-time Streaming: SSE streams code, output, and charts as they are generated
  • Persistent Sessions: Session context file preserves analysis state across follow-up questions
  • Self-Healing: Extracts valid code from malformed LLM responses, auto-switches models on failures
  • Chart Generation: matplotlib/seaborn visualizations rendered inline with automatic deduplication
Design Decisions
ChallengeSolution
Vercel 10s timeout too short for analysisDirect browser-to-Cloud Run SSE connection bypasses serverless limits
LLM tool call format inconsistentRobust code extraction from various argument formats + syntax validation
Model overload/rate limitsAutomatic fallback from Kimi K2 to Llama 3.3 70B with retry logic
Users ask follow-up questionsSession context file + sandbox persistence maintains conversation state
Secure code executionE2B sandbox isolates Python environment with pre-installed data science libraries
Process Flow
Loading diagram...
User Interface

Data Analysis Interface

Chat-based interface for exploring datasets with AI-generated code and visualizations

Drag-and-drop file upload for CSV/Excel
Real-time code execution with syntax highlighting
Interactive charts rendered inline
Follow-up questions with session memory
Try Live Demohttps://tewtor.ai