# rajshekharbind/enterprise-multi-agent-rag-platform architecture

> Architecture diagram of the GitHub repository rajshekharbind/enterprise-multi-agent-rag-platform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rajshekharbind/enterprise-multi-agent-rag-platform
- Repository: https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform

## Overview

This is an enterprise multi-agent RAG chat platform. Users create a session, upload PDFs, and ask questions; the chat API loads session memory, routes the query to a general, RAG, or analysis agent, and stores the answer. The document path loads and chunks PDFs, embeds them, and persists a session-specific FAISS index for retrieval. The README also documents document management, memory/session clearing, health/status, and the web UI. Some agent and upload internals were not excerpted; their links are included only where the source index or README supports them.

Main entry points: [`app/api/v1/chat.py`](https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/api/v1/chat.py) (Chat endpoint), [`app/rag/vectorstore.py`](https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/rag/vectorstore.py) (Session vector store), [`app/llm/openai_client.py`](https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/llm/openai_client.py) (LLM client), [`app/main.py`](https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/main.py) (FastAPI app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web client"]
  node_frontend["Chat interface<br/>[page.tsx]"]
end

subgraph group_api["API and sessions"]
  node_server["FastAPI app<br/>[main.py]"]
  node_health["Health and status<br/>[routes.py]"]
  node_chat["Chat endpoint<br/>[chat.py]"]
  node_upload["Document endpoints<br/>[upload.py]"]
end

subgraph group_agents["Agent orchestration"]
  node_router["Query router<br/>[router_agent.py]"]
  node_general["General agent<br/>[general_agent.py]"]
  node_ragagent["RAG agent<br/>[rag_agent.py]"]
  node_analysis["Analysis agent<br/>[analysis_agent.py]"]
  node_llmclient["LLM client<br/>[openai_client.py]"]
end

subgraph group_documents["Document retrieval"]
  node_loader["PDF loader<br/>[loader.py]"]
  node_splitter["Text splitter<br/>[splitter.py]"]
  node_embeddings["Embeddings<br/>[embeddings.py]"]
  node_retriever["Context retriever<br/>[retriever.py]"]
end

subgraph group_persistence["Persistent state"]
  node_vectorstore[("Session vector store<br/>[vectorstore.py]")]
  node_memory["Conversation memory<br/>[memory.py]"]
  node_db[("SQLite database<br/>[db.py]")]
  node_conversation["Conversation records<br/>[conversation.py]"]
  node_base["ORM base<br/>[base.py]"]
end

node_user(("User"))
node_ollama["Ollama LLM"]

node_user -->|"uses"| node_frontend
node_frontend -->|"calls API"| node_server
node_server -->|"mounts route"| node_chat
node_server -->|"mounts route"| node_upload
node_server -->|"mounts route"| node_health
node_chat -->|"reads and writes"| node_memory
node_chat -->|"routes query"| node_router
node_chat -->|"dispatches RAG"| node_ragagent
node_chat -->|"dispatches analysis"| node_analysis
node_chat -->|"dispatches general"| node_general
node_chat -->|"clears session"| node_vectorstore
node_router -->|"classifies query"| node_llmclient
node_general -->|"generates answer"| node_llmclient
node_ragagent -->|"gets session index"| node_vectorstore
node_ragagent -->|"retrieves context"| node_retriever
node_ragagent -->|"generates answer"| node_llmclient
node_analysis -->|"gets session index"| node_vectorstore
node_analysis -->|"retrieves context"| node_retriever
node_analysis -->|"generates analysis"| node_llmclient
node_llmclient -->|"requests completion"| node_ollama
node_upload -->|"loads PDFs"| node_loader
node_upload -->|"splits documents"| node_splitter
node_upload -->|"stores chunks"| node_vectorstore
node_vectorstore -->|"embeds chunks"| node_embeddings
node_retriever -->|"embeds query"| node_embeddings
node_retriever -->|"searches index"| node_vectorstore
node_memory -->|"uses sessions"| node_db
node_memory -->|"persists messages"| node_conversation
node_conversation -->|"maps records"| node_base
node_base -->|"imports ORM base"| node_db

click node_frontend "https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/frontend/app/page.tsx"
click node_server "https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/main.py"
click node_health "https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/api/v1/routes.py"
click node_chat "https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/api/v1/chat.py"
click node_upload "https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/api/v1/upload.py"
click node_router "https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/agents/router_agent.py"
click node_general "https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/agents/general_agent.py"
click node_ragagent "https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/agents/rag_agent.py"
click node_analysis "https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/agents/analysis_agent.py"
click node_llmclient "https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/llm/openai_client.py"
click node_loader "https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/rag/loader.py"
click node_splitter "https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/rag/splitter.py"
click node_embeddings "https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/rag/embeddings.py"
click node_retriever "https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/rag/retriever.py"
click node_vectorstore "https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/rag/vectorstore.py"
click node_memory "https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/agents/memory.py"
click node_db "https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/database/db.py"
click node_conversation "https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/models/conversation.py"
click node_base "https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/database/base.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_frontend,node_user toneBlue
class node_server,node_health,node_chat,node_upload toneAmber
class node_router,node_general,node_ragagent,node_analysis,node_llmclient toneMint
class node_loader,node_splitter,node_embeddings,node_retriever toneRose
class node_vectorstore,node_memory,node_db,node_conversation,node_base,node_ollama toneIndigo
```

## Components

### Web client

- [Chat interface](https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/frontend/app/page.tsx): `frontend/app/page.tsx`

### API and sessions

- [FastAPI app](https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/main.py): `app/main.py`
- [Health and status](https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/api/v1/routes.py): `app/api/v1/routes.py`
- [Chat endpoint](https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/api/v1/chat.py): `app/api/v1/chat.py`
- [Document endpoints](https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/api/v1/upload.py): `app/api/v1/upload.py`

### Agent orchestration

- [Query router](https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/agents/router_agent.py): `app/agents/router_agent.py`
- [General agent](https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/agents/general_agent.py): `app/agents/general_agent.py`
- [RAG agent](https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/agents/rag_agent.py): `app/agents/rag_agent.py`
- [Analysis agent](https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/agents/analysis_agent.py): `app/agents/analysis_agent.py`
- [LLM client](https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/llm/openai_client.py): `app/llm/openai_client.py`

### Document retrieval

- [PDF loader](https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/rag/loader.py): `app/rag/loader.py`
- [Text splitter](https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/rag/splitter.py): `app/rag/splitter.py`
- [Embeddings](https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/rag/embeddings.py): `app/rag/embeddings.py`
- [Context retriever](https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/rag/retriever.py): `app/rag/retriever.py`

### Persistent state

- [Session vector store](https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/rag/vectorstore.py): `app/rag/vectorstore.py`
- [Conversation memory](https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/agents/memory.py): `app/agents/memory.py`
- [SQLite database](https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/database/db.py): `app/database/db.py`
- [Conversation records](https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/models/conversation.py): `app/models/conversation.py`
- [ORM base](https://github.com/rajshekharbind/enterprise-multi-agent-rag-platform/blob/update/fixes/app/database/base.py): `app/database/base.py`

### Other components

- **User**
- **Ollama LLM**

## Connections

- User → Chat interface: uses (evidence: `README.md`)
- Chat interface → FastAPI app: calls API (evidence: `README.md`)
- FastAPI app → Chat endpoint: mounts route (evidence: `app/main.py`)
- FastAPI app → Document endpoints: mounts route (evidence: `app/main.py`)
- FastAPI app → Health and status: mounts route (evidence: `app/main.py`)
- Chat endpoint → Conversation memory: reads and writes (evidence: `app/api/v1/chat.py`)
- Chat endpoint → Query router: routes query (evidence: `app/api/v1/chat.py`)
- Chat endpoint → RAG agent: dispatches RAG (evidence: `app/api/v1/chat.py`)
- Chat endpoint → Analysis agent: dispatches analysis (evidence: `app/api/v1/chat.py`)
- Chat endpoint → General agent: dispatches general (evidence: `app/api/v1/chat.py`)
- Chat endpoint → Session vector store: clears session (evidence: `app/api/v1/chat.py`)
- Query router → LLM client: classifies query (evidence: `app/agents/router_agent.py`)
- General agent → LLM client: generates answer (evidence: `app/agents/general_agent.py`)
- RAG agent → Session vector store: gets session index (evidence: `app/agents/rag_agent.py`)
- RAG agent → Context retriever: retrieves context (evidence: `app/agents/rag_agent.py`)
- RAG agent → LLM client: generates answer (evidence: `app/agents/rag_agent.py`)
- Analysis agent → Session vector store: gets session index (evidence: `app/agents/analysis_agent.py`)
- Analysis agent → Context retriever: retrieves context (evidence: `app/agents/analysis_agent.py`)
- Analysis agent → LLM client: generates analysis (evidence: `app/agents/analysis_agent.py`)
- LLM client → Ollama LLM: requests completion (evidence: `README.md`)
- Document endpoints → PDF loader: loads PDFs (evidence: `app/api/v1/upload.py`)
- Document endpoints → Text splitter: splits documents (evidence: `app/api/v1/upload.py`)
- Document endpoints → Session vector store: stores chunks (evidence: `app/api/v1/upload.py`)
- Session vector store → Embeddings: embeds chunks (evidence: `app/rag/vectorstore.py`)
- Context retriever → Embeddings: embeds query (evidence: `app/rag/retriever.py`)
- Context retriever → Session vector store: searches index (evidence: `app/rag/retriever.py`)
- Conversation memory → SQLite database: uses sessions (evidence: `app/agents/memory.py`)
- Conversation memory → Conversation records: persists messages (evidence: `app/agents/memory.py`)
- Conversation records → ORM base: maps records (evidence: `app/models/conversation.py`)
- ORM base → SQLite database: imports ORM base (evidence: `app/database/base.py`)
