About pydantic-ai-researcher
A Python research system for people investigating complex questions. Its research and evaluator agents iterate on answers using external MCP servers, including Tavily, Brave Search, and arXiv.
Key features
- 01Asynchronous research and evaluation loop
- 02Separate research and evaluator agents
- 03Pluggable external MCP servers
- 04Environment-based API configuration
- 05Interactive query entry
Use cases
- 01Research complex questions across sources
- 02Refine an answer through evaluator feedback
MCP support
The research agent uses external MCP servers, including Tavily, Brave Search, and arXiv, to gather information.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEpydantic-ai-researcher
Description
pydantic-ai-researcher is a research system that orchestrates an asynchronous loop between two specialized agents: a research agent and an evaluator agent. The research agent answers complex queries using external MCP servers, while the evaluator agent assesses and refines these answers, iterating until a satisfactory response is attained.
Features
- Asynchronous Research Loop: Iterative evaluation and improvement of research answers.
- Dual Agent System: Utilizes a research agent for data gathering and an evaluator agent for feedback.
- Pluggable MCP Servers: Integrates with multiple MCP servers (Tavily, Brave Search, arXiv) for diverse data sources.
- Environment Configurable: Uses environment variables and .env files for API key configuration.
- Easy Setup: Straightforward installation via Pipfile or requirements.txt.
Installation / Setup
- Prerequisites: Ensure Python 3.x is installed.
- Installation:
- Using Pipenv:
pipenv install - Or using pip:
pip install -r requirements.txt
- Using Pipenv:
- Configuration:
- Create a
.envfile at the project root. - Define the required environment variables:
OPENAI_API_KEYTAVILY_API_KEYBRAVE_API_KEY
- (Other API endpoints may also need to be defined as needed.)
- Create a
Usage
Run the project by executing the following command:
python main.py
Type your research queries in the interactive prompt. To exit the program, type exit.
Architecture
The system implements a two-agent evaluator-optimizer loop:
- Agent A (Research Agent): Generates initial answers to research queries using external data sources via MCP servers.
- Agent B (Evaluator Agent): Evaluates the answers provided by Agent A and offers feedback for improvement.
- Loop Mechanism: The system iterates through multiple cycles of evaluation until an answer is accepted or the maximum iteration limit is reached.
Below is the workflow diagram illustrating the evaluator-optimizer process:

Source: Building effective agents
Configuration
The project configuration relies on environment variables loaded via python-dotenv. Ensure that:
OPENAI_API_KEYis set for the OpenAI model usage.TAVILY_API_KEYis set for accessing Tavily MCP Search.BRAVE_API_KEYis set for using Brave Search MCP.- Additional configuration for arXiv MCP may be defined as needed.
Contributing / License
Contributions are welcome. Please submit issues and pull requests for bug fixes, improvements, or new features. Refer to the project's LICENSE file for licensing details.
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.