# suhas2204/agentic-rag-engine architecture

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

- Interactive diagram: https://gitdiagram.com/suhas2204/agentic-rag-engine
- Repository: https://github.com/suhas2204/agentic-rag-engine

## Overview

This is an agentic RAG engine for diagram-heavy technical documentation. Documents are parsed, optionally processed for visual content, chunked, embedded, and stored; queries enter through the API and use either baseline retrieval-and-generation or an agentic plan/retrieve/generate/validate loop that can retry. The repository also provides a Streamlit answer-and-trace UI and RAGAS evaluation with MLflow logging. Edges use README statements or shown source references; unsampled subsystem details and UI-to-API wiring are not inferred.

Main entry points: [`src/agentic_rag/agents/orchestrator.py`](https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/agents/orchestrator.py) (Graph orchestrator), [`src/agentic_rag/api/app.py`](https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/api/app.py) (FastAPI endpoints), [`src/agentic_rag/retriever/retriever.py`](https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/retriever/retriever.py) (Retriever), [`src/agentic_rag/evaluation/ragas_eval.py`](https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/evaluation/ragas_eval.py) (RAGAS evaluation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Document ingestion"]
  node_pdf_parser["PDF parser<br/>[parser.py]"]
  node_vision_processing["Diagram vision<br/>[vision.py]"]
  node_chunker["Chunker<br/>[chunker.py]"]
  node_embedder["Embedder<br/>[embedder.py]"]
end

subgraph group_retrieval["Retrieval and storage"]
  node_retriever["Retriever<br/>[retriever.py]"]
  node_reranker["Cross-encoder reranker<br/>[reranker.py]"]
  node_vector_store[("Qdrant vector store<br/>[vector_store.py]")]
end

subgraph group_answering["RAG answering"]
  node_llm_adapters["LLM adapters"]
  node_baseline_rag["Baseline RAG<br/>[baseline.py]"]
  node_agentic_rag["Agentic RAG<br/>[agentic.py]"]
end

subgraph group_agents["Agent workflow"]
  node_orchestrator["Graph orchestrator<br/>[orchestrator.py]"]
  node_planner["Query planner<br/>[planner.py]"]
  node_retriever_agent["Retrieval agent<br/>[retriever_agent.py]"]
  node_validator["Grounding validator<br/>[validator.py]"]
  node_agent_state["Shared agent state<br/>[state.py]"]
  node_agent_utils["Agent utilities<br/>[_utils.py]"]
end

subgraph group_product["Interfaces and evaluation"]
  node_api["FastAPI endpoints<br/>[app.py]"]
  node_api_schemas["API schemas<br/>[schemas.py]"]
  node_streamlit_ui["Streamlit UI<br/>[streamlit_app.py]"]
  node_evaluation["RAGAS evaluation<br/>[ragas_eval.py]"]
  node_evaluation_datasets["Evaluation datasets<br/>[datasets.py]"]
end

node_document_source(("Document source"))
node_user(("Questioner"))
node_mlflow[("MLflow tracking")]

node_document_source -->|"provides PDFs"| node_pdf_parser
node_pdf_parser -->|"passes visuals"| node_vision_processing
node_vision_processing -->|"provides content"| node_chunker
node_chunker -->|"provides chunks"| node_embedder
node_embedder -->|"embeds and upserts"| node_vector_store
node_retriever -->|"embeds queries"| node_embedder
node_retriever -->|"searches vectors"| node_vector_store
node_retriever -->|"reranks hits"| node_reranker
node_baseline_rag -->|"retrieves context"| node_retriever
node_baseline_rag -->|"generates answer"| node_llm_adapters
node_agentic_rag -->|"invokes graph"| node_orchestrator
node_orchestrator -->|"dispatches planning"| node_planner
node_orchestrator -->|"dispatches retrieval"| node_retriever_agent
node_orchestrator -->|"dispatches validation"| node_validator
node_orchestrator -->|"retries retrieval"| node_retriever_agent
node_orchestrator -->|"generates answer"| node_llm_adapters
node_planner -->|"plans queries"| node_llm_adapters
node_retriever_agent -->|"retrieves subqueries"| node_retriever
node_validator -->|"checks grounding"| node_llm_adapters
node_orchestrator -->|"passes state"| node_agent_state
node_planner -->|"uses utilities"| node_agent_utils
node_validator -->|"uses utilities"| node_agent_utils
node_user -->|"submits question"| node_api
node_api -->|"routes query"| node_agentic_rag
node_api -->|"routes baseline"| node_baseline_rag
node_api -->|"uses schemas"| node_api_schemas
node_streamlit_ui -.->|"uses API"| node_api
node_evaluation -->|"evaluates pipeline"| node_baseline_rag
node_evaluation -->|"evaluates pipeline"| node_agentic_rag
node_evaluation -->|"loads questions"| node_evaluation_datasets
node_evaluation -->|"logs metrics"| node_mlflow

click node_pdf_parser "https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/ingestion/parser.py"
click node_vision_processing "https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/ingestion/vision.py"
click node_chunker "https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/ingestion/chunker.py"
click node_embedder "https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/ingestion/embedder.py"
click node_retriever "https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/retriever/retriever.py"
click node_reranker "https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/retriever/reranker.py"
click node_vector_store "https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/retriever/vector_store.py"
click node_llm_adapters "https://github.com/suhas2204/agentic-rag-engine/tree/master/src/agentic_rag/llm"
click node_baseline_rag "https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/rag/baseline.py"
click node_agentic_rag "https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/rag/agentic.py"
click node_orchestrator "https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/agents/orchestrator.py"
click node_planner "https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/agents/planner.py"
click node_retriever_agent "https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/agents/retriever_agent.py"
click node_validator "https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/agents/validator.py"
click node_agent_state "https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/agents/state.py"
click node_agent_utils "https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/agents/_utils.py"
click node_api "https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/api/app.py"
click node_api_schemas "https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/api/schemas.py"
click node_streamlit_ui "https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/ui/streamlit_app.py"
click node_evaluation "https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/evaluation/ragas_eval.py"
click node_evaluation_datasets "https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/evaluation/datasets.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_pdf_parser,node_vision_processing,node_chunker,node_embedder toneBlue
class node_retriever,node_reranker,node_vector_store,node_mlflow toneAmber
class node_llm_adapters,node_baseline_rag,node_agentic_rag toneMint
class node_orchestrator,node_planner,node_retriever_agent,node_validator,node_agent_state,node_agent_utils toneRose
class node_api,node_api_schemas,node_streamlit_ui,node_evaluation,node_evaluation_datasets,node_document_source,node_user toneIndigo
```

## Components

### Document ingestion

- [PDF parser](https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/ingestion/parser.py): `src/agentic_rag/ingestion/parser.py`
- [Diagram vision](https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/ingestion/vision.py): `src/agentic_rag/ingestion/vision.py`
- [Chunker](https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/ingestion/chunker.py): `src/agentic_rag/ingestion/chunker.py`
- [Embedder](https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/ingestion/embedder.py): `src/agentic_rag/ingestion/embedder.py`

### Retrieval and storage

- [Retriever](https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/retriever/retriever.py): `src/agentic_rag/retriever/retriever.py`
- [Cross-encoder reranker](https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/retriever/reranker.py): `src/agentic_rag/retriever/reranker.py`
- [Qdrant vector store](https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/retriever/vector_store.py): `src/agentic_rag/retriever/vector_store.py`

### RAG answering

- [LLM adapters](https://github.com/suhas2204/agentic-rag-engine/tree/master/src/agentic_rag/llm): `src/agentic_rag/llm`
- [Baseline RAG](https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/rag/baseline.py): `src/agentic_rag/rag/baseline.py`
- [Agentic RAG](https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/rag/agentic.py): `src/agentic_rag/rag/agentic.py`

### Agent workflow

- [Graph orchestrator](https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/agents/orchestrator.py): `src/agentic_rag/agents/orchestrator.py`
- [Query planner](https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/agents/planner.py): `src/agentic_rag/agents/planner.py`
- [Retrieval agent](https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/agents/retriever_agent.py): `src/agentic_rag/agents/retriever_agent.py`
- [Grounding validator](https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/agents/validator.py): `src/agentic_rag/agents/validator.py`
- [Shared agent state](https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/agents/state.py): `src/agentic_rag/agents/state.py`
- [Agent utilities](https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/agents/_utils.py): `src/agentic_rag/agents/_utils.py`

### Interfaces and evaluation

- [FastAPI endpoints](https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/api/app.py): `src/agentic_rag/api/app.py`
- [API schemas](https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/api/schemas.py): `src/agentic_rag/api/schemas.py`
- [Streamlit UI](https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/ui/streamlit_app.py): `src/agentic_rag/ui/streamlit_app.py`
- [RAGAS evaluation](https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/evaluation/ragas_eval.py): `src/agentic_rag/evaluation/ragas_eval.py`
- [Evaluation datasets](https://github.com/suhas2204/agentic-rag-engine/blob/master/src/agentic_rag/evaluation/datasets.py): `src/agentic_rag/evaluation/datasets.py`

### Other components

- **Document source**
- **Questioner**
- **MLflow tracking**

## Connections

- Document source → PDF parser: provides PDFs (evidence: `README.md`)
- PDF parser → Diagram vision: passes visuals (evidence: `README.md`)
- Diagram vision → Chunker: provides content (evidence: `README.md`)
- Chunker → Embedder: provides chunks (evidence: `README.md`)
- Embedder → Qdrant vector store: embeds and upserts (evidence: `README.md`)
- Retriever → Embedder: embeds queries (evidence: `src/agentic_rag/retriever/retriever.py`)
- Retriever → Qdrant vector store: searches vectors (evidence: `src/agentic_rag/retriever/retriever.py`)
- Retriever → Cross-encoder reranker: reranks hits (evidence: `src/agentic_rag/retriever/retriever.py`)
- Baseline RAG → Retriever: retrieves context (evidence: `src/agentic_rag/rag/baseline.py`)
- Baseline RAG → LLM adapters: generates answer (evidence: `src/agentic_rag/rag/baseline.py`)
- Agentic RAG → Graph orchestrator: invokes graph (evidence: `src/agentic_rag/rag/agentic.py`)
- Graph orchestrator → Query planner: dispatches planning (evidence: `src/agentic_rag/agents/orchestrator.py`)
- Graph orchestrator → Retrieval agent: dispatches retrieval (evidence: `src/agentic_rag/agents/orchestrator.py`)
- Graph orchestrator → Grounding validator: dispatches validation (evidence: `src/agentic_rag/agents/orchestrator.py`)
- Graph orchestrator → Retrieval agent: retries retrieval (evidence: `src/agentic_rag/agents/orchestrator.py`)
- Graph orchestrator → LLM adapters: generates answer (evidence: `src/agentic_rag/agents/orchestrator.py`)
- Query planner → LLM adapters: plans queries (evidence: `src/agentic_rag/agents/planner.py`)
- Retrieval agent → Retriever: retrieves subqueries (evidence: `src/agentic_rag/agents/retriever_agent.py`)
- Grounding validator → LLM adapters: checks grounding (evidence: `src/agentic_rag/agents/validator.py`)
- Graph orchestrator → Shared agent state: passes state (evidence: `src/agentic_rag/agents/orchestrator.py`)
- Query planner → Agent utilities: uses utilities (evidence: `src/agentic_rag/agents/planner.py`)
- Grounding validator → Agent utilities: uses utilities (evidence: `src/agentic_rag/agents/validator.py`)
- Questioner → FastAPI endpoints: submits question (evidence: `README.md`)
- FastAPI endpoints → Agentic RAG: routes query (evidence: `src/agentic_rag/api/app.py`)
- FastAPI endpoints → Baseline RAG: routes baseline (evidence: `src/agentic_rag/api/app.py`)
- FastAPI endpoints → API schemas: uses schemas (evidence: `src/agentic_rag/api/app.py`)
- Streamlit UI → FastAPI endpoints: uses API
- RAGAS evaluation → Baseline RAG: evaluates pipeline (evidence: `README.md`)
- RAGAS evaluation → Agentic RAG: evaluates pipeline (evidence: `README.md`)
- RAGAS evaluation → Evaluation datasets: loads questions (evidence: `src/agentic_rag/evaluation/ragas_eval.py`)
- RAGAS evaluation → MLflow tracking: logs metrics (evidence: `README.md`)
