# codefixxx/multiagent_research_assistant architecture

> Architecture diagram of the GitHub repository codefixxx/multiagent_research_assistant, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/codefixxx/multiagent_research_assistant
- Repository: https://github.com/codefixxx/multiagent_research_assistant

## Overview

This repository implements a multi-agent research service: a caller submits a query, background orchestration gathers and reviews evidence, a writer produces a report, and the service validates and returns it. The graph preserves the documented budget-control, durable-run, progress-streaming, and audit capabilities. Some internal connections are based on the README or SOURCE INDEX rather than full source excerpts; unsampled implementation details are not inferred.

Main entry points: [`src/graph/builder.py`](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/graph/builder.py) (Workflow Graph), [`src/api/job_runner.py`](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/api/job_runner.py) (Job Service), [`src/tools/evidence_collector.py`](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/tools/evidence_collector.py) (Evidence Collector), [`src/core/llm.py`](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/core/llm.py) (LLM Provider)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Service API"]
  node_api["FastAPI Service<br/>[main.py]"]
  node_routes["Research Routes<br/>[routes.py]"]
  node_job_service["Job Service<br/>[job_runner.py]"]
  node_api_contracts["API Contracts<br/>[api.py]"]
  node_sse["SSE Stream<br/>[sse.py]"]
end

subgraph group_execution["Research Workflow"]
  node_planner["Planner<br/>[planner.py]"]
  node_researcher["Researcher<br/>[researcher.py]"]
  node_reviewer["Reviewer<br/>[reviewer.py]"]
  node_writer["Report Writer<br/>[writer.py]"]
  node_graph["Workflow Graph<br/>[builder.py]"]
  node_supervisor["Workflow Supervisor<br/>[supervisor.py]"]
  node_budgets["Budget Guardrails<br/>[budgets.py]"]
  node_state["Research State<br/>[state.py]"]
  node_citation_validator["Citation Validator"]
  node_rag_scorer["RAG Quality Scorer<br/>[rag_scorer.py]"]
  node_llm["LLM Provider<br/>[llm.py]"]
end

subgraph group_evidence["Evidence Gathering"]
  node_evidence_collector["Evidence Collector"]
  node_search["Web Search<br/>[search.py]"]
  node_scraper["Page Scraper<br/>[scraper.py]"]
  node_domain_guard["Domain Diversity<br/>[domain_guard.py]"]
  node_hacker_news["Hacker News<br/>[hacker_news.py]"]
end

subgraph group_operations["Run Operations"]
  node_queue["Job Queue<br/>[queue.py]"]
  node_redis_saver[("Redis Persistence<br/>[redis_saver.py]")]
  node_trace["Audit Tracing<br/>[tracer.py]"]
end

node_caller(("Research Client"))
node_redis[("Redis")]
node_search_services["Search Providers"]
node_web_sources["Research Websites"]
node_llm_providers["LLM Providers"]

node_caller -->|"submits query"| node_api
node_api -->|"routes requests"| node_routes
node_routes -->|"starts or queries"| node_job_service
node_routes -->|"accepts and returns"| node_api_contracts
node_routes -->|"creates stream"| node_sse
node_job_service -->|"enqueues jobs"| node_queue
node_job_service -->|"executes workflow"| node_graph
node_job_service -->|"persists run state"| node_redis_saver
node_job_service -->|"records execution"| node_trace
node_job_service -->|"broadcasts progress"| node_sse
node_queue -->|"stores queued jobs"| node_redis
node_redis_saver -->|"stores checkpoints"| node_redis
node_graph -->|"dispatches planning"| node_planner
node_graph -->|"dispatches research"| node_researcher
node_graph -->|"dispatches review"| node_reviewer
node_graph -->|"dispatches writing"| node_writer
node_graph -->|"routes workflow"| node_supervisor
node_supervisor -->|"checks limits"| node_budgets
node_graph -->|"updates state"| node_state
node_researcher -->|"gathers evidence"| node_evidence_collector
node_evidence_collector -->|"runs searches"| node_search
node_evidence_collector -->|"scrapes pages"| node_scraper
node_evidence_collector -->|"filters domains"| node_domain_guard
node_evidence_collector -->|"adds discussions"| node_hacker_news
node_search -->|"queries providers"| node_search_services
node_scraper -->|"fetches pages"| node_web_sources
node_graph -->|"validates report"| node_citation_validator
node_job_service -->|"scores report quality"| node_rag_scorer
node_planner -->|"generates plan"| node_llm
node_researcher -->|"analyzes evidence"| node_llm
node_reviewer -->|"evaluates findings"| node_llm
node_writer -->|"synthesizes report"| node_llm
node_llm -->|"uses configured model"| node_llm_providers
node_graph -.->|"emergency synthesis"| node_writer

click node_api "https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/api/main.py"
click node_routes "https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/api/routes.py"
click node_job_service "https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/api/job_runner.py"
click node_api_contracts "https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/schemas/api.py"
click node_sse "https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/api/sse.py"
click node_planner "https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/agents/planner.py"
click node_researcher "https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/agents/researcher.py"
click node_reviewer "https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/agents/reviewer.py"
click node_writer "https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/agents/writer.py"
click node_graph "https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/graph/builder.py"
click node_supervisor "https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/graph/supervisor.py"
click node_budgets "https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/graph/budgets.py"
click node_state "https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/graph/state.py"
click node_evidence_collector "https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/tools/evidence_collector.py"
click node_search "https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/tools/search.py"
click node_scraper "https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/tools/scraper.py"
click node_domain_guard "https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/tools/domain_guard.py"
click node_hacker_news "https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/tools/hacker_news.py"
click node_citation_validator "https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/validators/citation_validator.py"
click node_rag_scorer "https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/validators/rag_scorer.py"
click node_llm "https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/core/llm.py"
click node_queue "https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/persistence/queue.py"
click node_redis_saver "https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/persistence/redis_saver.py"
click node_trace "https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/core/tracer.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api,node_routes,node_job_service,node_api_contracts,node_sse,node_caller toneBlue
class node_planner,node_researcher,node_reviewer,node_writer,node_graph,node_supervisor,node_budgets,node_state,node_citation_validator,node_rag_scorer,node_llm,node_redis toneAmber
class node_evidence_collector,node_search,node_scraper,node_domain_guard,node_hacker_news toneMint
class node_queue,node_redis_saver,node_trace toneRose
class node_search_services,node_web_sources,node_llm_providers toneIndigo
```

## Components

### Service API

- [FastAPI Service](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/api/main.py): `src/api/main.py`
- [Research Routes](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/api/routes.py): `src/api/routes.py`
- [Job Service](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/api/job_runner.py): `src/api/job_runner.py`
- [API Contracts](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/schemas/api.py): `src/schemas/api.py`
- [SSE Stream](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/api/sse.py): `src/api/sse.py`

### Research Workflow

- [Planner](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/agents/planner.py): `src/agents/planner.py`
- [Researcher](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/agents/researcher.py): `src/agents/researcher.py`
- [Reviewer](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/agents/reviewer.py): `src/agents/reviewer.py`
- [Report Writer](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/agents/writer.py): `src/agents/writer.py`
- [Workflow Graph](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/graph/builder.py): `src/graph/builder.py`
- [Workflow Supervisor](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/graph/supervisor.py): `src/graph/supervisor.py`
- [Budget Guardrails](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/graph/budgets.py): `src/graph/budgets.py`
- [Research State](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/graph/state.py): `src/graph/state.py`
- [Citation Validator](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/validators/citation_validator.py): `src/validators/citation_validator.py`
- [RAG Quality Scorer](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/validators/rag_scorer.py): `src/validators/rag_scorer.py`
- [LLM Provider](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/core/llm.py): `src/core/llm.py`

### Evidence Gathering

- [Evidence Collector](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/tools/evidence_collector.py): `src/tools/evidence_collector.py`
- [Web Search](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/tools/search.py): `src/tools/search.py`
- [Page Scraper](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/tools/scraper.py): `src/tools/scraper.py`
- [Domain Diversity](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/tools/domain_guard.py): `src/tools/domain_guard.py`
- [Hacker News](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/tools/hacker_news.py): `src/tools/hacker_news.py`

### Run Operations

- [Job Queue](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/persistence/queue.py): `src/persistence/queue.py`
- [Redis Persistence](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/persistence/redis_saver.py): `src/persistence/redis_saver.py`
- [Audit Tracing](https://github.com/codefixxx/multiagent_research_assistant/blob/main/src/core/tracer.py): `src/core/tracer.py`

### Other components

- **Research Client**
- **Redis**
- **Search Providers**
- **Research Websites**
- **LLM Providers**

## Connections

- Research Client → FastAPI Service: submits query
- FastAPI Service → Research Routes: routes requests (evidence: `src/api/main.py`)
- Research Routes → Job Service: starts or queries (evidence: `src/api/routes.py`)
- Research Routes → API Contracts: accepts and returns (evidence: `src/api/routes.py`)
- Research Routes → SSE Stream: creates stream (evidence: `src/api/routes.py`)
- Job Service → Job Queue: enqueues jobs (evidence: `src/api/job_runner.py`)
- Job Service → Workflow Graph: executes workflow (evidence: `src/api/job_runner.py`)
- Job Service → Redis Persistence: persists run state (evidence: `src/api/job_runner.py`)
- Job Service → Audit Tracing: records execution (evidence: `src/api/job_runner.py`)
- Job Service → SSE Stream: broadcasts progress (evidence: `src/api/job_runner.py`)
- Job Queue → Redis: stores queued jobs
- Redis Persistence → Redis: stores checkpoints
- Workflow Graph → Planner: dispatches planning (evidence: `src/graph/builder.py`)
- Workflow Graph → Researcher: dispatches research (evidence: `src/graph/builder.py`)
- Workflow Graph → Reviewer: dispatches review (evidence: `src/graph/builder.py`)
- Workflow Graph → Report Writer: dispatches writing (evidence: `src/graph/builder.py`)
- Workflow Graph → Workflow Supervisor: routes workflow (evidence: `src/graph/builder.py`)
- Workflow Supervisor → Budget Guardrails: checks limits (evidence: `src/graph/supervisor.py`)
- Workflow Graph → Research State: updates state (evidence: `src/graph/builder.py`)
- Researcher → Evidence Collector: gathers evidence
- Evidence Collector → Web Search: runs searches (evidence: `src/tools/evidence_collector.py`)
- Evidence Collector → Page Scraper: scrapes pages (evidence: `src/tools/evidence_collector.py`)
- Evidence Collector → Domain Diversity: filters domains (evidence: `src/tools/evidence_collector.py`)
- Evidence Collector → Hacker News: adds discussions (evidence: `src/tools/evidence_collector.py`)
- Web Search → Search Providers: queries providers (evidence: `src/tools/search.py`)
- Page Scraper → Research Websites: fetches pages (evidence: `src/tools/scraper.py`)
- Workflow Graph → Citation Validator: validates report
- Job Service → RAG Quality Scorer: scores report quality (evidence: `src/api/job_runner.py`)
- Planner → LLM Provider: generates plan
- Researcher → LLM Provider: analyzes evidence (evidence: `src/agents/researcher.py`)
- Reviewer → LLM Provider: evaluates findings (evidence: `src/agents/reviewer.py`)
- Report Writer → LLM Provider: synthesizes report (evidence: `src/agents/writer.py`)
- LLM Provider → LLM Providers: uses configured model (evidence: `src/core/llm.py`)
- Workflow Graph → Report Writer: emergency synthesis (evidence: `src/graph/builder.py`)
