← All tools

Data & Analysis

Data Analysis

Identify patterns, trends, and insights.

data_analysis

Overview

Takes raw numbers or tables and spots the patterns inside — trends, outliers, comparisons. Typically the middle step of a workflow: gather data first, analyse it here, then write the findings up with the report generator.

How it works

Feeds the supplied dataset to an analysis routine selected by the 'analysisType' parameter ('trend', 'outliers', 'comparison', 'summary') and returns a structured finding including the direction of the trend, notable data points, and a short narrative. Designed to sit between raw data ingestion and final report generation.

Example

When a user asks:

Find the trend in these quarterly revenue numbers.

the agent calls the tool:

data_analysis(data="[22, 24, 28, 31]", analysisType="trend")

and gets back: a summary of the growth trajectory, pace of change, and any outliers.

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

# insights.yaml
name: insights-crew
process: SEQUENTIAL

agents:
  - id: analyst
    role: Insight Analyst
    goal: Identify trends and outliers in numeric data
    tools:
      - data_analysis

tasks:
  - id: insights-task
    agent: analyst
    description: Given the quarterly revenue series [22, 24, 28, 31], describe the growth trajectory.

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.DataAnalysisTool;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.beans.factory.annotation.Autowired;

@Autowired ChatClient chatClient;
@Autowired DataAnalysisTool dataAnalysisTool;

Agent analyst = Agent.builder()
    .role("Insight Analyst")
    .goal("Identify trends and outliers in numeric data")
    .chatClient(chatClient)
    .tool(dataAnalysisTool)
    .build();

Task analystTask = Task.builder()
    .description("Given the quarterly revenue series [22, 24, 28, 31], describe the growth trajectory.")
    .agent(analyst)
    .build();

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

What it's good for

Real scenarios where agents put this tool to work.

Trend and pattern detection over market time-series
Competitor metric benchmarking
Insight summaries for executive-report agents
Exploratory analysis step before report_generator

Source

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

Open data_analysis on GitHub →