Data & Analysis
Identify patterns, trends, and insights.
data_analysisTakes 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.
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.
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.
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();Real scenarios where agents put this tool to work.
Implementation lives at swarmai-tools/src/main/java/ai/intelliswarm/swarmai/tool/common/DataAnalysisTool.java in the swarm-ai repository.