Research Assistant Agent
This project is an intelligent research assistant built using LangChain and OpenAI GPT models. It automatically researches topics, summarizes findings, and (optionally) saves the results to a text file.
Features Dynamic Prompting — The agent adapts its tone and depth based on the user's role (student, researcher, or default). Wikipedia Integration — Retrieves concise and reliable information using the built-in Wikipedia API. Structured Output — Returns a well-formatted response following a defined Pydantic schema. File Saving Tool — Automatically or manually saves results (including timestamp) to a .txt file. Extensible Tool System — You can easily add more tools or modify existing ones.
Project Structure . ├── main.py # Main agent logic (prompt, parser, and runtime) ├── tools.py # Contains wiki and save_to_txt tools ├── .env # API keys (e.g., OpenAI key) └── requirements.txt # Dependencies (LangChain, OpenAI, dotenv, etc.)
How It Works
Dynamic Prompting The agent builds a custom prompt depending on the user_role context: student → simplified explanations researcher → detailed technical responses
Query Input The user enters a research topic in the console.
Wikipedia Tool The agent retrieves relevant data from Wikipedia via wiki_tool.
Requirements Python 3.10+ OpenAI API Key (set in .env file)