# pokurilahari/multi-agent-ai-document-system architecture

> Architecture diagram of the GitHub repository pokurilahari/multi-agent-ai-document-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pokurilahari/multi-agent-ai-document-system
- Repository: https://github.com/pokurilahari/multi-agent-ai-document-system

## Overview

This repository combines a Streamlit document-query application with a FastAPI foundation. The principal workflow is document extraction and chunking, vector indexing, query-time retrieval, intent routing, and an agent-produced response. The README also describes planned ingestion formats and RAG capabilities; these are distinguished from the currently implemented backend foundation. Relationships are based on sampled code, SOURCE INDEX references, or README statements; unsampled implementation details are not inferred.

Main entry points: [`agents/orchestrator.py`](https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/agents/orchestrator.py) (Intent orchestrator), [`agents/__init__.py`](https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/agents/__init__.py) (LLM agent base), [`app.py`](https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/app.py) (Query dashboard), [`backend/app/main.py`](https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/backend/app/main.py) (FastAPI endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_streamlit["Query dashboard<br/>[app.py]"]
  node_frontend["Backend dashboard<br/>[app.py]"]
end

subgraph group_retrieval["Document retrieval"]
  node_chunking["Document chunking<br/>[chunker.py]"]
  node_vector[("Vector store<br/>[embedder.py]")]
end

subgraph group_reasoning["Agent reasoning"]
  node_orchestrator["Intent orchestrator<br/>[orchestrator.py]"]
  node_reader["Document reader<br/>[reader.py]"]
  node_summariser["Summariser<br/>[summariser.py]"]
  node_analyser["Analyser<br/>[analyser.py]"]
  node_qa["Question answering<br/>[qa_agent.py]"]
  node_writer["Document writer<br/>[writer.py]"]
  node_crew["Crew execution<br/>[crew_builder.py]"]
  node_base_agent["LLM agent base<br/>[__init__.py]"]
end

subgraph group_service["API services"]
  node_api["FastAPI endpoints<br/>[main.py]"]
  node_settings["API settings<br/>[config.py]"]
end

subgraph group_state["State and observability"]
  node_database[("SQLite metadata<br/>[database.py]")]
  node_logger["Timing and logs<br/>[logger.py]"]
  node_memory["Session memory<br/>[store.py]"]
end

node_user(("User"))
node_ollama{{"Ollama model service"}}
node_sqlite[("SQLite")]

node_user -->|"submits query"| node_streamlit
node_streamlit -->|"chunks documents"| node_chunking
node_chunking -.->|"provides chunks"| node_vector
node_streamlit -->|"indexes and searches"| node_vector
node_streamlit -->|"routes query"| node_orchestrator
node_orchestrator -->|"searches chunks"| node_vector
node_orchestrator -->|"routes READ"| node_reader
node_orchestrator -->|"routes summary"| node_summariser
node_orchestrator -->|"routes analysis"| node_analyser
node_orchestrator -->|"routes questions"| node_qa
node_orchestrator -->|"routes writing"| node_writer
node_orchestrator -->|"builds crew"| node_crew
node_reader -.->|"inherits from"| node_base_agent
node_summariser -.->|"inherits from"| node_base_agent
node_analyser -.->|"inherits from"| node_base_agent
node_qa -.->|"inherits from"| node_base_agent
node_writer -.->|"inherits from"| node_base_agent
node_base_agent -->|"invokes model"| node_ollama
node_orchestrator -->|"classifies intent"| node_ollama
node_user -->|"uses dashboard"| node_frontend
node_frontend -.->|"calls API"| node_api
node_api -->|"loads settings"| node_settings
node_api -->|"initializes tables"| node_database
node_api -->|"records metrics"| node_logger
node_database -->|"persists records"| node_sqlite

click node_streamlit "https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/app.py"
click node_frontend "https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/frontend/app.py"
click node_chunking "https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/pipeline/chunker.py"
click node_vector "https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/pipeline/embedder.py"
click node_orchestrator "https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/agents/orchestrator.py"
click node_reader "https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/agents/reader.py"
click node_summariser "https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/agents/summariser.py"
click node_analyser "https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/agents/analyser.py"
click node_qa "https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/agents/qa_agent.py"
click node_writer "https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/agents/writer.py"
click node_crew "https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/agents/crew_builder.py"
click node_base_agent "https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/agents/__init__.py"
click node_api "https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/backend/app/main.py"
click node_settings "https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/backend/app/config.py"
click node_database "https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/backend/app/database.py"
click node_logger "https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/backend/app/utils/logger.py"
click node_memory "https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/memory/store.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_frontend,node_user toneBlue
class node_chunking,node_vector,node_sqlite toneAmber
class node_orchestrator,node_reader,node_summariser,node_analyser,node_qa,node_writer,node_crew,node_base_agent toneMint
class node_api,node_settings toneRose
class node_database,node_logger,node_memory,node_ollama toneIndigo
```

## Components

### User experience

- [Query dashboard](https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/app.py): `app.py`
- [Backend dashboard](https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/frontend/app.py): `frontend/app.py`

### Document retrieval

- [Document chunking](https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/pipeline/chunker.py): `pipeline/chunker.py`
- [Vector store](https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/pipeline/embedder.py): `pipeline/embedder.py`

### Agent reasoning

- [Intent orchestrator](https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/agents/orchestrator.py): `agents/orchestrator.py`
- [Document reader](https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/agents/reader.py): `agents/reader.py`
- [Summariser](https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/agents/summariser.py): `agents/summariser.py`
- [Analyser](https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/agents/analyser.py): `agents/analyser.py`
- [Question answering](https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/agents/qa_agent.py): `agents/qa_agent.py`
- [Document writer](https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/agents/writer.py): `agents/writer.py`
- [Crew execution](https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/agents/crew_builder.py): `agents/crew_builder.py`
- [LLM agent base](https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/agents/__init__.py): `agents/__init__.py`

### API services

- [FastAPI endpoints](https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/backend/app/main.py): `backend/app/main.py`
- [API settings](https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/backend/app/config.py): `backend/app/config.py`

### State and observability

- [SQLite metadata](https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/backend/app/database.py): `backend/app/database.py`
- [Timing and logs](https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/backend/app/utils/logger.py): `backend/app/utils/logger.py`
- [Session memory](https://github.com/pokurilahari/multi-agent-ai-document-system/blob/main/memory/store.py): `memory/store.py`

### Other components

- **User**
- **Ollama model service**
- **SQLite**

## Connections

- User → Query dashboard: submits query (evidence: `README.md`)
- Query dashboard → Document chunking: chunks documents (evidence: `app.py`)
- Document chunking → Vector store: provides chunks
- Query dashboard → Vector store: indexes and searches (evidence: `app.py`)
- Query dashboard → Intent orchestrator: routes query (evidence: `app.py`)
- Intent orchestrator → Vector store: searches chunks (evidence: `agents/orchestrator.py`)
- Intent orchestrator → Document reader: routes READ (evidence: `agents/orchestrator.py`)
- Intent orchestrator → Summariser: routes summary (evidence: `agents/orchestrator.py`)
- Intent orchestrator → Analyser: routes analysis (evidence: `agents/orchestrator.py`)
- Intent orchestrator → Question answering: routes questions (evidence: `agents/orchestrator.py`)
- Intent orchestrator → Document writer: routes writing (evidence: `agents/orchestrator.py`)
- Intent orchestrator → Crew execution: builds crew (evidence: `agents/orchestrator.py`)
- Document reader → LLM agent base: inherits from (evidence: `agents/reader.py`)
- Summariser → LLM agent base: inherits from (evidence: `agents/summariser.py`)
- Analyser → LLM agent base: inherits from (evidence: `agents/analyser.py`)
- Question answering → LLM agent base: inherits from (evidence: `agents/qa_agent.py`)
- Document writer → LLM agent base: inherits from (evidence: `agents/writer.py`)
- LLM agent base → Ollama model service: invokes model (evidence: `agents/__init__.py`)
- Intent orchestrator → Ollama model service: classifies intent (evidence: `agents/orchestrator.py`)
- User → Backend dashboard: uses dashboard (evidence: `README.md`)
- Backend dashboard → FastAPI endpoints: calls API (evidence: `README.md`)
- FastAPI endpoints → API settings: loads settings (evidence: `backend/app/main.py`)
- FastAPI endpoints → SQLite metadata: initializes tables (evidence: `backend/app/main.py`)
- FastAPI endpoints → Timing and logs: records metrics (evidence: `backend/app/main.py`)
- SQLite metadata → SQLite: persists records (evidence: `backend/app/database.py`)
