An AI-powered research assistant that autonomously investigates any topic using specialized agents, parallel web searches, and quality-controlled report generation.
Features β’ Quick Start β’ Architecture β’ Usage β’ API Reference
|
Four specialized AI agents work together:
|
|
|
|
- Python 3.11 or higher
- Tavily API Key (free tier available)
- Anthropic or OpenAI API key
# Clone the repository
git clone https://github.com/yourusername/autonomous-research-agent.git
cd autonomous-research-agent
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Configure API keys
cp .env.example .env
# Edit .env with your API keys|
π¨ Web Interface streamlit run app.pyOpens at |
π» Command Line python main.py "Your research topic" |
π API Server uvicorn api.main:app --reloadOpens at |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π― WORKFLOW ORCHESTRATOR β
β (LangGraph State Machine) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββ
βΌ βΌ βΌ
βββββββββββββββββ βββββββββββββββββ βββββββββββββββββ
β π PLANNER β β π RESEARCHER β β π¬ CRITIC β
β β β β β β
β β’ Analyze β ββββββΆβ β’ Parallel β β β’ Score β
β topic β β β search β β quality β
β β’ Generate βββββββ β β’ Multi- ββββββββββββΆβ β’ Check β
β queries β β provider β β coverage β
β β’ Strategy β β β’ Rate & β β β’ Suggest β
β planning β β cache β β refinements β
βββββββββββββββββ βββββββββββββββββ βββββββββ¬ββββββββ
β
βββββββββββββββββ β
β π WRITER βββββββββββββββββββββ
β β
β β’ Structure β
β report β
β β’ Citations β
β β’ Formatting β
βββββββββββββββββ
- Planning β Planner breaks topic into 3-5 targeted search queries
- Research β Researcher executes queries in parallel via Tavily + Wikipedia
- Evaluation β Critic scores quality (completeness, diversity, consistency)
- Refinement β If score < 7/10, loops back with improvement suggestions
- Writing β Writer compiles sources into structured markdown report
autonomous-research-agent/
β
βββ π¨ app.py # Streamlit Web UI
βββ π» main.py # CLI Entry Point
βββ π¦ pyproject.toml # Project configuration
β
βββ src/ # Core Package
β βββ config.py # Configuration management
β βββ state.py # State definitions
β βββ graph.py # LangGraph workflow
β β
β βββ agents/ # Specialized Agents
β β βββ base.py # Base agent class
β β βββ planner.py # Research planning
β β βββ researcher.py # Parallel search
β β βββ critic.py # Quality evaluation
β β βββ writer.py # Report generation
β β
β βββ tools/ # Utilities
β βββ search.py # Search providers
β βββ cache.py # SQLite caching
β
βββ api/ # REST API
β βββ main.py # FastAPI + WebSocket
β
βββ tests/ # Test Suite
βββ reports/ # Generated Reports
βββ data/ # Cache Storage
The Streamlit UI provides the most user-friendly experience:
streamlit run app.pyFeatures:
- π Modern dark theme with glassmorphism
- π Real-time quality metrics
- π Live agent activity log
- π₯ One-click report download
# Basic usage
python main.py "Impact of quantum computing on cryptography"
# With options
python main.py --output ./my_reports --max-revisions 3 "AI in healthcare"Options:
| Flag | Description | Default |
|---|---|---|
--output, -o |
Output directory | reports/ |
--max-revisions, -r |
Max refinement loops | 2 |
from src.graph import run_research
# Run research
result = run_research("Climate change mitigation strategies")
# Access results
print(result["final_report"])
print(f"Quality: {result['quality_report']['overall_score']}/10")
print(f"Sources: {len(result['sources'])}")| Method | Endpoint | Description |
|---|---|---|
POST |
/api/research/start |
Start new research session |
GET |
/api/research/{id} |
Get session status |
POST |
/api/research/{id}/approve |
Approve research plan |
GET |
/api/research/{id}/report |
Get final report |
const ws = new WebSocket('ws://localhost:8000/ws/research/{session_id}');
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
// Types: 'message', 'status', 'plan', 'quality', 'complete'
console.log(data.type, data.content);
};| Variable | Description | Required |
|---|---|---|
TAVILY_API_KEY |
Tavily search API | β |
ANTHROPIC_API_KEY |
Claude API key | One of these |
OPENAI_API_KEY |
OpenAI API key | required |
LLM_PROVIDER |
anthropic or openai |
Default: anthropic |
SERPER_API_KEY |
Google Search (optional) | β |
from src.config import get_config
config = get_config()
# Search settings
config.search.max_results_per_query = 10
config.search.max_parallel_searches = 8
# Quality thresholds
config.quality.min_quality_score = 8.0
config.quality.max_refinement_iterations = 3
# Cache settings
config.cache.ttl_hours = 48# Run all tests
pytest tests/ -v
# Run with coverage
pytest tests/ --cov=src --cov-report=htmlContributions are welcome! Please see CONTRIBUTING.md for guidelines.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.