Wikipedia
Empower your agents to access the world's knowledge by searching Wikipedia for article summaries and historical data.
This guide will walk you through configuring the Wikipedia tool, including how to customize search depth and language settings.
💡 Core Concepts
To configure this tool, you need to understand how it handles queries and parameters.
1. How does the Wikipedia Tool work?
This tool acts as a wrapper around the Wikipedia API. When your agent sends a query, the tool searches for relevant articles, retrieves the most pertinent pages, and returns a concise summary of the content.
2. Configuration Parameters
Unlike simpler tools, you can pre-configure how this tool behaves in your YAML setup:
top_k_results: Controls how many search results/snippets to return (e.g.,3).lang: Sets the language for the Wikipedia search (e.g.,enfor English,esfor Spanish).
⚙️ Configuration Steps
Follow these steps to integrate Wikipedia search into your agentic network.
Assign & Configure Tool
In your agent's YAML configuration, add "Wikipedia" to the tool_assigned list. You can optionally define the language and number of results here.
Example Config:
config:
top_k_results: 3
lang: en
Test the Output
The tool returns text summaries.
- Usage: The agent uses this text to answer user questions or perform further reasoning and fulfill the user request.
📚 Practical Recipes (Examples)
Recipe 1: General Knowledge Assistant
Use Case: An agent that answers "Who," "What," and "When" questions using English Wikipedia.
create_agent_network:
agent-1:
agent_name: "Wiki_Lookup_Agent"
LLM_config:
params:
model: "gpt-4o-mini"
tools:
tool_assigned:
- name: "Wikipedia"
config:
top_k_results: 1
lang: en
agent_function:
- "You are a helpful encyclopedia assistant."
- "When asked about a topic, use the Wikipedia tool to fetch a summary."
incoming_edge:
- Start
outgoing_edge: []
Recipe 2: International Researcher
Use Case: An agent configured to search for concepts specifically in French Wikipedia.
tools:
tool_assigned:
- name: "Wikipedia"
config:
top_k_results: 5
lang: fr
🚑 Troubleshooting
-
RuntimeError / Connection Issues
- This usually indicates a failure to reach the Wikipedia API. Verify if the Wikipedia API is currently down.
-
Irrelevant Results
- If the summary returned is not helpful, consider increasing
top_k_results(default is 3) in the config to give the agent a broader set of snippets to read.
- If the summary returned is not helpful, consider increasing