Sponsored by Deepsite.site

pydantic-ai-researcher

Created By
ibagur7 months ago
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.
Content

pydantic-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

  1. Prerequisites: Ensure Python 3.x is installed.
  2. Installation:
    • Using Pipenv:
      pipenv install
      
    • Or using pip:
      pip install -r requirements.txt
      
  3. Configuration:
    • Create a .env file at the project root.
    • Define the required environment variables:
      • OPENAI_API_KEY
      • TAVILY_API_KEY
      • BRAVE_API_KEY
    • (Other API endpoints may also need to be defined as needed.)

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:

 evaluator-optimizer-workflow

Source: Building effective agents

Configuration

The project configuration relies on environment variables loaded via python-dotenv. Ensure that:

  • OPENAI_API_KEY is set for the OpenAI model usage.
  • TAVILY_API_KEY is set for accessing Tavily MCP Search.
  • BRAVE_API_KEY is 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.

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
ChatWiseThe second fastest AI chatbot™
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Serper MCP ServerA Serper MCP Server
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
CursorThe AI Code Editor
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Playwright McpPlaywright MCP server
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Tavily Mcp
WindsurfThe new purpose-built IDE to harness magic
DeepChatYour AI Partner on Desktop
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Amap Maps高德地图官方 MCP Server
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.