---
title: "Data Analysis Agent Code"
source: https://docs.autohand.ai/agent-sdk/tutorials/300-data-analysis-agent
---

# Build a Data Analysis Agent

Learn how to create a coding assistant that processes CSV, JSON, and analyzes data with the Autohand Code Agent SDK. Available in TypeScript, Python, Java, Go, Swift, and Rust.

In this tutorial, you'll build a data analysis coding assistant that can read data files, perform calculations, generate visualizations, and provide insights. This demonstrates how to use the Agent SDK for data processing tasks.

**Prerequisites:**

-   Completed [Code Reviewer Agent](100-code-reviewer-agent.html)
-   Node.js 16+ (for TypeScript), Python 3.10+ (for Python), Java 11+ (for Java), Go 1.16+ (for Go), Swift 5.5+ (for Swift), or Rust 1.60+ (for Rust)
-   SDK installed for your chosen language
-   API key from your LLM provider (set as `AUTOHAND_API_KEY`)

## What You'll Build

A data analysis coding assistant that:

-   Reads CSV and JSON data files
-   Calculates statistics (mean, median, standard deviation)
-   Filters and transforms data
-   Generates summary reports
-   Creates visualization scripts

## Step 1: Create Sample Data

Create a sample CSV file with sales data in your chosen language:

## Step 2: Create Data Analysis Agent

Create an agent with data analysis capabilities in your chosen language:

## Step 3: Run Analysis

Run the data analysis agent on your sample data in your chosen language:

## Key Concepts

1

**File Processing**

Using READ\_FILE to read CSV and JSON data files for analysis.

2

**Statistical Analysis**

The agent calculates statistics and provides data insights automatically.

3

**Report Generation**

Using WRITE\_FILE to create summary reports and analysis outputs.

4

**Visualization Scripts**

The agent can generate Python scripts for data visualization.

## Complete Example

Here's the complete example with cleanup:

## Real-World Applications

This pattern can be applied to:

-   **Business intelligence:** Analyze sales, revenue, and customer data
-   **Log analysis:** Parse and analyze server logs for insights
-   **Financial reporting:** Generate financial summaries and reports
-   **Scientific data:** Process experimental data and generate plots
-   **Market research:** Analyze survey data and customer feedback

## Next Steps

### 📁 View the Example

See the complete example in the SDK repositories.

[TypeScript Examples →](https://github.com/autohandai/agent-sdk-typescript/tree/main/examples)

### 📊 Documentation Generator

Learn how to build agents that generate documentation from code.

[Next Tutorial →](400-code-modernization.html)

### 📚 Explore More

Check out all examples in the SDK repositories.

[Agent SDK Overview →](../overview.html)