# maheshwaree-02/researchpilot-ai architecture

> Architecture diagram of the GitHub repository maheshwaree-02/researchpilot-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/maheshwaree-02/researchpilot-ai
- Repository: https://github.com/maheshwaree-02/researchpilot-ai

## Overview

ResearchPilot AI is a Streamlit research assistant whose primary workflow takes a user's topic and goals through an editable plan, web research and citation capture, report synthesis, optional review, and saved/displayed results. The README also describes a distinct distributed-systems suite; it is represented as a capability branch, but detailed internal links are limited where those modules were not excerpted. Edges are limited to relationships shown by excerpts, the source index, or README; unsampled subsystem connections are omitted.

Main entry points: [`main.py`](https://github.com/maheshwaree-02/researchpilot-ai/blob/main/main.py) (App Workflow), [`agents/researcher.py`](https://github.com/maheshwaree-02/researchpilot-ai/blob/main/agents/researcher.py) (Research Agent), [`agents/writer.py`](https://github.com/maheshwaree-02/researchpilot-ai/blob/main/agents/writer.py) (Writing Agent), [`core/llm.py`](https://github.com/maheshwaree-02/researchpilot-ai/blob/main/core/llm.py) (LLM Routing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Research Workflow"]
  node_main["App Workflow<br/>[main.py]"]
  node_planner["Planning Agent<br/>[planner.py]"]
  node_researcher["Research Agent<br/>[researcher.py]"]
  node_writer["Writing Agent<br/>[writer.py]"]
  node_reviewer["Review Agent<br/>[reviewer.py]"]
end

subgraph group_shared["Shared Services"]
  node_state["Pipeline State<br/>[state.py]"]
  node_llm["LLM Routing<br/>[llm.py]"]
  node_citations["Citation Manager"]
  node_search["Web Search<br/>[search.py]"]
  node_rag[("RAG Memory<br/>[vectorstore.py]")]
  node_history["Research History<br/>[history.py]"]
  node_db[("Research Database<br/>[schema.py]")]
  node_settings["Configuration<br/>[settings.py]"]
end

subgraph group_interface["User Interface"]
  node_frontend["Streamlit Interface<br/>[main.py]"]
  node_progress["Progress View<br/>[progress.py]"]
  node_report["Report Viewer<br/>[report_viewer.py]"]
  node_sidebar["History Sidebar<br/>[sidebar.py]"]
end

subgraph group_distributed["Distributed Systems"]
  node_distributed["Distributed Suite"]
end

node_user(("Researcher"))
node_actor_llm(("LLM Providers"))
node_web(("Web Sources"))

node_user -->|"submits topic"| node_main
node_main -->|"creates plan"| node_planner
node_main -->|"runs research"| node_researcher
node_main -->|"generates report"| node_writer
node_main -->|"requests review"| node_reviewer
node_main -->|"maintains"| node_state
node_main -->|"saves history"| node_db
node_main -->|"renders views"| node_frontend
node_frontend -->|"renders"| node_progress
node_frontend -->|"renders"| node_report
node_frontend -->|"loads history"| node_sidebar
node_planner -->|"updates plan"| node_state
node_planner -->|"generates text"| node_llm
node_researcher -->|"searches and browses"| node_search
node_search -->|"requests pages"| node_web
node_researcher -->|"records sources"| node_citations
node_researcher -->|"synthesizes findings"| node_llm
node_researcher -->|"adds findings"| node_state
node_writer -->|"retrieves context"| node_rag
node_writer -->|"stores research"| node_rag
node_writer -->|"formats references"| node_citations
node_writer -->|"writes report"| node_llm
node_reviewer -->|"scores report"| node_llm
node_llm -->|"routes generation"| node_actor_llm
node_rag -->|"reads settings"| node_settings
node_db -->|"reads URL"| node_settings
node_history -->|"uses models"| node_db
node_sidebar -->|"loads records"| node_history
node_sidebar -->|"queries records"| node_db
node_distributed -.->|"offers infrastructure capabilities"| node_user

click node_main "https://github.com/maheshwaree-02/researchpilot-ai/blob/main/main.py"
click node_planner "https://github.com/maheshwaree-02/researchpilot-ai/blob/main/agents/planner.py"
click node_researcher "https://github.com/maheshwaree-02/researchpilot-ai/blob/main/agents/researcher.py"
click node_writer "https://github.com/maheshwaree-02/researchpilot-ai/blob/main/agents/writer.py"
click node_reviewer "https://github.com/maheshwaree-02/researchpilot-ai/blob/main/agents/reviewer.py"
click node_state "https://github.com/maheshwaree-02/researchpilot-ai/blob/main/core/state.py"
click node_llm "https://github.com/maheshwaree-02/researchpilot-ai/blob/main/core/llm.py"
click node_citations "https://github.com/maheshwaree-02/researchpilot-ai/blob/main/core/citation_manager.py"
click node_search "https://github.com/maheshwaree-02/researchpilot-ai/blob/main/tools/search.py"
click node_rag "https://github.com/maheshwaree-02/researchpilot-ai/blob/main/rag/vectorstore.py"
click node_history "https://github.com/maheshwaree-02/researchpilot-ai/blob/main/core/history.py"
click node_db "https://github.com/maheshwaree-02/researchpilot-ai/blob/main/database/schema.py"
click node_settings "https://github.com/maheshwaree-02/researchpilot-ai/blob/main/config/settings.py"
click node_frontend "https://github.com/maheshwaree-02/researchpilot-ai/blob/main/main.py"
click node_progress "https://github.com/maheshwaree-02/researchpilot-ai/blob/main/frontend/components/progress.py"
click node_report "https://github.com/maheshwaree-02/researchpilot-ai/blob/main/frontend/components/report_viewer.py"
click node_sidebar "https://github.com/maheshwaree-02/researchpilot-ai/blob/main/frontend/components/sidebar.py"
click node_distributed "https://github.com/maheshwaree-02/researchpilot-ai/tree/main/grpc_experiment"

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_main,node_planner,node_researcher,node_writer,node_reviewer toneBlue
class node_state,node_llm,node_citations,node_search,node_rag,node_history,node_db,node_settings toneAmber
class node_frontend,node_progress,node_report,node_sidebar toneMint
class node_distributed toneRose
class node_user,node_actor_llm,node_web toneIndigo
```

## Components

### Research Workflow

- [App Workflow](https://github.com/maheshwaree-02/researchpilot-ai/blob/main/main.py): `main.py`
- [Planning Agent](https://github.com/maheshwaree-02/researchpilot-ai/blob/main/agents/planner.py): `agents/planner.py`
- [Research Agent](https://github.com/maheshwaree-02/researchpilot-ai/blob/main/agents/researcher.py): `agents/researcher.py`
- [Writing Agent](https://github.com/maheshwaree-02/researchpilot-ai/blob/main/agents/writer.py): `agents/writer.py`
- [Review Agent](https://github.com/maheshwaree-02/researchpilot-ai/blob/main/agents/reviewer.py): `agents/reviewer.py`

### Shared Services

- [Pipeline State](https://github.com/maheshwaree-02/researchpilot-ai/blob/main/core/state.py): `core/state.py`
- [LLM Routing](https://github.com/maheshwaree-02/researchpilot-ai/blob/main/core/llm.py): `core/llm.py`
- [Citation Manager](https://github.com/maheshwaree-02/researchpilot-ai/blob/main/core/citation_manager.py): `core/citation_manager.py`
- [Web Search](https://github.com/maheshwaree-02/researchpilot-ai/blob/main/tools/search.py): `tools/search.py`
- [RAG Memory](https://github.com/maheshwaree-02/researchpilot-ai/blob/main/rag/vectorstore.py): `rag/vectorstore.py`
- [Research History](https://github.com/maheshwaree-02/researchpilot-ai/blob/main/core/history.py): `core/history.py`
- [Research Database](https://github.com/maheshwaree-02/researchpilot-ai/blob/main/database/schema.py): `database/schema.py`
- [Configuration](https://github.com/maheshwaree-02/researchpilot-ai/blob/main/config/settings.py): `config/settings.py`

### User Interface

- [Streamlit Interface](https://github.com/maheshwaree-02/researchpilot-ai/blob/main/main.py): `main.py`
- [Progress View](https://github.com/maheshwaree-02/researchpilot-ai/blob/main/frontend/components/progress.py): `frontend/components/progress.py`
- [Report Viewer](https://github.com/maheshwaree-02/researchpilot-ai/blob/main/frontend/components/report_viewer.py): `frontend/components/report_viewer.py`
- [History Sidebar](https://github.com/maheshwaree-02/researchpilot-ai/blob/main/frontend/components/sidebar.py): `frontend/components/sidebar.py`

### Distributed Systems

- [Distributed Suite](https://github.com/maheshwaree-02/researchpilot-ai/tree/main/grpc_experiment): `grpc_experiment`

### Other components

- **Researcher**
- **LLM Providers**
- **Web Sources**

## Connections

- Researcher → App Workflow: submits topic (evidence: `main.py`)
- App Workflow → Planning Agent: creates plan (evidence: `main.py`)
- App Workflow → Research Agent: runs research (evidence: `main.py`)
- App Workflow → Writing Agent: generates report (evidence: `main.py`)
- App Workflow → Review Agent: requests review (evidence: `main.py`)
- App Workflow → Pipeline State: maintains (evidence: `main.py`)
- App Workflow → Research Database: saves history (evidence: `main.py`)
- App Workflow → Streamlit Interface: renders views (evidence: `main.py`)
- Streamlit Interface → Progress View: renders (evidence: `main.py`)
- Streamlit Interface → Report Viewer: renders (evidence: `main.py`)
- Streamlit Interface → History Sidebar: loads history (evidence: `frontend/components/sidebar.py`)
- Planning Agent → Pipeline State: updates plan (evidence: `agents/planner.py`)
- Planning Agent → LLM Routing: generates text
- Research Agent → Web Search: searches and browses (evidence: `agents/researcher.py`)
- Web Search → Web Sources: requests pages
- Research Agent → Citation Manager: records sources (evidence: `agents/researcher.py`)
- Research Agent → LLM Routing: synthesizes findings (evidence: `agents/researcher.py`)
- Research Agent → Pipeline State: adds findings (evidence: `agents/researcher.py`)
- Writing Agent → RAG Memory: retrieves context (evidence: `agents/writer.py`)
- Writing Agent → RAG Memory: stores research (evidence: `agents/writer.py`)
- Writing Agent → Citation Manager: formats references (evidence: `agents/writer.py`)
- Writing Agent → LLM Routing: writes report
- Review Agent → LLM Routing: scores report
- LLM Routing → LLM Providers: routes generation (evidence: `core/llm.py`)
- RAG Memory → Configuration: reads settings (evidence: `rag/vectorstore.py`)
- Research Database → Configuration: reads URL (evidence: `database/connection.py`)
- Research History → Research Database: uses models (evidence: `core/history.py`)
- History Sidebar → Research History: loads records (evidence: `frontend/components/sidebar.py`)
- History Sidebar → Research Database: queries records (evidence: `frontend/components/sidebar.py`)
- Distributed Suite → Researcher: offers infrastructure capabilities (evidence: `README.md`)
