← All tools

Data & Analysis

CSV Analysis

Read and analyze CSV/TSV.

csv_analysis

Overview

Reads a spreadsheet file and lets the agent peek inside without needing a full data-science toolkit. It can describe the columns, compute basic statistics, preview rows, or filter them.

How it works

Loads a CSV or TSV file (from a path or inline content) and applies one of five operations: 'describe' returns column schema and summary stats; 'stats' computes min/max/mean/stddev on numeric columns; 'head' previews the first N rows; 'filter' selects rows matching a column/value; 'count' returns the total row count.

Example

When a user asks:

Describe the columns in sales.csv.

the agent calls the tool:

csv_analysis(path="sales.csv", operation="describe")

and gets back: column names, types, counts, min/max, mean, and standard deviation.

Use it in a workflow

Wire this tool into a SwarmAI crew. Use the YAML DSL for declarative workflows, or the Java builder API when you want full programmatic control.

YAML DSL

# dataset-qa.yaml
name: dataset-qa-crew
process: SEQUENTIAL

agents:
  - id: inspector
    role: Data Inspector
    goal: Peek inside CSV datasets without a full data-science stack
    tools:
      - csv_analysis

tasks:
  - id: dataset-qa-task
    agent: inspector
    description: Describe the columns of sales.csv and preview the first 5 rows.

Java

import ai.intelliswarm.swarmai.agent.Agent;
import ai.intelliswarm.swarmai.task.Task;
import ai.intelliswarm.swarmai.swarm.Swarm;
import ai.intelliswarm.swarmai.swarm.SwarmOutput;
import ai.intelliswarm.swarmai.process.ProcessType;
import ai.intelliswarm.swarmai.tool.common.CSVAnalysisTool;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.beans.factory.annotation.Autowired;

@Autowired ChatClient chatClient;
@Autowired CSVAnalysisTool cSVAnalysisTool;

Agent inspector = Agent.builder()
    .role("Data Inspector")
    .goal("Peek inside CSV datasets without a full data-science stack")
    .chatClient(chatClient)
    .tool(cSVAnalysisTool)
    .build();

Task inspectorTask = Task.builder()
    .description("Describe the columns of sales.csv and preview the first 5 rows.")
    .agent(inspector)
    .build();

SwarmOutput result = Swarm.builder()
    .agent(inspector)
    .task(inspectorTask)
    .process(ProcessType.SEQUENTIAL)
    .build()
    .kickoff();

What it's good for

Real scenarios where agents put this tool to work.

Quick describe/stats on exported datasets
Column-filter and row-count checks in data crews
Head/peek of raw CSV before deeper processing
Ad-hoc CSV QA in analyst workflows

Source

Implementation lives at swarmai-tools/src/main/java/ai/intelliswarm/swarmai/tool/common/CSVAnalysisTool.java in the swarm-ai repository.

Open csv_analysis on GitHub →