← All tools

Knowledge & Research

Wikipedia

Factual grounding via the public Wikipedia API.

wikipedia

Overview

Pulls facts straight from Wikipedia. Agents use it to get quick, trustworthy background on people, places, companies, or concepts before going deeper — and it works across dozens of languages.

How it works

Calls the public Wikipedia REST API with one of three operations: 'summary' fetches a page's lead paragraph, 'search' matches keywords to page titles, and 'article' returns the full article text. Supports every Wikipedia language edition (en, de, zh, …).

Example

When a user asks:

Give me a short background on the Federal Reserve.

the agent calls the tool:

wikipedia(title="Federal Reserve", operation="summary")

and gets back: a concise encyclopedic summary of the topic.

Configuration

Set these before calling the tool. Values marked required must be present or the tool call will fail.

swarmai.tools.wikipedia.user-agent optional

User-Agent header sent to Wikipedia REST API. Defaults to 'SwarmAI/1.0 (https://intelliswarm.ai; contact@intelliswarm.ai)'.

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

# background-research.yaml
name: background-research-crew
process: SEQUENTIAL

agents:
  - id: analyst
    role: Research Analyst
    goal: Ground answers with trustworthy encyclopedic facts
    tools:
      - wikipedia

tasks:
  - id: background-research-task
    agent: analyst
    description: Fetch a Wikipedia summary for 'Federal Reserve' and extract its stated mandate.

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

@Autowired ChatClient chatClient;
@Autowired WikipediaTool wikipediaTool;

Agent analyst = Agent.builder()
    .role("Research Analyst")
    .goal("Ground answers with trustworthy encyclopedic facts")
    .chatClient(chatClient)
    .tool(wikipediaTool)
    .build();

Task analystTask = Task.builder()
    .description("Fetch a Wikipedia summary for 'Federal Reserve' and extract its stated mandate.")
    .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.

Factual grounding for named entities
Biographies and historical context
Multi-lingual knowledge lookup (en/de/zh/…)
Disambiguation before deeper research

Source

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

Open wikipedia on GitHub →