This is an AI research agent inspired by Gemini Deep Research. It conducts comprehensive research on any topic using user-provided AI models. This tool creates structured research plans, executes multi-step analysis with web search capabilities, and synthesizes findings into detailed reports.
This research assistant leverages the pydantic-ai AI-agent framework and pydantic-ai-litellm library for using models through litellm. It provides:
- Intelligent Research Planning: Creates structured, multi-step research plans for any topic
- Topic Eligibility: Validates research topics for appropriateness
- Interactive Refinement: Allows users to provide feedback and refine research plans
- Automated Analysis: Executes research steps with web search integration
- Report Synthesis: Generates comprehensive research reports from findings
- Uses multiple specialized models for different tasks:
- GPT-4o for planning and analysis
- GPT-4o-mini for quick eligibility checks
- Gemini-2.5-Pro for report synthesis
- Built with
pydantic-aifor structured AI interactions - Integrated with
pydantic-ai-litellmfor model flexibility
- ResearchPlan: Comprehensive research planning structure
- ResearchStep: Individual research step definitions
- ResearchStepResult: Detailed results with findings and sources
- Type-safe operations with Pydantic models
- Python 3.13+
- Access to AI model APIs (configured via environment variables)
-
Clone the repository:
git clone <repository-url> cd pydantic-ai-deep-research
-
Install dependencies:
# Using uv (recommended) uv sync # Or using pip pip install -e .
-
Configure environment variables:
cp .env.example .env
Edit
.envfile with your API credentials:API_BASE=your_api_base_url API_KEY=your_api_key -
Update model_config.py and put your favourite model names
ANALYZER_MODEL = "<analyzer-model>" PLANNER_MODEL = "<planner-model>" PLANNER_MINI_MODEL = "<planner-mini-model>" SYNTHESIZER_MODEL = "<synthesizer-model>"
Start the interactive research session:
python main.py- Topic Input: Enter your research topic when prompted
- Plan Generation: The system creates an initial research plan
- Plan Refinement: Provide feedback to refine the plan (optional)
- Research Execution: The system executes each research step with web searches
- Report Generation: Comprehensive report synthesis from all findings
🎤 Welcome to the Deep Research Assistant!
Please provide a research topic and I'll provide a deep research report!
🔬 Enter your research topic: Impact of AI on modern education
✅ Research topic "Impact of AI on modern education" is eligible for research!
📜 Research Plan:
{
"topic": "Impact of AI on modern education",
"refined_topic": "Comprehensive analysis of AI's transformative effects on educational systems...",
"objectives": [...],
"key_questions": [...],
"steps": [...]
}
💡 Your feedback on the plan (or 'start/ok/begin' to begin): start
📘 Research analysis:
[Detailed step-by-step research results...]
🔖 Final research report:
[Comprehensive synthesized report]
pydantic-ai-deep-research/
├── main.py # Application entry point
├── pyproject.toml # Project configuration and dependencies
├── .env.example # Environment variables template
├── commons/ # Shared utilities and models
│ ├── _types.py # Pydantic data models
│ ├── config.py # Model configurations
│ ├── models.py # Model wrapper classes
│ ├── prompts.py # AI prompt templates
│ └── formatter.py # Output formatting utilities
├── config/ # Configuration modules
│ └── console_config.py # Rich console styling
└── deep_research/ # Core research modules
├── orchestrator.py # Main research workflow coordinator
├── planner.py # Research plan generation
├── analyzer.py # Research step execution
└── synthesizer.py # Report synthesis
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is available under the MIT License.