An AI-powered research assistant built using LangChain, OpenAI, and tool-calling agents that can search the web, fetch Wikipedia data, and save structured research outputs to a file.
- 🌐 Web search using DuckDuckGo
- 📚 Wikipedia-based research
- 🧠 AI-generated structured responses
- 💾 Save research outputs to a
.txtfile - 🛠️ Tool-calling agent using LangChain
- 📄 Structured output using Pydantic
- Python
- LangChain
- OpenAI (GPT-4o-mini)
- Pydantic
- DuckDuckGo Search
- Wikipedia API
- dotenv
git clone <your-repo-link>
cd ResearchAssistantAgentpython3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Create a .env file:
OPENAI_API_KEY=your_api_key_here
python main.py
What is MCP server? ⚡ Example Output
{
"topic": "MCP server",
"summary": "An MCP server is a system that connects AI models to external tools and data...",
"source": ["Wikipedia", "Web Search"],
"tools_used": ["search", "wiki"]
}
The agent uses multiple tools:
- search → Fetches real-time web results
- wiki → Retrieves summarized Wikipedia content
- save_text_to_file → Stores research output in a text file
- Understands the query
- Decides which tools to use
- Collects information
- Returns structured output
- Optionally saves results to a file
All saved outputs are appended to:
research_output.txt
- Timestamp
- Structured research data
- .env is ignored for security
- Do not expose API keys
- DuckDuckGo search may fail on older Python SSL setups (use Python 3.11+)
- Add PDF export
- Add streaming responses
- Improve error handling
- Add UI (Streamlit / React)
- Support multiple research topics at once