Overview
The AI Deep Research Agent is a powerful research assistant that leverages OpenAI’s Agents SDK and Firecrawl’s deep research capabilities to perform comprehensive web research on any topic. The system uses a two-agent architecture where one agent performs deep research and another enhances the findings with additional context and insights.Tutorial Available
Follow our complete step-by-step tutorial to build this from scratch
Architecture
Agent Coordination Pattern
The Deep Research Agent uses a sequential coordination pattern with two specialized agents:Agent Roles
Research Agent
Research Agent
Responsibilities:
- Perform deep web research using Firecrawl
- Gather comprehensive information from multiple sources
- Organize findings into structured reports
- Include proper citations
deep_research: Firecrawl’s deep research endpoint with configurable depth and time limits
Elaboration Agent
Elaboration Agent
Responsibilities:
- Enhance initial research reports
- Add detailed explanations of complex concepts
- Include relevant examples and case studies
- Expand on key points with additional context
- Add visual element descriptions
- Incorporate trends and predictions
- Maintains academic rigor
- Preserves original structure
- Focuses on value-added content
Implementation
- Complete Agent System
- Streamlit Interface
- Tool Configuration
Key Features
Deep Web Research
Automatically searches the web, extracts content, and synthesizes findings from multiple sources
Enhanced Analysis
Uses AI to elaborate on research findings with additional context and insights
Interactive UI
Clean Streamlit interface for easy interaction and real-time progress updates
Downloadable Reports
Export research findings as markdown files for offline use
Research Process
- Input Phase: User provides a research topic and API credentials
- Research Phase: The tool uses Firecrawl to search the web and extract relevant information
- Analysis Phase: An initial research report is generated based on the findings
- Enhancement Phase: A second agent elaborates on the initial report, adding depth and context
- Output Phase: The enhanced report is presented to the user and available for download
Example Research Topics
Installation
Configure API Keys
Enter your API keys in the sidebar:
- OpenAI API key from platform.openai.com
- Firecrawl API key from firecrawl.dev
Technical Details
Agent Communication
The agents communicate through a sequential handoff pattern:Firecrawl Integration
Firecrawl’s deep research tool performs:- Multiple iterations of web searches
- Content extraction from various sources
- Automatic synthesis of findings
- Citation management
Performance Considerations
Best Practices
Query Formulation
Query Formulation
- Be specific in your research queries
- Include context for better results
- Use clear, focused questions
- Avoid overly broad topics
Parameter Tuning
Parameter Tuning
- Start with default parameters (depth=3, time=180s, urls=10)
- Increase depth for more comprehensive research
- Adjust time_limit based on topic complexity
- More URLs provide broader coverage but take longer
Cost Management
Cost Management
- Each research query uses both OpenAI and Firecrawl API calls
- Monitor your API usage in both dashboards
- Consider caching results for similar queries
- Use appropriate model tiers for your needs
Related Examples
Multi-Agent Researcher
Advanced multi-agent research system
Legal Agent Team
Document analysis with agent teams
Finance Agent Team
Financial research and analysis
