Lets the agent talk to any online service. If there's an API somewhere — your own internal one, or a vendor's — this is the generic phone the agent uses to ask it for data or to send it something.
Performs a single HTTP request with the specified method (GET/POST/PUT/DELETE/PATCH), custom headers, query parameters, and body. Optionally injects a bearer token for the Authorization header. Returns the raw response body so the agent can parse it with json_transform or xml_parse as needed.
When a user asks:
Call our internal pricing API for customer 12345.
the agent calls the tool:
http_request(method="GET", url="https://api.internal/pricing/12345", authToken="•••")and gets back: whatever response your API returns — typically a JSON payload the agent can read.
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
# api-bridge.yaml
name: api-bridge-crew
process: SEQUENTIAL
agents:
- id: integrator
role: API Integrator
goal: Call internal REST services on behalf of the crew
tools:
- http_request
tasks:
- id: api-bridge-task
agent: integrator
description: GET https://api.internal/pricing/12345 with the supplied bearer token and return the response.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.HttpRequestTool;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.beans.factory.annotation.Autowired;
@Autowired ChatClient chatClient;
@Autowired HttpRequestTool httpRequestTool;
Agent integrator = Agent.builder()
.role("API Integrator")
.goal("Call internal REST services on behalf of the crew")
.chatClient(chatClient)
.tool(httpRequestTool)
.build();
Task integratorTask = Task.builder()
.description("GET https://api.internal/pricing/12345 with the supplied bearer token and return the response.")
.agent(integrator)
.build();
SwarmOutput result = Swarm.builder()
.agent(integrator)
.task(integratorTask)
.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/HttpRequestTool.java in the swarm-ai repository.