Skip to main content
The Wikipedia Search tool lets an agent look up and retrieve encyclopedic facts from Wikipedia.

Overview

The Wikipedia Search tool is a tool that allows you to search and retrieve information from Wikipedia.
pip install langchain-community
export OPENAI_API_KEY="${OPENAI_API_KEY:?Set OPENAI_API_KEY in your shell}"
from praisonaiagents import Agent, AgentTeam
from langchain_community.utilities import WikipediaAPIWrapper

data_agent = Agent(instructions="Gather all of Messi's record in LaLiga", tools=[WikipediaAPIWrapper])
summarise_agent = Agent(instructions="Summarize the data into a well structured format")
agents = AgentTeam(agents=[data_agent, summarise_agent])
agents.start()

How It Works

Getting Started

1

Simple Usage

  1. Install dependencies (see Overview above)
  2. Set required API keys in your environment
  3. Run the agent example in Overview
2

With Configuration

Use the same tool with an agent — see the Overview example, or pass env vars from the sections above.

Best Practices

Wikipedia search is free — only OPENAI_API_KEY for the agent’s LLM is required. WikipediaAPIWrapper needs no API key.
WikipediaAPIWrapper accepts doc_content_chars_max. Cap it so long articles do not overflow the agent’s context window.
Ambiguous terms return the wrong page. Feed the agent specific titles (e.g. “Lionel Messi”) so results match intent.

Wikipedia

Wikipedia tool

Tavily

AI-powered search

ArXiv

Academic papers