# jayergood/multiagent-search architecture

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

- Interactive diagram: https://gitdiagram.com/jayergood/multiagent-search
- Repository: https://github.com/jayergood/multiagent-search

## Overview

MultiAgent-Search is a FastAPI-backed multi-agent assistant: a browser submits a task, the server starts an asynchronous orchestrator, and the agent combines optional search, SQL, and knowledge-base research with file reading and report-generation tools. The API also supports session uploads, output-file access, and WebSocket progress. The README documents these capabilities; sampled source confirms the server-to-agent dispatch, orchestration setup, database and RAG tool behavior, and context handling. Some tool and monitor wiring is documented but not sampled in full.

Main entry points: [`agent/main_agent.py`](https://github.com/jayergood/multiagent-search/blob/main/agent/main_agent.py) (Main agent), [`api/server.py`](https://github.com/jayergood/multiagent-search/blob/main/api/server.py) (FastAPI server), [`api/monitor.py`](https://github.com/jayergood/multiagent-search/blob/main/api/monitor.py) (WebSocket monitor), [`agent/subagents/network_search_agent.py`](https://github.com/jayergood/multiagent-search/blob/main/agent/subagents/network_search_agent.py) (Search subagent)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web and sessions"]
  node_server["FastAPI server<br/>[server.py]"]
  node_monitor["WebSocket monitor<br/>[monitor.py]"]
  node_context["Session context<br/>[context.py]"]
end

subgraph group_agent["Agent orchestration"]
  node_orchestrator["Main agent<br/>[main_agent.py]"]
  node_llm["Chat model<br/>[llm.py]"]
  node_prompts["Agent prompts<br/>[prompts.py]"]
  node_checkpoint[("Conversation checkpoints<br/>[main_agent.py]")]
end

subgraph group_research["Research integrations"]
  node_search_agent["Search subagent"]
  node_db_agent["Database subagent"]
  node_kb_agent["Knowledge subagent"]
  node_search_tool["Web search tool<br/>[tavily_tool.py]"]
  node_tavily["Tavily search"]
  node_db_tools["SQL query tools<br/>[db_tools.py]"]
  node_mysql[("MySQL database")]
  node_rag_tools["RAGFlow tools<br/>[ragflow_tools.py]"]
  node_ragflow["RAGFlow service"]
end

subgraph group_outputs["Files and reports"]
  node_uploads["Session uploads<br/>[server.py]"]
  node_file_reader["Uploaded file reader"]
  node_markdown["Markdown generator<br/>[markdown_tools.py]"]
  node_pdf["PDF converter<br/>[pdf_tools.py]"]
  node_output["Generated files<br/>[server.py]"]
end

node_browser(("Browser user"))

node_browser -->|"submits task"| node_server
node_server -->|"starts async task"| node_orchestrator
node_browser -->|"uploads files"| node_server
node_server -->|"saves files"| node_uploads
node_server -->|"registers socket"| node_monitor
node_monitor -->|"pushes progress"| node_browser
node_orchestrator -->|"sets session context"| node_context
node_orchestrator -->|"reports progress"| node_monitor
node_orchestrator -->|"uses model"| node_llm
node_orchestrator -->|"loads prompts"| node_prompts
node_orchestrator -->|"persists conversation"| node_checkpoint
node_orchestrator -->|"dispatches task"| node_search_agent
node_orchestrator -->|"dispatches task"| node_db_agent
node_orchestrator -->|"dispatches task"| node_kb_agent
node_search_agent -->|"uses search tool"| node_search_tool
node_search_tool -->|"searches web"| node_tavily
node_db_agent -->|"uses SQL tools"| node_db_tools
node_db_tools -->|"queries"| node_mysql
node_kb_agent -->|"uses knowledge tools"| node_rag_tools
node_rag_tools -->|"queries knowledge"| node_ragflow
node_orchestrator -->|"loads session files"| node_uploads
node_orchestrator -->|"reads uploaded files"| node_file_reader
node_orchestrator -->|"generates report"| node_markdown
node_orchestrator -->|"converts to PDF"| node_pdf
node_orchestrator -->|"writes session output"| node_output
node_server -->|"lists and serves files"| node_output

click node_server "https://github.com/jayergood/multiagent-search/blob/main/api/server.py"
click node_monitor "https://github.com/jayergood/multiagent-search/blob/main/api/monitor.py"
click node_context "https://github.com/jayergood/multiagent-search/blob/main/api/context.py"
click node_orchestrator "https://github.com/jayergood/multiagent-search/blob/main/agent/main_agent.py"
click node_llm "https://github.com/jayergood/multiagent-search/blob/main/agent/llm.py"
click node_prompts "https://github.com/jayergood/multiagent-search/blob/main/agent/prompts.py"
click node_checkpoint "https://github.com/jayergood/multiagent-search/blob/main/agent/main_agent.py"
click node_search_agent "https://github.com/jayergood/multiagent-search/blob/main/agent/subagents/network_search_agent.py"
click node_db_agent "https://github.com/jayergood/multiagent-search/blob/main/agent/subagents/database_query_agent.py"
click node_kb_agent "https://github.com/jayergood/multiagent-search/blob/main/agent/subagents/knowledge_base_agent.py"
click node_search_tool "https://github.com/jayergood/multiagent-search/blob/main/tools/tavily_tool.py"
click node_db_tools "https://github.com/jayergood/multiagent-search/blob/main/tools/db_tools.py"
click node_rag_tools "https://github.com/jayergood/multiagent-search/blob/main/tools/ragflow_tools.py"
click node_uploads "https://github.com/jayergood/multiagent-search/blob/main/api/server.py"
click node_file_reader "https://github.com/jayergood/multiagent-search/blob/main/tools/upload_file_read_tool.py"
click node_markdown "https://github.com/jayergood/multiagent-search/blob/main/tools/markdown_tools.py"
click node_pdf "https://github.com/jayergood/multiagent-search/blob/main/tools/pdf_tools.py"
click node_output "https://github.com/jayergood/multiagent-search/blob/main/api/server.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_server,node_monitor,node_context,node_browser toneBlue
class node_orchestrator,node_llm,node_prompts,node_checkpoint toneAmber
class node_search_agent,node_db_agent,node_kb_agent,node_search_tool,node_tavily,node_db_tools,node_mysql,node_rag_tools,node_ragflow toneMint
class node_uploads,node_file_reader,node_markdown,node_pdf,node_output toneRose
```

## Components

### Web and sessions

- [FastAPI server](https://github.com/jayergood/multiagent-search/blob/main/api/server.py): `api/server.py`
- [WebSocket monitor](https://github.com/jayergood/multiagent-search/blob/main/api/monitor.py): `api/monitor.py`
- [Session context](https://github.com/jayergood/multiagent-search/blob/main/api/context.py): `api/context.py`

### Agent orchestration

- [Main agent](https://github.com/jayergood/multiagent-search/blob/main/agent/main_agent.py): `agent/main_agent.py`
- [Chat model](https://github.com/jayergood/multiagent-search/blob/main/agent/llm.py): `agent/llm.py`
- [Agent prompts](https://github.com/jayergood/multiagent-search/blob/main/agent/prompts.py): `agent/prompts.py`
- [Conversation checkpoints](https://github.com/jayergood/multiagent-search/blob/main/agent/main_agent.py): `agent/main_agent.py`

### Research integrations

- [Search subagent](https://github.com/jayergood/multiagent-search/blob/main/agent/subagents/network_search_agent.py): `agent/subagents/network_search_agent.py`
- [Database subagent](https://github.com/jayergood/multiagent-search/blob/main/agent/subagents/database_query_agent.py): `agent/subagents/database_query_agent.py`
- [Knowledge subagent](https://github.com/jayergood/multiagent-search/blob/main/agent/subagents/knowledge_base_agent.py): `agent/subagents/knowledge_base_agent.py`
- [Web search tool](https://github.com/jayergood/multiagent-search/blob/main/tools/tavily_tool.py): `tools/tavily_tool.py`
- **Tavily search**
- [SQL query tools](https://github.com/jayergood/multiagent-search/blob/main/tools/db_tools.py): `tools/db_tools.py`
- **MySQL database**
- [RAGFlow tools](https://github.com/jayergood/multiagent-search/blob/main/tools/ragflow_tools.py): `tools/ragflow_tools.py`
- **RAGFlow service**

### Files and reports

- [Session uploads](https://github.com/jayergood/multiagent-search/blob/main/api/server.py): `api/server.py`
- [Uploaded file reader](https://github.com/jayergood/multiagent-search/blob/main/tools/upload_file_read_tool.py): `tools/upload_file_read_tool.py`
- [Markdown generator](https://github.com/jayergood/multiagent-search/blob/main/tools/markdown_tools.py): `tools/markdown_tools.py`
- [PDF converter](https://github.com/jayergood/multiagent-search/blob/main/tools/pdf_tools.py): `tools/pdf_tools.py`
- [Generated files](https://github.com/jayergood/multiagent-search/blob/main/api/server.py): `api/server.py`

### Other components

- **Browser user**

## Connections

- Browser user → FastAPI server: submits task
- FastAPI server → Main agent: starts async task
- Browser user → FastAPI server: uploads files
- FastAPI server → Session uploads: saves files
- FastAPI server → WebSocket monitor: registers socket
- WebSocket monitor → Browser user: pushes progress
- Main agent → Session context: sets session context
- Main agent → WebSocket monitor: reports progress
- Main agent → Chat model: uses model
- Main agent → Agent prompts: loads prompts
- Main agent → Conversation checkpoints: persists conversation
- Main agent → Search subagent: dispatches task
- Main agent → Database subagent: dispatches task
- Main agent → Knowledge subagent: dispatches task
- Search subagent → Web search tool: uses search tool
- Web search tool → Tavily search: searches web
- Database subagent → SQL query tools: uses SQL tools
- SQL query tools → MySQL database: queries
- Knowledge subagent → RAGFlow tools: uses knowledge tools
- RAGFlow tools → RAGFlow service: queries knowledge
- Main agent → Session uploads: loads session files
- Main agent → Uploaded file reader: reads uploaded files
- Main agent → Markdown generator: generates report
- Main agent → PDF converter: converts to PDF
- Main agent → Generated files: writes session output
- FastAPI server → Generated files: lists and serves files
