Skip to main content
This example demonstrates building a research agent that can search Wikipedia and summarize articles.

Features

  • Async tool for Wikipedia API calls
  • Multi-step research workflow
  • Streaming output for real-time feedback

Complete Code

How It Works

  1. User asks a question - “Tell me about the history of Python”
  2. AI searches Wikipedia - Calls search_wikipedia("Python programming language")
  3. AI reads articles - Calls get_article("Python (programming language)")
  4. AI summarizes - Generates a comprehensive response based on the article content

Sample Output

Customization Ideas

Add tools for other APIs like news search, academic papers, or documentation.
Add a tool to save summaries to files or a database.
Wrap in a loop to allow follow-up questions about the research.