Refract is an intelligent, agentic AI assistant designed to support researchers, students, and knowledge-seekers in exploring complex topics.
Built using the ReAct (Reasoning + Acting) paradigm, it leverages large language models and real-time web tools to reason, search, and summarize information step-by-step — just like a human researcher.
- 🤖 LLM-powered Agent using
Qwen/Qwen1.5-1.8B-Chat - 🧠 ReAct Loop: Think, act (search/scrape), and reflect iteratively
- 🌐 Web-Augmented: Uses Playwright for dynamic web search and scraping
- 🛠️ Tool-Use Capable: Executes
Search[...]andScrape[...]commands during reasoning - 📄 Auto-Generated Reports in PDF and Markdown
- 🧪 Partial Summary Fallback: When the reasoning step limit is hit, Refract summarizes and verifies what it has collected so far
- 🧭 Extensible Design for integrating new tools and models
transformers+torchfor language model inferenceplaywright+beautifulsoup4for real-time web scrapinglangchainfor tool abstraction and compatibilityreportlabfor structured PDF report generation
- User enters a topic (e.g., "Foundation Models in Machine Learning")
- Refract reasons about the topic and decides when to take actions like
Search[...]orScrape[...] - It gathers evidence, reflects, and eventually produces a concise, verified summary
- If it hits the max step limit, it summarizes what it found and runs a verification pass
Refract/
├── main.py # Main entry point for the agent
├── llm.py # Model logic and ReAct prompt templates
├── tools.py # Executes Search[...] and Scrape[...] actions
├── playwright_search_scrape.py # Search and scrape logic using Playwright
├── report_utils.py # Generates reports in Markdown and PDF formats
├── requirements.txt # Python dependencies
├── README.md
git clone https://github.com/yourusername/refract.git
cd refractpip install -r requirements.txtplaywright installpython main.py- Python 3.8+
- Internet connection for model and scraping
- GPU (recommended) for faster model inference
- Create own ReAct prompt
- Support for more tools (e.g., Wolfram, Wikipedia API, Paper API)
- RAG-based memory integration
- Support for larger Qwen variants or open-source alternatives
- Web UI using Gradio or Streamlit
This project is licensed under the MIT License
Karthik B Magadi
GitHub: @Magnus0969
⭐ Star this repo if you found it helpful!