A multi-agent AI research pipeline that turns a natural-language topic into a structured, comprehensive research report. The system uses LangGraph for orchestration, a set of specialized agents for planning, searching, reading, synthesizing, critiquing, and writing, with a Redis-backed memory layer for cross-run context.
- Multi-Agent Architecture: Uses six specialized agents with distinct roles (Strategy, Discovery, Comprehension, Analysis, Quality Control, and Writing).
- Stateful Graph Orchestration: Managed by a LangGraph state machine supporting parallel fan-out and fan-in execution paths.
- Reflection & Debate Loop: A Critic agent evaluates drafts for quality, triggering iterative refinements (up to a safety cap of 3 rounds to control API costs).
- Proactive Concurrency & Rate Control: Designed for free-tier constraints (Groq as primary, Gemini as fallback) with managed request limits and retry/backoff wrappers.
- Cross-Run memory: Uses Redis for session scratchpads, report lookup, and persistence of metadata.
┌─────────────────────────────────────────────┐
│ STREAMLIT UI (Single App) │
│ Shows live agent progress + report │
└───────────────────────┬───────────────────────┘
│
┌───────────────────────▼───────────────────────┐
│ ORCHESTRATOR (LangGraph State Machine) │
│ │
│ ┌─────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Planner │──▶│ Searcher │──▶│ Reader │ │
│ └─────────┘ └──────────┘ └────┬─────┘ │
│ ▲ │ │
│ │ ┌──────────┐ ┌────▼──────┐ │
│ └────────│ Critic │◀──│Synthesizer│ │
│ └──────────┘ └────┬──────┘ │
│ │ │
│ ┌─────▼────┐ │
│ │ Writer │ │
│ └──────────┘ │
└─────────────┬─────────────────────────────────┘
│
┌─────────┴─────────┐
▼ ▼
┌──────┐ ┌──────────┐
│Redis │ │Local logs│
│(STM) │ │/Langfuse │
└──────┘ └──────────┘
| Agent | Role | Key Responsibilities |
|---|---|---|
| 🧠 Planner | Strategy | Decomposes the query into sub-questions, creates the research plan, and decides depth. |
| 🔍 Searcher | Discovery | Queries free search APIs (DuckDuckGo, Scholar via scholarly) and academic APIs (arXiv), scrapes with Playwright. |
| 📖 Reader | Comprehension | Chunks content and extracts key facts. |
| 🧪 Synthesizer | Analysis | Cross-references sources, merges claims, and flags contradictions or gaps. |
| 🕵️ Critic | Quality Control | Fact-checks claims, scores relevance, and raises specific objections to improve the draft. |
| ✍️ Writer | Output | Generates the final structured Markdown report with references, citations, and summaries. |
agents/ Agent classes: planner, searcher, reader, synthesizer, critic, writer
app/ Streamlit UI entry point
core/ Shared logging utilities
config.py Central settings and environment configuration
llm/ LLM provider wrappers and fallback logic (Groq / Gemini)
memory/ Redis-backed persistence helpers
models/ Pydantic and TypedDict models for state and outputs
orchestrator/ LangGraph graph definitions and state wiring
tools/ Demo runner, evaluation harness, replay utilities, web search
tests/ Automated and manual test scripts
- Orchestration: LangGraph, LangChain
- LLMs: Groq (primary, free tier), Google Gemini (fallback, free tier)
- Memory: Redis (short-term state, report index, and session metadata)
- Tools:
duckduckgo-search,scholarly, Playwright, arXiv, PyMuPDF,unstructured - Backend & UI: Python, Pydantic, Streamlit
- Observability: Local structured logging, Langfuse tracing
- Python 3.10+ (target version: 3.12)
- uv (recommended for dependency and environment management)
- Redis (optional but recommended for memory features; degrades gracefully if unavailable)
- API Keys for Groq and Google Gemini
Use uv to automatically initialize the virtual environment and synchronize dependencies:
uv syncCreate a .env file in the root of the project:
# Primary LLM API Key
GROQ_API_KEY=your_groq_api_key_here
# Fallback LLM API Key
GEMINI_API_KEY=your_gemini_api_key_here
# Redis URL (e.g. local)
REDIS_URL=redis://localhost:6379/0To launch the interactive web application, run:
uv run streamlit run app/main.pyTo run a test research query via the command-line demo:
uv run python tools/run_demo.pyTo run the verification test suite:
uv run python tests/test_v1_send_isolation.py
uv run python tests/test_v2_retry_parallel.py
uv run python tests/test_v3_debate_cap.py