# nitinsukthe-g/scout-researchagent architecture

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

- Interactive diagram: https://gitdiagram.com/nitinsukthe-g/scout-researchagent
- Repository: https://github.com/nitinsukthe-g/scout-researchagent

## Overview

Scout is an autonomous research agent: a user submits a topic through Mission Control or the terminal, then the agent recalls prior knowledge, plans research steps, executes tool-using ReAct loops, replans, writes and validates a cited report, critiques it, and stores lessons and findings for future runs. The FastAPI server exposes runs and streams events to the web interface; the CLI is an alternate interface. The graph includes the documented memory, web research, replay, trace, report, and memory-dashboard capabilities. Some frontend and backend wiring is supported by README or source-index references rather than sampled implementation excerpts.

Main entry points: [`scout/agent/orchestrator.py`](https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/agent/orchestrator.py) (Research orchestrator), [`scout/llm.py`](https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/llm.py) (Sarvam client), [`web/js/mission.js`](https://github.com/nitinsukthe-g/scout-researchagent/blob/main/web/js/mission.js) (Mission Control UI), [`scout/agent/executor.py`](https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/agent/executor.py) (ReAct executor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_mission_ui["Mission Control UI<br/>[mission.js]"]
  node_history_ui["Run history<br/>[history.js]"]
  node_memory_ui["Memory dashboard<br/>[memory.js]"]
  node_report_ui["Report viewer<br/>[report.js]"]
  node_trace_ui["Live trace<br/>[trace.js]"]
  node_flow_ui["Flow diagram<br/>[flow.js]"]
  node_api_client["API client<br/>[api.js]"]
  node_cli["Terminal CLI<br/>[cli.py]"]
  node_server["FastAPI server<br/>[server.py]"]
end

subgraph group_workflow["Research workflow"]
  node_orchestrator["Research orchestrator<br/>[orchestrator.py]"]
  node_planner["Planner and replanner<br/>[planner.py]"]
  node_executor["ReAct executor<br/>[executor.py]"]
  node_writer["Writer and critic<br/>[writer.py]"]
  node_reflector["Reflector<br/>[reflector.py]"]
  node_prompts["Agent prompts<br/>[prompts.py]"]
end

subgraph group_research["Research tools"]
  node_registry["Tool registry<br/>[registry.py]"]
  node_web_tools["Web research tools<br/>[web.py]"]
  node_local_tools["Local tools<br/>[local.py]"]
end

subgraph group_memory["Learning and memory"]
  node_memory_store[("Long-term memory<br/>[store.py]")]
end

subgraph group_foundation["Runtime foundation"]
  node_state["Run state and events<br/>[state.py]"]
  node_llm["Sarvam client<br/>[llm.py]"]
  node_settings["Runtime settings<br/>[config.py]"]
end

node_user(("Researcher"))
node_sarvam{{"Sarvam AI"}}
node_web_services{{"Search and source sites"}}

node_user -->|"submits mission"| node_mission_ui
node_user -->|"runs research"| node_cli
node_mission_ui -->|"requests and subscribes"| node_api_client
node_history_ui -->|"loads history"| node_api_client
node_memory_ui -->|"loads memory"| node_api_client
node_mission_ui -->|"renders flow"| node_flow_ui
node_mission_ui -->|"renders report"| node_report_ui
node_mission_ui -->|"renders trace"| node_trace_ui
node_api_client -->|"calls API and SSE"| node_server
node_cli -->|"runs agent"| node_orchestrator
node_server -->|"starts agent"| node_orchestrator
node_orchestrator -->|"recalls and persists"| node_memory_store
node_orchestrator -->|"plans and replans"| node_planner
node_orchestrator -->|"executes steps"| node_executor
node_orchestrator -->|"writes and critiques"| node_writer
node_orchestrator -->|"extracts learning"| node_reflector
node_executor -->|"dispatches tools"| node_registry
node_registry -->|"dispatches web tools"| node_web_tools
node_registry -->|"dispatches local tools"| node_local_tools
node_web_tools -->|"searches and fetches"| node_web_services
node_web_tools -->|"reads reputation and records fetches"| node_memory_store
node_web_tools -->|"registers sources"| node_state
node_executor -->|"updates run state"| node_state
node_orchestrator -->|"emits workflow events"| node_state
node_planner -->|"requests plan"| node_llm
node_executor -->|"reasons and selects tools"| node_llm
node_writer -->|"drafts and critiques"| node_llm
node_reflector -->|"distills learning"| node_llm
node_llm -->|"sends model requests"| node_sarvam
node_orchestrator -->|"uses agent prompts"| node_prompts
node_executor -->|"uses ReAct prompts"| node_prompts
node_llm -->|"loads configuration"| node_settings
node_orchestrator -->|"configures workflow"| node_settings
node_registry -->|"uses tool settings"| node_settings
node_server -->|"creates run state"| node_state
node_server -->|"serves memory and history"| node_memory_store
node_reflector -->|"stores lessons and knowledge"| node_memory_store
node_writer -->|"validates citations"| node_state

click node_mission_ui "https://github.com/nitinsukthe-g/scout-researchagent/blob/main/web/js/mission.js"
click node_history_ui "https://github.com/nitinsukthe-g/scout-researchagent/blob/main/web/js/history.js"
click node_memory_ui "https://github.com/nitinsukthe-g/scout-researchagent/blob/main/web/js/memory.js"
click node_report_ui "https://github.com/nitinsukthe-g/scout-researchagent/blob/main/web/js/report.js"
click node_trace_ui "https://github.com/nitinsukthe-g/scout-researchagent/blob/main/web/js/trace.js"
click node_flow_ui "https://github.com/nitinsukthe-g/scout-researchagent/blob/main/web/js/flow.js"
click node_api_client "https://github.com/nitinsukthe-g/scout-researchagent/blob/main/web/js/api.js"
click node_cli "https://github.com/nitinsukthe-g/scout-researchagent/blob/main/cli.py"
click node_server "https://github.com/nitinsukthe-g/scout-researchagent/blob/main/server.py"
click node_orchestrator "https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/agent/orchestrator.py"
click node_planner "https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/agent/planner.py"
click node_executor "https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/agent/executor.py"
click node_writer "https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/agent/writer.py"
click node_reflector "https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/agent/reflector.py"
click node_prompts "https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/agent/prompts.py"
click node_state "https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/state.py"
click node_llm "https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/llm.py"
click node_settings "https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/config.py"
click node_registry "https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/tools/registry.py"
click node_web_tools "https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/tools/web.py"
click node_local_tools "https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/tools/local.py"
click node_memory_store "https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/memory/store.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_mission_ui,node_history_ui,node_memory_ui,node_report_ui,node_trace_ui,node_flow_ui,node_api_client,node_cli,node_server toneBlue
class node_orchestrator,node_planner,node_executor,node_writer,node_reflector,node_prompts toneAmber
class node_registry,node_web_tools,node_local_tools toneMint
class node_memory_store toneRose
class node_state,node_llm,node_settings,node_user,node_sarvam,node_web_services toneIndigo
```

## Components

### User interfaces

- [Mission Control UI](https://github.com/nitinsukthe-g/scout-researchagent/blob/main/web/js/mission.js): `web/js/mission.js`
- [Run history](https://github.com/nitinsukthe-g/scout-researchagent/blob/main/web/js/history.js): `web/js/history.js`
- [Memory dashboard](https://github.com/nitinsukthe-g/scout-researchagent/blob/main/web/js/memory.js): `web/js/memory.js`
- [Report viewer](https://github.com/nitinsukthe-g/scout-researchagent/blob/main/web/js/report.js): `web/js/report.js`
- [Live trace](https://github.com/nitinsukthe-g/scout-researchagent/blob/main/web/js/trace.js): `web/js/trace.js`
- [Flow diagram](https://github.com/nitinsukthe-g/scout-researchagent/blob/main/web/js/flow.js): `web/js/flow.js`
- [API client](https://github.com/nitinsukthe-g/scout-researchagent/blob/main/web/js/api.js): `web/js/api.js`
- [Terminal CLI](https://github.com/nitinsukthe-g/scout-researchagent/blob/main/cli.py): `cli.py`
- [FastAPI server](https://github.com/nitinsukthe-g/scout-researchagent/blob/main/server.py): `server.py`

### Research workflow

- [Research orchestrator](https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/agent/orchestrator.py): `scout/agent/orchestrator.py`
- [Planner and replanner](https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/agent/planner.py): `scout/agent/planner.py`
- [ReAct executor](https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/agent/executor.py): `scout/agent/executor.py`
- [Writer and critic](https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/agent/writer.py): `scout/agent/writer.py`
- [Reflector](https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/agent/reflector.py): `scout/agent/reflector.py`
- [Agent prompts](https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/agent/prompts.py): `scout/agent/prompts.py`

### Research tools

- [Tool registry](https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/tools/registry.py): `scout/tools/registry.py`
- [Web research tools](https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/tools/web.py): `scout/tools/web.py`
- [Local tools](https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/tools/local.py): `scout/tools/local.py`

### Learning and memory

- [Long-term memory](https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/memory/store.py): `scout/memory/store.py`

### Runtime foundation

- [Run state and events](https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/state.py): `scout/state.py`
- [Sarvam client](https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/llm.py): `scout/llm.py`
- [Runtime settings](https://github.com/nitinsukthe-g/scout-researchagent/blob/main/scout/config.py): `scout/config.py`

### Other components

- **Researcher**
- **Sarvam AI**
- **Search and source sites**

## Connections

- Researcher → Mission Control UI: submits mission (evidence: `README.md`)
- Researcher → Terminal CLI: runs research (evidence: `README.md`)
- Mission Control UI → API client: requests and subscribes (evidence: `web/js/mission.js`)
- Run history → API client: loads history (evidence: `web/js/history.js`)
- Memory dashboard → API client: loads memory (evidence: `web/js/memory.js`)
- Mission Control UI → Flow diagram: renders flow (evidence: `web/js/mission.js`)
- Mission Control UI → Report viewer: renders report (evidence: `web/js/mission.js`)
- Mission Control UI → Live trace: renders trace (evidence: `web/js/mission.js`)
- API client → FastAPI server: calls API and SSE (evidence: `README.md`)
- Terminal CLI → Research orchestrator: runs agent (evidence: `README.md`)
- FastAPI server → Research orchestrator: starts agent (evidence: `server.py`)
- Research orchestrator → Long-term memory: recalls and persists (evidence: `scout/agent/orchestrator.py`)
- Research orchestrator → Planner and replanner: plans and replans (evidence: `scout/agent/orchestrator.py`)
- Research orchestrator → ReAct executor: executes steps (evidence: `scout/agent/orchestrator.py`)
- Research orchestrator → Writer and critic: writes and critiques (evidence: `scout/agent/orchestrator.py`)
- Research orchestrator → Reflector: extracts learning (evidence: `scout/agent/orchestrator.py`)
- ReAct executor → Tool registry: dispatches tools (evidence: `scout/agent/executor.py`)
- Tool registry → Web research tools: dispatches web tools (evidence: `scout/tools/registry.py`)
- Tool registry → Local tools: dispatches local tools (evidence: `scout/tools/registry.py`)
- Web research tools → Search and source sites: searches and fetches (evidence: `scout/tools/web.py`)
- Web research tools → Long-term memory: reads reputation and records fetches (evidence: `scout/tools/web.py`)
- Web research tools → Run state and events: registers sources (evidence: `scout/tools/web.py`)
- ReAct executor → Run state and events: updates run state (evidence: `scout/agent/executor.py`)
- Research orchestrator → Run state and events: emits workflow events (evidence: `scout/agent/orchestrator.py`)
- Planner and replanner → Sarvam client: requests plan (evidence: `scout/agent/planner.py`)
- ReAct executor → Sarvam client: reasons and selects tools (evidence: `scout/agent/executor.py`)
- Writer and critic → Sarvam client: drafts and critiques (evidence: `README.md`)
- Reflector → Sarvam client: distills learning (evidence: `scout/agent/reflector.py`)
- Sarvam client → Sarvam AI: sends model requests (evidence: `README.md`)
- Research orchestrator → Agent prompts: uses agent prompts (evidence: `scout/agent/orchestrator.py`)
- ReAct executor → Agent prompts: uses ReAct prompts (evidence: `scout/agent/executor.py`)
- Sarvam client → Runtime settings: loads configuration (evidence: `scout/llm.py`)
- Research orchestrator → Runtime settings: configures workflow (evidence: `scout/agent/orchestrator.py`)
- Tool registry → Runtime settings: uses tool settings (evidence: `scout/tools/registry.py`)
- FastAPI server → Run state and events: creates run state (evidence: `server.py`)
- FastAPI server → Long-term memory: serves memory and history (evidence: `server.py`)
- Reflector → Long-term memory: stores lessons and knowledge (evidence: `scout/agent/orchestrator.py`)
- Writer and critic → Run state and events: validates citations (evidence: `README.md`)
