AI Agent Based Deep Research
Table of contents
AI Agent Based Deep Research
Abstract
A dual-agent system that revolutionizes academic research by combining intelligent web crawling with advanced text synthesis. Built using LangChain and LangGraph, the system employs Tavily for comprehensive web research and Dolphin 3.0 Mistral-24B for generating structured academic content.
System Architecture
Dual-Agent Design
The system operates through two specialized AI agents:
- Research Agent: Powered by Tavily API for intelligent web crawling
- Draft Agent: Utilizing Dolphin 3.0 Mistral-24B for content synthesis
# Key implementation of the draft agent def draft_answer( data: List[Dict[str, Any]], deep_research: bool = False, target_word_count: int = 1000, writing_style: str = "academic", citation_format: str = "APA", language: str = "english" ) -> str:
- This pipeline, orchestrated through LangChain and LangGraph, transforms user queries into comprehensive research documents with customizable formats and citation styles.
Deep Research AI Agent Flow
User Input → [Query + Settings]
|
↓
[Research Agent] → Tavily Search
| - Web Crawling
| - Data Collection
↓
[Draft Agent] → Dolphin 3.0 Mistral-24B
| - Content Analysis
| - Summary Generation
↓
[Output] → Format Options
- PDF/Word/MD/Text
- Citations
- References
Flow: Input → Research → Draft → Export
Key Features
1. Intelligent Research Processing
def research_web(query, deep_research=False): """Fetch data from the web using Tavily based on a query.""" max_results = 30 if deep_research else 5 data = [] url_set = set()
2. Advanced Content Generation
The system supports multiple writing styles:
- Academic
- Business
- Technical
- Casual
3. Customizable Output Formats
STYLE_TEMPLATES = { "academic": { "tone": "formal and scholarly", "vocabulary": "academic terminology and precise language", "structure": "rigorous academic structure with clear theoretical foundations" } }
Technical Implementation
Model Architecture
- Primary LLM: Dolphin 3.0 Mistral-24B
- Integration: OpenRouter API
- Research Engine: Tavily API
Citation System
def format_citation(item: Dict[str, Any], format_style: str) -> str: """Format citation according to specified style.""" if format_style == "APA": return f"{title}. ({date}). Retrieved from {url}"
Results and Performance
Deep Research Mode
- Comprehensive analysis capability
- Multi-section academic paper generation
- Advanced citation management
Writing Style Analysis
The system demonstrates versatility across different writing styles while maintaining accuracy and coherence.
Future Developments
- Enhanced multilingual support
- Integration with academic databases
- Advanced citation verification
- Real-time collaboration features
Technical Requirements
- Python 3.8+
- Key Dependencies:
- LangChain
- LangGraph
- Streamlit
- Tavily Python
- OpenRouter API
Live Demo
Access the application: https://deep-research-ai-agent.streamlit.app/
Conclusion
The Deep Research AI Agent demonstrates how combining specialized AI agents can transform the research process. By pairing Tavily's targeted web crawling with Dolphin 3.0 Mistral-24B 's (model can be altered as per preference) synthesis capabilities, I've created a tool that not only gathers information but contextualizes and structures it meaningfully.
The system's ability to adapt its writing style, manage citations, and generate comprehensive summaries showcases the practical applications of current AI technologies. While not replacing human researchers, it serves as an efficient research assistant, streamlining the initial phases of information gathering and synthesis.