Skip to main content
Data analysis agent that processes CSV files and generates visualizations.

Code

Create ai-data-analysis-agent.py with the code below, or save it directly from your editor.

Skill Configuration

Create skills/ai-data-analysis-agent/skill.yaml:

How It Works

Data Processing
  • analyze_dataset: Reads CSV files and generates summary statistics
  • Reports dataset shape, data types, missing values, and descriptive statistics
  • Handles file path validation and error reporting
Visualization Generation
  • generate_visualization: Creates charts using matplotlib and seaborn
  • Supports bar, line, and scatter plots
  • Automatically saves charts to outputs directory
  • Configurable chart styling with seaborn themes
Agent Capabilities
  • Elite Data Scientist persona with analytical expertise
  • Proactively uses tools for dataset understanding
  • Generates structured Markdown reports
  • Autonomous report saving to file system
Error Handling
  • Robust exception handling with detailed error messages
  • File path validation and existence checks
  • Graceful failure recovery with user feedback

Dependencies

Environment Setup

Create .env file:

Run

Examples:
  • “Analyze the dataset at /path/to/your/data.csv and create a bar chart showing sales by region”
  • “Give me a brief summary of data, and generate a bar chart showing Sales by Product”
  • “Are there any missing values in this dataset?”

Example API Calls

Frontend Setup

Open http://localhost:5173 and try to chat with the AI data analysis agent