A dual-agent system for deep research, using Tavily for web crawling and OpenRouter for drafting structured summaries. Built with LangChain, LangGraph, and Streamlit.
Access the live application at: https://deep-research-ai-agent.streamlit.app/
-
Clone the repo:
git clone https://github.com/saksham-jain177/AI-Agent-based-Deep-Research.git cd AI-Agent-based-Deep-Research
-
Install dependencies:
pip install -r requirements.txt
Ensure you have Python 3.8+ installed. The
requirements.txt
file includes:streamlit
langchain
langgraph
tavily-python
requests
tenacity
reportlab
joblib
- Additional dependencies for document processing
-
Create a
.env
file with API keys:TAVILY_API_KEY=your_tavily_key OPENROUTER_API_KEY=your_openrouter_key
- Obtain a Tavily API key from Tavily (free tier available).
- Obtain an OpenRouter API key from OpenRouter (uses the free models, can be altered as per preference).
-
Run the app locally:
streamlit run app.py
- Dual-Agent System:
- Research Agent: Fetches data from the web using Tavily, returning structured results (title, content, URL).
- Draft Agent: Generates structured summaries with sections: Research Summary, Key Findings, Analysis, and Conclusion, using LLM model.
- Customizable Settings:
- Writing styles (Academic, Casual, Technical, etc.)
- Citation formats (APA, MLA, IEEE)
- Target word count
- Multiple output formats (PDF, Word, Markdown, Text)
- Structured Summaries: Outputs summaries with clear sections (Research Summary, Key Findings, Analysis, Conclusion) for readability.
- PDF Report Download: Allows users to download a PDF report containing the query, research data, and structured summary, with proper text wrapping and multi-page support.
- Retry Logic: Handles API failures with
tenacity
, retrying up to 3 times with a 2-second delay. - OpenRouter Status: Displays real-time API status in the sidebar, alerting users if OpenRouter is unavailable.
- Progress Indicator: Shows a progress bar during research and drafting for better user experience.
- User Feedback: Includes a feedback form in the sidebar to collect user suggestions.
- Custom Styling: Features high-contrast colors, proper spacing, and readable typography for an enhanced UI.
The application is deployed on Streamlit Cloud. To deploy your own instance:
- Fork this repository
- Visit Streamlit Cloud
- Deploy using your forked repository
- Add your API keys in Streamlit Cloud's secrets management (in TOML format)
- Visit the live demo or run locally
- Enter a research query (e.g., "Latest advancements in quantum computing")
- Customize research settings (optional)
- Click "Run Research" to fetch data and generate a summary
- View the research data and structured summary
- Download the report in your preferred format
- Provide feedback via the sidebar form (optional)
Contributions are welcome! If you have suggestions or improvements:
- Fork the repository
- Create a new branch (
git checkout -b feature-name
) - Make your changes and commit (
git commit -m "Add feature"
) - Push to your branch (
git push origin feature-name
) - Open a Pull Request