This project implements an autonomous research agent using LangChain. The agent accepts a topic, searches the web, consults a knowledge source, extracts insights, and generates a structured report.
- LangChain-based agent workflow
- Supports 100% free models like Groq and Ollama, as well as OpenAI and Anthropic
- Uses at least 2 tools:
- Free Web search via DuckDuckGo
- Knowledge lookup via Wikipedia
- Produces reports with:
- Cover Page
- Title
- Introduction
- Key Findings
- Challenges
- Future Scope
- Conclusion
- Includes sample outputs
.
|-- main.py
|-- requirements.txt
|-- .env.example
|-- README.md
|-- outputs/
| |-- sample_ai_healthcare.md
| `-- sample_ev_education.md
`-- src/
|-- __init__.py
|-- agent.py
|-- prompts.py
`-- report_writer.py
- Create and activate a virtual environment.
python -m venv .venv
.venv\Scripts\Activate.ps1- Install dependencies.
pip install -r requirements.txt- Copy
.env.exampleto.envand add your keys.
For Groq (Free & Fast):
LLM_PROVIDER=groq
GROQ_API_KEY=your_groq_api_key_here
GROQ_MODEL=llama-3.3-70b-versatileFor Ollama (Free & Local - No API Key Needed!):
- Install Ollama from top-level and run
ollama run llama3. - Update your
.env:
LLM_PROVIDER=ollama
OLLAMA_MODEL=llama3You can also use OpenAI and Anthropic as shown in the .env.example.
Run from the project root:
python main.py --topic "Impact of AI in Healthcare"Optional output path:
python main.py --topic "Role of Electric Vehicles in Sustainable Transportation" --output outputs\ev_report.md- The agent receives a topic.
- It uses:
web_search(DuckDuckGo) to collect current information from the web entirely free of API keys.wikipediato gather background knowledge.
- The research notes are consolidated by the agent.
- A report-writing chain converts the notes into a structured final report.