Skip to content

PranithChowdary/deep-researcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Multi-Agent Deep Researcher Workflow System

Python FastAPI LangChain License: MIT CI/CD


πŸ“Œ Overview

The Multi-Agent Deep Researcher is a modular workflow system where specialized agents collaborate to perform in-depth research on any prompt. Agents are coordinated by an orchestration layer, store context in a vector DB, and iteratively refine results through structured communication.

Key use cases:

  • πŸ“Š Market Research – competitor, trends, reports
  • 🧠 Academic Research – summarizing and synthesizing papers
  • βš™οΈ Tech Research – emerging tools, frameworks, patents

🧩 Features

  • Multi-Agent Architecture (search, summarizer, evaluator, synthesizer)
  • Orchestration Layer via LangChain / MCP / custom orchestrator
  • Memory + RAG with FAISS / Pinecone / Weaviate
  • Error Recovery: retries, graceful fallbacks, logging
  • Extensible API (FastAPI backend with REST endpoints)
  • Dockerized for reproducible environments
  • CI/CD with GitHub Actions

Sample workflow demo

Screenshot from Swagger UI (/docs) Swagger UI

example response from Deep Researcher system Response


Folder structure

deep-researcher/
β”œβ”€β”€ README.md
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ architecture.md
β”‚   β”œβ”€β”€ agents.md
β”‚   └── dev-setup.md
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ orchestrator/        # orchestration layer
β”‚   β”‚   └── orchestrator.py
β”‚   β”œβ”€β”€ agents/              # agent implementations
β”‚   β”‚   β”œβ”€β”€ searcher.py
β”‚   β”‚   β”œβ”€β”€ extractor.py
β”‚   β”‚   β”œβ”€β”€ summarizer.py
β”‚   β”‚   β”œβ”€β”€ critic.py
β”‚   β”‚   └── synthesizer.py
β”‚   β”œβ”€β”€ storage/
β”‚   β”‚   β”œβ”€β”€ vector_store.py
β”‚   β”‚   └── metadata_db.py
β”‚   β”œβ”€β”€ api/
β”‚       └── server.py        # FastAPI
β”‚   
β”œβ”€β”€ tests/
β”œβ”€β”€ Dockerfile
β”œβ”€β”€ docker-compose.yml
β”œβ”€β”€ .github/workflows/ci.yml
└── examples/
    └── demo_prompt.md

Agent roles & responsibilities

Searcher

  • Inputs: research prompt
  • Actions: query web, scholarly APIs (arXiv, CrossRef), news, and internal corpora.
  • Outputs: raw documents, URLs, metadata, confidence scores.

Extractor

  • Inputs: raw documents (HTML, PDF, text)
  • Actions: OCR (if needed), text extraction, chunking, metadata extraction (title, authors, date, section headings)
  • Outputs: chunks with embeddings ready for vector store ingestion.

Summarizer

  • Inputs: retrieved chunks or raw text
  • Actions: produce concise summaries at multiple granularities (sentence, paragraph, section)
  • Outputs: summaries with provenance (source pointers)

Critic / Evaluator

  • Inputs: summaries / synthesized content
  • Actions: fact-check against source docs, evaluate reasoning quality, flag hallucinations, rank items by novelty/relevance
  • Outputs: critiques, suggested revisions, confidence metrics

Synthesizer

  • Inputs: summaries + critiques
  • Actions: produce final structured deliverable (executive summary, literature review, gaps & opportunities, recommended reading list)
  • Outputs: report (Markdown), references (structured), action items

Planner (optional)

  • Builds multi-step plans, decides whether to re-run Search/Extractor on uncovered gaps.

Monitor / Supervisor

  • Observes workflows, retries failed tasks, rate-limit management, and alerts.

Communication protocol & data model

  1. Message format (JSON)
{
  "task_id": "uuid",
  "agent": "searcher",
  "prompt": "Find recent papers on retrieval-augmented generation",
  "inputs": { },
  "outputs": { },
  "status": "queued|running|done|failed",
  "meta": {"timestamp": "2025-08-01T12:00:00Z"}
}
  1. Transport
  • Simple mode: in-process orchestrator with async function calls (asyncio)
  • Distributed mode: RabbitMQ / Redis streams / Celery / MCP (message passing)
  1. Provenance
  • Every chunk and summary must include source_id, source_url, page, bbox (if from PDF), and timestamp.
  1. Idempotency & retries
  • Tasks carry task_id and attempts counter. Orchestrator retries transient errors up to N attempts.

Memory management & RAG integration

  1. Vector store
  • Each chunk has embedding vector + metadata. Use sentence-transformers embeddings or OpenAI/Azure embeddings.
  • Store in Pinecone / Weaviate / FAISS (local for demo).
  1. Short-term vs long-term memory
  • Short-term context: session-level cache holding current prompt, recent messages (kept in memory or Redis with TTL)
  • Long-term memory: vector DB plus metadata DB for persistent artifacts (reports, raw documents, citations)
  1. Context windowing
  • Retrieval: top-k nearest neighbors with metadata filtering (e.g., date range, domain).
  • Build RAG context by concatenating highest-quality chunks with provenance.

Error recovery & observability

  • Transient failures: retry policy with exponential backoff, capped attempts
  • Permanent failures: mark task failed, escalate to Monitor which can notify via Slack/email
  • Partial results: allow downstream agents to operate on partial outputs; track completeness score
  • Logging: structured logs (JSON) with request IDs and spans for tracing (OpenTelemetry compatible)
  • Metrics: Prometheus metrics for task latencies, failure rates, queue depth

System diagrams (Mermaid)

1) High level flow

flowchart LR
  A[User Prompt]
  A --> Orchestrator[Orchestration Layer]
  Orchestrator --> Searcher[Searcher]
  Searcher --> Extractor[Extractor]
  Extractor --> VectorDB[(Vector DB)]
  Orchestrator --> Retriever[Retriever]
  Retriever --> Summarizer[Summarizer]
  Summarizer --> Critic[Critic]
  Critic --> Synthesizer[Synthesizer]
  Synthesizer --> Output[Final Report]
  Output -->|Store| VectorDB
  Synthesizer -->|Feedback| Orchestrator
Loading

2) Agent feedback & iteration loop

sequenceDiagram
  participant U as User
  participant O as Orchestrator
  participant S as Searcher
  participant X as Extractor
  participant V as VectorDB
  participant SUM as Summarizer
  participant C as Critic
  participant SYN as Synthesizer

  U->>O: submit prompt
  O->>S: search
  S->>X: found docs
  X->>V: store chunks
  O->>V: retrieve context
  V->>SUM: context
  SUM->>C: summary
  C->>O: critique
  O->>SYN: synthesize (with critique)
  SYN->>U: report
  alt Critic requests more search
    O->>S: additional search
  end
Loading

πŸš€ Quick Start

1. Clone the repository

git clone https://github.com/PranithChowdary/deep-researcher.git
cd deep-researcher

2. Create environment

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

3. Run API server

uvicorn src.api.server:app --reload

4. Example request

curl -X POST "http://127.0.0.1:8000/research" \
     -H "Content-Type: application/json" \
     -d '{"prompt": "Latest research on quantum machine learning"}'

βœ… Tests

pytest tests/ -v

🐳 Docker

docker build -t deep-researcher .
docker run -p 8000:8000 deep-researcher

Deployment & CI

  • Dockerfile for app

  • docker-compose.yml for local dev (FastAPI + FAISS + Redis)

  • GitHub Actions:

    • ci.yml: run lint, unit tests, build docker image, push to GHCR

Documentation to include in GitHub repo

  • architecture.md β€” expanded diagrams, component responsibilities, tradeoffs
  • agents.md β€” each agent's input/output contract, sample prompts/templates, failure modes
  • dev-setup.md β€” environment variables, local vs cloud vector store options
  • runbook.md β€” monitoring, incident response, scaling recommendations

Tests & evaluation

  • Unit tests for agent contracts
  • Integration test: end-to-end flow with mocked LLM and local FAISS
  • Metric examples: ROUGE/BERTScore for summary quality, human evaluation checklist, latency and cost per run

Security & ethical considerations

  • Rate-limit external scrapers; respect robots.txt and copyright. Use only public data or licensed databases.
  • Sanitize PII before storing in vector DB. Provide deletion endpoints for user data.
  • Flag and human-review outputs with low-confidence or safety flags.

About

Multi-agent modular workflow system to perform in-depth research on any prompt.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published