An AI agent that autonomously searches the web, reads sources, and generates full research reports — powered by LangChain, Groq LLaMA-3, and Tavily Search.
An AI agent is a program that can decide what to do next on its own, rather than following a fixed script. It loops through thinking, acting, and observing results until it has enough information to answer. Unlike a simple chatbot that answers from memory, an agent actively goes out and finds information in real time. This one searches the web, reads webpages, and synthesises everything into a structured report — all without human guidance.
The agent follows the ReAct (Reasoning + Acting) loop:
┌─────────────────────────────────────────────────────────┐
│ ReAct Loop │
│ │
│ User Topic │
│ │ │
│ ▼ │
│ 💭 Think ──► What should I search for? │
│ │ │
│ ▼ │
│ 🔍 Search ──► Tavily queries live web │
│ │ │
│ ▼ │
│ 📄 Read ──► Fetch full page content │
│ │ │
│ ▼ │
│ 💭 Think ──► Do I have enough? What's missing? │
│ │ │
│ ├─── No ──► 🔍 Search again (new angle) │
│ │ │
│ └─── Yes ──► ✅ Generate final report │
└─────────────────────────────────────────────────────────┘
Each loop: Think → Search → Read → Think → Search → ... → Answer
- 🤖 Autonomous multi-step research — the agent decides what to search and when to stop
- ⚡ Powered by Groq — blazing fast LLaMA-3 inference (free tier)
- 🌐 Real-time web search — Tavily finds current, accurate sources
- 📖 Deep reading — agent fetches and reads full webpage content
- 🎬 Live streaming UI — watch the agent think and act in real time
- 📄 Structured reports — summary, key findings, analysis, citations
- 💾 Export to PDF and TXT — download professional reports instantly
- 🔒 100% free APIs — no OpenAI, no paid services
| Service | URL | Free Tier |
|---|---|---|
| Groq (LLM) | https://console.groq.com | Unlimited (rate-limited) |
| Tavily (Search) | https://tavily.com | 1000 searches/month |
git clone <your-repo-url>
cd research-agent
pip install -r requirements.txtcp .env.example .env
# Edit .env and add your API keysOr enter them directly in the app sidebar — no .env file required.
streamlit run app.pyOpen your browser to http://localhost:8501
Try these prompts for impressive demos:
-
"Latest breakthroughs in fusion energy and nuclear power 2024"
→ Pulls recent ITER/NIF news, power generation data, timeline predictions -
"How is AI changing drug discovery and pharmaceutical research?"
→ AlphaFold, ML molecular design, FDA approvals, company case studies -
"State of electric vehicle adoption globally in 2024"
→ Sales figures, country comparisons, infrastructure stats, manufacturer data -
"Best practices for building production-grade RAG systems"
→ Chunking strategies, embedding models, retrieval techniques, benchmarks -
"Impact of the 2024 US election on global markets and trade policy"
→ Economic analysis, sector impacts, expert predictions, historical parallels
ReAct (Yao et al., 2022) combines Reasoning and Acting in an interleaved loop. At each step the LLM:
- Emits a Thought — natural language reasoning about the situation
- Selects an Action — which tool to call and with what input
- Receives an Observation — the tool's return value
- Uses the observation to inform the next thought
This lets the model correct itself mid-task — if a search returns poor results, it immediately rethinks the query.
app.py ← Streamlit UI, live streaming, download buttons
agent.py ← ReAct AgentExecutor (LangChain + Groq LLaMA-3)
tools/
search.py ← Tavily web search → formatted results
reader.py ← requests + BeautifulSoup → clean text
report_gen.py ← section parser, Markdown formatter, FPDF2 PDF generator
[Add a GIF or screenshot of the app here]
research-agent/
├── app.py # Main Streamlit application
├── agent.py # LangChain ReAct agent
├── report_gen.py # Report parsing and PDF generation
├── tools/
│ ├── __init__.py
│ ├── search.py # Tavily search tool
│ └── reader.py # URL content reader tool
├── requirements.txt
├── .env.example
└── README.md
MIT © 2024 — free to use, modify, and distribute.
Day 7 of a 7-day AI portfolio sprint. Built with LangChain, Groq, Tavily, and Streamlit.