# adithyaks2004/agentic-multitool-rag architecture

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

- Interactive diagram: https://gitdiagram.com/adithyaks2004/agentic-multitool-rag
- Repository: https://github.com/adithyaks2004/agentic-multitool-rag

## Overview

Agentic-Multitool-RAG accepts questions, routes them to document retrieval, web search, calculation, summarization, or document comparison, then returns an answer and records conversation memory. A separate ingestion workflow prepares PDF content for persistent vector retrieval; uploaded documents also have an in-memory retrieval path. The README describes dynamic tool selection and APIs, while the shown agent routes among its implemented tools. Frontend and some tool internals are indexed but not excerpted, so their detailed connections are omitted.

Main entry points: [`backend/agent.py`](https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/backend/agent.py) (Tool Planner), [`backend/main.py`](https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/backend/main.py) (FastAPI Endpoints), [`processing/ingest.py`](https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/processing/ingest.py) (Ingestion Workflow), [`backend/tools/rag_tool.py`](https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/backend/tools/rag_tool.py) (RAG Tool)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User Interface"]
  node_streamlit["Streamlit App<br/>[streamlit_app.py]"]
  node_controller["Agent Controller"]
end

subgraph group_orchestration["Agent Orchestration"]
  node_api["FastAPI Endpoints<br/>[main.py]"]
  node_agent["Tool Planner<br/>[agent.py]"]
  node_memory["Conversation Memory<br/>[memory.py]"]
end

subgraph group_knowledge["Document Knowledge"]
  node_ragtool["RAG Tool<br/>[rag_tool.py]"]
  node_retrieval["Hybrid Retrieval<br/>[rag_pipeline.py]"]
  node_uploadedrag["Uploaded Document RAG<br/>[temp_rag.py]"]
end

subgraph group_tools["Answering Tools"]
  node_web["Web Search<br/>[web_tool.py]"]
  node_calculator["Calculator<br/>[calculator_tool.py]"]
  node_comparison["Document Comparison<br/>[comparison_tool.py]"]
  node_summarizer["Summarizer Tool<br/>[summarizer_tool.py]"]
  node_realtime["Upload Summarizer"]
end

subgraph group_ingestion["PDF Ingestion"]
  node_persistentindex[("Vector Store Builder<br/>[vectorstore.py]")]
  node_pdfloader["PDF Loader<br/>[loader.py]"]
  node_chunker["Document Chunking<br/>[chunking.py]"]
  node_embeddings["Embedding Model<br/>[embeddings.py]"]
  node_ingest["Ingestion Workflow<br/>[ingest.py]"]
end

node_user(("User"))
node_ollama{{"Ollama Model"}}
node_webservice{{"DuckDuckGo Search"}}

node_user -->|"submits query"| node_api
node_api -->|"routes ask"| node_agent
node_api -->|"retrieves directly"| node_retrieval
node_api -->|"runs selected"| node_calculator
node_api -->|"runs selected"| node_web
node_api -->|"summarizes uploads"| node_realtime
node_api -->|"processes uploads"| node_uploadedrag
node_agent -->|"dispatches RAG"| node_ragtool
node_agent -->|"dispatches search"| node_web
node_agent -->|"dispatches calculation"| node_calculator
node_agent -->|"dispatches comparison"| node_comparison
node_agent -->|"dispatches summary"| node_summarizer
node_agent -->|"reads and saves"| node_memory
node_agent -->|"generates answers"| node_ollama
node_ragtool -->|"checks uploaded"| node_uploadedrag
node_ragtool -->|"falls back to"| node_retrieval
node_comparison -->|"retrieves documents"| node_uploadedrag
node_web -->|"searches web"| node_webservice
node_ingest -->|"loads PDFs"| node_pdfloader
node_ingest -->|"splits documents"| node_chunker
node_ingest -->|"gets embeddings"| node_embeddings
node_ingest -->|"builds index"| node_persistentindex

click node_streamlit "https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/frontend/streamlit_app.py"
click node_controller "https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/frontend/agent_controller.py"
click node_api "https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/backend/main.py"
click node_agent "https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/backend/agent.py"
click node_memory "https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/backend/memory.py"
click node_ragtool "https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/backend/tools/rag_tool.py"
click node_retrieval "https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/backend/rag_pipeline.py"
click node_uploadedrag "https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/backend/temp_rag.py"
click node_persistentindex "https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/processing/vectorstore.py"
click node_pdfloader "https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/processing/loader.py"
click node_chunker "https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/processing/chunking.py"
click node_embeddings "https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/processing/embeddings.py"
click node_ingest "https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/processing/ingest.py"
click node_web "https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/backend/tools/web_tool.py"
click node_calculator "https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/backend/tools/calculator_tool.py"
click node_comparison "https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/backend/tools/comparison_tool.py"
click node_summarizer "https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/backend/tools/summarizer_tool.py"
click node_realtime "https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/backend/tools/realtime_summarizer.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_streamlit,node_controller,node_user toneBlue
class node_api,node_agent,node_memory toneAmber
class node_ragtool,node_retrieval,node_uploadedrag toneMint
class node_web,node_calculator,node_comparison,node_summarizer,node_realtime toneRose
class node_persistentindex,node_pdfloader,node_chunker,node_embeddings,node_ingest,node_ollama,node_webservice toneIndigo
```

## Components

### User Interface

- [Streamlit App](https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/frontend/streamlit_app.py): `frontend/streamlit_app.py`
- [Agent Controller](https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/frontend/agent_controller.py): `frontend/agent_controller.py`

### Agent Orchestration

- [FastAPI Endpoints](https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/backend/main.py): `backend/main.py`
- [Tool Planner](https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/backend/agent.py): `backend/agent.py`
- [Conversation Memory](https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/backend/memory.py): `backend/memory.py`

### Document Knowledge

- [RAG Tool](https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/backend/tools/rag_tool.py): `backend/tools/rag_tool.py`
- [Hybrid Retrieval](https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/backend/rag_pipeline.py): `backend/rag_pipeline.py`
- [Uploaded Document RAG](https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/backend/temp_rag.py): `backend/temp_rag.py`

### Answering Tools

- [Web Search](https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/backend/tools/web_tool.py): `backend/tools/web_tool.py`
- [Calculator](https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/backend/tools/calculator_tool.py): `backend/tools/calculator_tool.py`
- [Document Comparison](https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/backend/tools/comparison_tool.py): `backend/tools/comparison_tool.py`
- [Summarizer Tool](https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/backend/tools/summarizer_tool.py): `backend/tools/summarizer_tool.py`
- [Upload Summarizer](https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/backend/tools/realtime_summarizer.py): `backend/tools/realtime_summarizer.py`

### PDF Ingestion

- [Vector Store Builder](https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/processing/vectorstore.py): `processing/vectorstore.py`
- [PDF Loader](https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/processing/loader.py): `processing/loader.py`
- [Document Chunking](https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/processing/chunking.py): `processing/chunking.py`
- [Embedding Model](https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/processing/embeddings.py): `processing/embeddings.py`
- [Ingestion Workflow](https://github.com/adithyaks2004/agentic-multitool-rag/blob/main/processing/ingest.py): `processing/ingest.py`

### Other components

- **User**
- **Ollama Model**
- **DuckDuckGo Search**

## Connections

- User → FastAPI Endpoints: submits query (evidence: `backend/main.py`)
- FastAPI Endpoints → Tool Planner: routes ask (evidence: `backend/main.py`)
- FastAPI Endpoints → Hybrid Retrieval: retrieves directly (evidence: `backend/main.py`)
- FastAPI Endpoints → Calculator: runs selected (evidence: `backend/main.py`)
- FastAPI Endpoints → Web Search: runs selected (evidence: `backend/main.py`)
- FastAPI Endpoints → Upload Summarizer: summarizes uploads (evidence: `backend/main.py`)
- FastAPI Endpoints → Uploaded Document RAG: processes uploads (evidence: `backend/main.py`)
- Tool Planner → RAG Tool: dispatches RAG (evidence: `backend/agent.py`)
- Tool Planner → Web Search: dispatches search (evidence: `backend/agent.py`)
- Tool Planner → Calculator: dispatches calculation (evidence: `backend/agent.py`)
- Tool Planner → Document Comparison: dispatches comparison (evidence: `backend/agent.py`)
- Tool Planner → Summarizer Tool: dispatches summary (evidence: `backend/agent.py`)
- Tool Planner → Conversation Memory: reads and saves (evidence: `backend/agent.py`)
- Tool Planner → Ollama Model: generates answers (evidence: `backend/agent.py`)
- RAG Tool → Uploaded Document RAG: checks uploaded (evidence: `backend/tools/rag_tool.py`)
- RAG Tool → Hybrid Retrieval: falls back to (evidence: `backend/tools/rag_tool.py`)
- Document Comparison → Uploaded Document RAG: retrieves documents (evidence: `backend/tools/comparison_tool.py`)
- Web Search → DuckDuckGo Search: searches web (evidence: `backend/tools/web_tool.py`)
- Ingestion Workflow → PDF Loader: loads PDFs (evidence: `processing/ingest.py`)
- Ingestion Workflow → Document Chunking: splits documents (evidence: `processing/ingest.py`)
- Ingestion Workflow → Embedding Model: gets embeddings (evidence: `processing/ingest.py`)
- Ingestion Workflow → Vector Store Builder: builds index (evidence: `processing/ingest.py`)
