Reads XML, an older data format still used by things like news feeds, enterprise APIs, and regulatory filings. Pulls out specific pieces so the agent can work with them just like any other data.
Accepts an XML document and applies one of three operations: 'xpath' evaluates an XPath 1.0 expression and returns matching values; 'elements' lists every element name and its path; 'text' extracts all visible text, stripping tags. Works on RSS/Atom feeds, SOAP responses, sitemaps, and regulatory XML.
When a user asks:
Grab all the article titles from this RSS feed.
the agent calls the tool:
xml_parse(xmlContent="…", operation="xpath", xpath="//item/title/text()")and gets back: a list of every `<title>` under `<item>` in the feed.
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
# feed-reader.yaml
name: feed-reader-crew
process: SEQUENTIAL
agents:
- id: reader
role: Feed Reader
goal: Parse XML feeds and enterprise responses
tools:
- xml_parse
tasks:
- id: feed-reader-task
agent: reader
description: Return every <title> element from the supplied RSS feed.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.XMLParseTool;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.beans.factory.annotation.Autowired;
@Autowired ChatClient chatClient;
@Autowired XMLParseTool xMLParseTool;
Agent reader = Agent.builder()
.role("Feed Reader")
.goal("Parse XML feeds and enterprise responses")
.chatClient(chatClient)
.tool(xMLParseTool)
.build();
Task readerTask = Task.builder()
.description("Return every <title> element from the supplied RSS feed.")
.agent(reader)
.build();
SwarmOutput result = Swarm.builder()
.agent(reader)
.task(readerTask)
.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/XMLParseTool.java in the swarm-ai repository.