Prerequisites
The following example requires thewikipedia and openai libraries.
Example
The following agent will search Wikipedia for “ai” and print the response.cookbook/91_tools/wikipedia_tools.py
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Search Wikipedia with WikipediaTools and optionally add results to a Knowledge base.
wikipedia and openai libraries.
uv pip install -U wikipedia openai
from agno.agent import Agent
from agno.tools.wikipedia import WikipediaTools
agent = Agent(tools=[WikipediaTools()])
agent.print_response("Search wikipedia for 'ai'")
| Name | Type | Default | Description |
|---|---|---|---|
knowledge | Optional[Knowledge] | None | Knowledge base to store Wikipedia content in. When provided, the toolkit registers search_wikipedia_and_update_knowledge_base instead of search_wikipedia. |
auto_suggest | bool | True | Allow Wikipedia to auto-suggest a matching article title for the query. |
all | bool | False | Currently has no effect. Tool registration depends only on knowledge. |
| Function Name | Description |
|---|---|
search_wikipedia_and_update_knowledge_base | This function searches wikipedia for a topic, adds the results to the knowledge base and returns them. |
search_wikipedia | Searches Wikipedia for a query. |
Was this page helpful?