# ferdaws-c/multi-agentic-rag architecture

> Architecture diagram of the GitHub repository ferdaws-c/multi-agentic-rag, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ferdaws-c/multi-agentic-rag
- Repository: https://github.com/ferdaws-c/multi-agentic-rag

## Overview

Space is a local research workspace for asking questions across uploaded documents, connected SQLite databases, and saved web pages, with source evidence available alongside answers. The main workflow is to add or connect sources, index documents, submit a question in the chat interface, retrieve evidence through quick or multi-agent research, and inspect the cited sources. The graph also includes local model lifecycle and conversation support. Some wiring is only implied by the source index or README; those relationships are dashed rather than asserted as verified calls.

Main entry points: [`app.py`](https://github.com/ferdaws-c/multi-agentic-rag/blob/main/app.py) (Streamlit app), [`research_workflow.py`](https://github.com/ferdaws-c/multi-agentic-rag/blob/main/research_workflow.py) (Research workflow), [`rag_core.py`](https://github.com/ferdaws-c/multi-agentic-rag/blob/main/rag_core.py) (Hybrid retrieval), [`sdk_utils.py`](https://github.com/ferdaws-c/multi-agentic-rag/blob/main/sdk_utils.py) (Local model runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Workspace interface"]
  node_app["Streamlit app<br/>[app.py]"]
  node_webui["Browser workspace"]
  node_chatjobs["Chat jobs<br/>[chat_jobs.py]"]
  node_chatcancel["Cancellable chat"]
  node_history[("Chat history<br/>[chat_history.py]")]
  node_styles["App styling<br/>[app_styles.py]"]
end

subgraph group_library["Library and indexing"]
  node_uploads["File uploads<br/>[chat_uploads.py]"]
  node_libraryfiles["Library files<br/>[library_files.py]"]
  node_ingest["Document ingestion<br/>[ingest.py]"]
  node_index[("Embedding index<br/>[embedding_index.py]")]
end

subgraph group_research["Research and evidence"]
  node_rag["Hybrid retrieval<br/>[rag_core.py]"]
  node_workflow["Research workflow"]
  node_agents["Agent roles<br/>[agent_roles.py]"]
  node_sqlvalidation["SQL validation"]
  node_db_evidence["Database evidence"]
  node_viewer["Source viewer<br/>[source_viewer.py]"]
end

subgraph group_runtime["Sources and runtime"]
  node_connections[("Source connections")]
  node_websources["Saved web pages<br/>[web_sources.py]"]
  node_mcp["Research tools<br/>[space_mcp.py]"]
  node_models["Local model runtime<br/>[sdk_utils.py]"]
  node_modelcompat["Model compatibility<br/>[model_compat.py]"]
  node_storage["Storage maintenance<br/>[storage_tools.py]"]
end

node_user(("Researcher"))

node_user -->|"asks questions"| node_app
node_user -->|"uses browser"| node_webui
node_app -->|"starts job"| node_chatjobs
node_app -.->|"handles uploads"| node_uploads
node_uploads -->|"saves files"| node_libraryfiles
node_libraryfiles -->|"indexes files"| node_ingest
node_ingest -->|"writes embeddings"| node_index
node_app -.->|"runs research"| node_workflow
node_webui -.->|"runs research"| node_workflow
node_workflow -.->|"requests decisions"| node_agents
node_workflow -.->|"retrieves evidence"| node_rag
node_rag -.->|"searches passages"| node_index
node_workflow -.->|"uses research tools"| node_mcp
node_mcp -.->|"accesses sources"| node_connections
node_connections -.->|"saves web pages"| node_websources
node_rag -.->|"formats receipts"| node_db_evidence
node_agents -.->|"validates SQL"| node_sqlvalidation
node_workflow -.->|"uses local models"| node_models
node_rag -.->|"embeds and answers"| node_models
node_models -.->|"checks runtime"| node_modelcompat
node_app -.->|"shows sources"| node_viewer
node_app -.->|"stores conversations"| node_history
node_app -.->|"renders interface"| node_styles
node_app -.->|"manages storage"| node_storage

click node_app "https://github.com/ferdaws-c/multi-agentic-rag/blob/main/app.py"
click node_webui "https://github.com/ferdaws-c/multi-agentic-rag/blob/main/welcome-prototype/workspace_backend.py"
click node_chatjobs "https://github.com/ferdaws-c/multi-agentic-rag/blob/main/chat_jobs.py"
click node_chatcancel "https://github.com/ferdaws-c/multi-agentic-rag/blob/main/cancellable_chat.py"
click node_history "https://github.com/ferdaws-c/multi-agentic-rag/blob/main/chat_history.py"
click node_styles "https://github.com/ferdaws-c/multi-agentic-rag/blob/main/app_styles.py"
click node_uploads "https://github.com/ferdaws-c/multi-agentic-rag/blob/main/chat_uploads.py"
click node_libraryfiles "https://github.com/ferdaws-c/multi-agentic-rag/blob/main/library_files.py"
click node_ingest "https://github.com/ferdaws-c/multi-agentic-rag/blob/main/ingest.py"
click node_index "https://github.com/ferdaws-c/multi-agentic-rag/blob/main/embedding_index.py"
click node_rag "https://github.com/ferdaws-c/multi-agentic-rag/blob/main/rag_core.py"
click node_workflow "https://github.com/ferdaws-c/multi-agentic-rag/blob/main/research_workflow.py"
click node_agents "https://github.com/ferdaws-c/multi-agentic-rag/blob/main/agent_roles.py"
click node_sqlvalidation "https://github.com/ferdaws-c/multi-agentic-rag/blob/main/agent_sql_validation.py"
click node_db_evidence "https://github.com/ferdaws-c/multi-agentic-rag/blob/main/database_evidence.py"
click node_viewer "https://github.com/ferdaws-c/multi-agentic-rag/blob/main/source_viewer.py"
click node_connections "https://github.com/ferdaws-c/multi-agentic-rag/blob/main/source_connections.py"
click node_websources "https://github.com/ferdaws-c/multi-agentic-rag/blob/main/web_sources.py"
click node_mcp "https://github.com/ferdaws-c/multi-agentic-rag/blob/main/space_mcp.py"
click node_models "https://github.com/ferdaws-c/multi-agentic-rag/blob/main/sdk_utils.py"
click node_modelcompat "https://github.com/ferdaws-c/multi-agentic-rag/blob/main/model_compat.py"
click node_storage "https://github.com/ferdaws-c/multi-agentic-rag/blob/main/storage_tools.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_app,node_webui,node_chatjobs,node_chatcancel,node_history,node_styles toneBlue
class node_uploads,node_libraryfiles,node_ingest,node_index toneAmber
class node_rag,node_workflow,node_agents,node_sqlvalidation,node_db_evidence,node_viewer toneMint
class node_connections,node_websources,node_mcp,node_models,node_modelcompat,node_storage toneRose
class node_user toneIndigo
```

## Components

### Workspace interface

- [Streamlit app](https://github.com/ferdaws-c/multi-agentic-rag/blob/main/app.py): `app.py`
- [Browser workspace](https://github.com/ferdaws-c/multi-agentic-rag/blob/main/welcome-prototype/workspace_backend.py): `welcome-prototype/workspace_backend.py`
- [Chat jobs](https://github.com/ferdaws-c/multi-agentic-rag/blob/main/chat_jobs.py): `chat_jobs.py`
- [Cancellable chat](https://github.com/ferdaws-c/multi-agentic-rag/blob/main/cancellable_chat.py): `cancellable_chat.py`
- [Chat history](https://github.com/ferdaws-c/multi-agentic-rag/blob/main/chat_history.py): `chat_history.py`
- [App styling](https://github.com/ferdaws-c/multi-agentic-rag/blob/main/app_styles.py): `app_styles.py`

### Library and indexing

- [File uploads](https://github.com/ferdaws-c/multi-agentic-rag/blob/main/chat_uploads.py): `chat_uploads.py`
- [Library files](https://github.com/ferdaws-c/multi-agentic-rag/blob/main/library_files.py): `library_files.py`
- [Document ingestion](https://github.com/ferdaws-c/multi-agentic-rag/blob/main/ingest.py): `ingest.py`
- [Embedding index](https://github.com/ferdaws-c/multi-agentic-rag/blob/main/embedding_index.py): `embedding_index.py`

### Research and evidence

- [Hybrid retrieval](https://github.com/ferdaws-c/multi-agentic-rag/blob/main/rag_core.py): `rag_core.py`
- [Research workflow](https://github.com/ferdaws-c/multi-agentic-rag/blob/main/research_workflow.py): `research_workflow.py`
- [Agent roles](https://github.com/ferdaws-c/multi-agentic-rag/blob/main/agent_roles.py): `agent_roles.py`
- [SQL validation](https://github.com/ferdaws-c/multi-agentic-rag/blob/main/agent_sql_validation.py): `agent_sql_validation.py`
- [Database evidence](https://github.com/ferdaws-c/multi-agentic-rag/blob/main/database_evidence.py): `database_evidence.py`
- [Source viewer](https://github.com/ferdaws-c/multi-agentic-rag/blob/main/source_viewer.py): `source_viewer.py`

### Sources and runtime

- [Source connections](https://github.com/ferdaws-c/multi-agentic-rag/blob/main/source_connections.py): `source_connections.py`
- [Saved web pages](https://github.com/ferdaws-c/multi-agentic-rag/blob/main/web_sources.py): `web_sources.py`
- [Research tools](https://github.com/ferdaws-c/multi-agentic-rag/blob/main/space_mcp.py): `space_mcp.py`
- [Local model runtime](https://github.com/ferdaws-c/multi-agentic-rag/blob/main/sdk_utils.py): `sdk_utils.py`
- [Model compatibility](https://github.com/ferdaws-c/multi-agentic-rag/blob/main/model_compat.py): `model_compat.py`
- [Storage maintenance](https://github.com/ferdaws-c/multi-agentic-rag/blob/main/storage_tools.py): `storage_tools.py`

### Other components

- **Researcher**

## Connections

- Researcher → Streamlit app: asks questions (evidence: `README.md`)
- Researcher → Browser workspace: uses browser (evidence: `README.md`)
- Streamlit app → Chat jobs: starts job (evidence: `app.py`)
- Streamlit app → File uploads: handles uploads (evidence: `app.py`)
- File uploads → Library files: saves files (evidence: `chat_uploads.py`)
- Library files → Document ingestion: indexes files (evidence: `library_files.py`)
- Document ingestion → Embedding index: writes embeddings (evidence: `ingest.py`)
- Streamlit app → Research workflow: runs research (evidence: `app.py`)
- Browser workspace → Research workflow: runs research (evidence: `welcome-prototype/workspace_backend.py`)
- Research workflow → Agent roles: requests decisions (evidence: `research_workflow.py`)
- Research workflow → Hybrid retrieval: retrieves evidence (evidence: `research_workflow.py`)
- Hybrid retrieval → Embedding index: searches passages (evidence: `rag_core.py`)
- Research workflow → Research tools: uses research tools (evidence: `research_workflow.py`)
- Research tools → Source connections: accesses sources (evidence: `space_mcp.py`)
- Source connections → Saved web pages: saves web pages (evidence: `source_connections.py`)
- Hybrid retrieval → Database evidence: formats receipts (evidence: `rag_core.py`)
- Agent roles → SQL validation: validates SQL (evidence: `agent_roles.py`)
- Research workflow → Local model runtime: uses local models
- Hybrid retrieval → Local model runtime: embeds and answers (evidence: `rag_core.py`)
- Local model runtime → Model compatibility: checks runtime (evidence: `sdk_utils.py`)
- Streamlit app → Source viewer: shows sources (evidence: `app.py`)
- Streamlit app → Chat history: stores conversations (evidence: `app.py`)
- Streamlit app → App styling: renders interface (evidence: `app.py`)
- Streamlit app → Storage maintenance: manages storage (evidence: `app.py`)
