ResearchFlow AI - Multi-Agent AI Research Platform
LangGraphLangChainFastAPINext.jsTypeScriptMistral AITavily APIMulti-Agent Systems
š§ ResearchFlow AI ā Autonomous Multi-Agent Research System
ResearchFlow AI is a full-stack, enterprise-grade autonomous research platform. Given any complex research topic, ResearchFlow AI orchestrates a team of specialized AI agents using LangGraph to search the web, scrape deep source content, synthesize a structured markdown report, and critically evaluate the report's accuracy and depth with automated scoring.
š Table of Contents
- Overview & Key Features
- System Architecture
- Multi-Agent Execution Pipeline
- Monorepo Structure
- Tech Stack
- Getting Started & Setup
- API Reference
- Subdirectory Readmes
š Overview & Key Features
- š¤ Autonomous Multi-Agent Collaboration: 4 specialized agents (Search, Reader, Writer, and Critic) work sequentially to conduct end-to-end research.
- ā” Real-Time SSE Streaming: Live agent progress updates emitted via Server-Sent Events (
POST /research/stream), updating the user interface as each agent completes its work. - šÆ Automated Critique & Scoring: A dedicated Critic Agent evaluates the generated report, providing a numerical score ($X/10$), key strengths, areas to improve, and a single-line verdict.
- š Deep Web Scraping: Integrates Tavily Web Search for link discovery and
BeautifulSoup4for clean DOM content extraction from top sources. - š Modern Glassmorphism UI: High-end dark theme frontend built with Next.js 16, React 19, Tailwind CSS v4, and custom typography (Urbanist & Geist Mono).
š System Architecture
+-----------------------------------+
| User Interface (Next.js 16) |
| Topic Input & Preset Badges |
+-----------------+-----------------+
|
POST /research/stream (SSE)
|
v
+-----------------------------------+
| FastAPI Backend Server |
| (routes.py & StreamingResponse) |
+-----------------+-----------------+
|
v
+-----------------------------------+
| LangGraph Engine (StateGraph) |
| Shared ResearchState |
+-----------------+-----------------+
|
v
+-----------------------------------+
| 1. Search Node (ReAct / Tavily) |
+-----------------+-----------------+
|
v
+-----------------------------------+
| 2. Reader Node (BS4 Scraper) |
+-----------------+-----------------+
|
v
+-----------------------------------+
| 3. Writer Node (LCEL / Mistral) |
+-----------------+-----------------+
|
v
+-----------------------------------+
| 4. Critic Node (Score & Review) |
+-----------------+-----------------+
|
v
+-----------------------------------+
| Server-Sent Event (SSE) Stream |
| (Live steps 1-4 & Final Result) |
+-----------------+-----------------+
|
v
+-----------------------------------+
| Tabbed UI (Report, Feedback, |
| Search Results, Scraped Sources)|
+-----------------------------------+
š Multi-Agent Execution Pipeline
Rendering diagram...
Agent Roles & State Transitions
- State Initialization (
ResearchState):- State dict created with
{"topic": topic}.
- State dict created with
- Search Agent (backend/agents/search_agent.py):
- Queries Tavily API for top 5 web results and updates
state["search_results"].
- Queries Tavily API for top 5 web results and updates
- Reader Agent (backend/agents/reader_agent.py):
- Selects the best URL from search results, scrapes body text via
requests+BeautifulSoup, and updatesstate["scraped_content"].
- Selects the best URL from search results, scrapes body text via
- Writer Agent (backend/agents/writer_agent.py):
- Synthesizes search results and scraped content into a markdown report saved in
state["report"].
- Synthesizes search results and scraped content into a markdown report saved in
- Critic Agent (backend/agents/critic_agent.py):
- Evaluates report quality, outputting a numerical score (
Score: X/10), strengths, weaknesses, and verdict intostate["feedback"].
- Evaluates report quality, outputting a numerical score (
š Monorepo Structure
research-flow-ai/
āāā Readme.md # Project-wide documentation (this file)
āāā backend/ # FastAPI & LangGraph multi-agent service
ā āāā Readme.md # Backend documentation
ā āāā app.py # FastAPI application entrypoint
ā āāā requirements.txt # Python backend dependencies
ā āāā .env # Environment keys (Mistral & Tavily API keys)
ā āāā api/ # REST routes and Pydantic schemas
ā āāā agents/ # Agent definitions (Search, Reader, Writer, Critic)
ā āāā graph/ # LangGraph StateGraph, nodes, and state definitions
ā āāā services/ # Mistral LLM client and prompt templates
ā āāā tools/ # Custom tools (Tavily search & BeautifulSoup scraper)
āāā frontend/ # Next.js 16 web application
āāā README.md # Frontend documentation
āāā package.json # Frontend scripts & dependencies
āāā app/ # Next.js App Router (pages, layout, Tailwind styles)
āāā components/ # React UI components (Hero, Progress, Tabs, ScoreBadge)
āāā lib/ # API client, SSE stream reader, and TypeScript types
š ļø Tech Stack
Backend
- Framework: FastAPI + Uvicorn
- Orchestration: LangGraph (
StateGraph) - Agent Framework: LangChain + LCEL
- LLM: Mistral AI (
mistral-small-latest) - Search Engine: Tavily Search API
- Web Scraper: BeautifulSoup4 + Requests
Frontend
- Framework: Next.js 16 (App Router) + React 19
- Language: TypeScript
- Styling: Tailwind CSS v4 + Custom Glassmorphism System
- Markdown Parsing:
react-markdown+remark-gfm - Fonts: Urbanist & Geist Mono (
next/font)
ā” Getting Started & Setup
Prerequisites
Step 1: Set Up Backend
bash
cd backend
# Create & activate virtual environment
python -m venv .venv
# On Windows (PowerShell):
.venv\Scripts\Activate.ps1
# On Linux/macOS:
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt
Create a .env file in backend/:
env
MISTRAL_API_KEY=your_mistral_api_key_here
TAVILY_API_KEY=your_tavily_api_key_here
Start the backend server:
bash
uvicorn app:app --reload --port 8000
(Backend runs at http://localhost:8000)
Step 2: Set Up Frontend
In a new terminal window:
bash
cd frontend
# Install dependencies
npm install
Create a .env file in frontend/:
env
NEXT_PUBLIC_BACKEND_URL=http://localhost:8000
Start the frontend development server:
bash
npm run dev
(Frontend runs at http://localhost:3000)
š” API Reference Summary
| Endpoint | Method | Mode | Description |
|---|---|---|---|
GET / | GET | REST | Health check endpoint returning backend status |
POST /research | POST | REST | Synchronous batch research execution |
POST /research/stream | POST | SSE | Real-time streaming emitting step updates (0-4) and complete result |
š Subdirectory Readmes
For in-depth explanations of individual sub-modules:
- š Backend Readme ā Detailed LangGraph node specs, prompt engineering, and agent schemas.
- āļø Frontend Readme ā Component architecture, state transitions, and custom Tailwind styling.