# aditya25-yadav/enterprise-knowledge-agent architecture

> Architecture diagram of the GitHub repository aditya25-yadav/enterprise-knowledge-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aditya25-yadav/enterprise-knowledge-agent
- Repository: https://github.com/aditya25-yadav/enterprise-knowledge-agent

## Overview

Enterprise Knowledge Agent ingests content from six enterprise systems, normalizes it into OKF, and builds a cross-connector catalog plus vector, keyword, and developer-graph indexes. The principal user workflow is query scope parsing, planner-driven retrieval, evidence reranking and evaluation, and citation-ready answer generation; the planner can reformulate queries when evidence is incomplete. RBAC constrains retrieval, while checkpoints preserve multi-turn state. Edges follow the excerpts, SOURCE INDEX references, or README; unsampled subsystem wiring is left unasserted.

Main entry points: [`backend/agent/langgraph_planner.py`](https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/agent/langgraph_planner.py) (LangGraph planner), [`backend/ingestion/pipeline.py`](https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/ingestion/pipeline.py) (Ingestion pipeline), [`backend/retrieval`](https://github.com/aditya25-yadav/enterprise-knowledge-agent/tree/main/backend/retrieval) (Search suite), [`backend/connectors`](https://github.com/aditya25-yadav/enterprise-knowledge-agent/tree/main/backend/connectors) (Enterprise connectors)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Ingestion and indexing"]
  node_connectors["Enterprise connectors"]
  node_okf["OKF schema<br/>[okf.py]"]
  node_catalog["Global catalog"]
  node_chunker["Structure chunker<br/>[chunker.py]"]
  node_chunk["Knowledge chunks<br/>[chunk.py]"]
  node_embedder["Local embedder<br/>[embedder.py]"]
  node_pipeline["Ingestion pipeline<br/>[pipeline.py]"]
  node_qdrant[("Vector index<br/>[qdrant_client.py]")]
  node_bm25[("BM25 index<br/>[bm25_index.py]")]
end

subgraph group_retrieve["Retrieval and security"]
  node_tools["Retrieval tools<br/>[tools.py]"]
  node_retrieval["Search suite"]
  node_security["RBAC enforcement<br/>[rbac_resolver.py]"]
  node_reranker["Cross-encoder reranker<br/>[reranker.py]"]
  node_entity_search["Entity graph search<br/>[entity_graph.py]"]
end

subgraph group_agent["Agent and answers"]
  node_scope["Query scope<br/>[query_scope.py]"]
  node_planner["LangGraph planner"]
  node_evaluator["Evidence evaluator<br/>[evaluator.py]"]
  node_reformulator["Query reformulator<br/>[reformulator.py]"]
  node_context["Evidence context<br/>[context_builder.py]"]
  node_answer["Answer generator"]
end

subgraph group_graph["Developer graph"]
  node_graph_extract["GitHub graph extractor"]
  node_graph_store[("Developer graph store<br/>[neo4j_client.py]")]
end

subgraph group_models["Providers and persistence"]
  node_llm["LLM provider factory<br/>[factory.py]"]
  node_providers["Gemini and Ollama"]
  node_checkpoints[("Session checkpoints<br/>[checkpointers.py]")]
end

node_user(("User"))

node_connectors -.->|"normalize into"| node_okf
node_connectors -.->|"catalog assets"| node_catalog
node_okf -.->|"ingest concepts"| node_pipeline
node_pipeline -->|"chunks concepts"| node_chunker
node_chunker -->|"creates chunks"| node_chunk
node_pipeline -->|"embeds chunks"| node_embedder
node_pipeline -->|"upserts vectors"| node_qdrant
node_pipeline -->|"indexes chunks"| node_bm25
node_user -->|"submits query"| node_scope
node_scope -.->|"routes scoped query"| node_planner
node_planner -->|"dispatches tools"| node_tools
node_tools -->|"invokes searches"| node_retrieval
node_retrieval -.->|"searches vectors"| node_qdrant
node_retrieval -.->|"searches keywords"| node_bm25
node_retrieval -.->|"filters by permissions"| node_security
node_qdrant -->|"builds RBAC filter"| node_security
node_planner -->|"reranks evidence"| node_reranker
node_planner -->|"evaluates evidence"| node_evaluator
node_planner -->|"reformulates query"| node_reformulator
node_planner -->|"builds context"| node_context
node_answer -->|"formats evidence"| node_context
node_planner -.->|"requests tool reasoning"| node_llm
node_answer -->|"requests synthesis"| node_llm
node_llm -->|"selects provider"| node_providers
node_planner -->|"persists sessions"| node_checkpoints
node_connectors -->|"supplies GitHub data"| node_graph_extract
node_graph_extract -->|"writes graph bundle"| node_graph_store
node_tools -->|"dispatches entity search"| node_entity_search
node_entity_search -->|"traverses graph"| node_graph_store

click node_connectors "https://github.com/aditya25-yadav/enterprise-knowledge-agent/tree/main/backend/connectors"
click node_okf "https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/models/okf.py"
click node_catalog "https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/ingestion/catalog_aggregator.py"
click node_chunker "https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/ingestion/chunker.py"
click node_chunk "https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/ingestion/chunk.py"
click node_embedder "https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/ingestion/embedder.py"
click node_pipeline "https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/ingestion/pipeline.py"
click node_qdrant "https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/storage/qdrant_client.py"
click node_bm25 "https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/storage/bm25_index.py"
click node_scope "https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/agent/query_scope.py"
click node_planner "https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/agent/langgraph_planner.py"
click node_tools "https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/agent/tools.py"
click node_retrieval "https://github.com/aditya25-yadav/enterprise-knowledge-agent/tree/main/backend/retrieval"
click node_security "https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/security/rbac_resolver.py"
click node_reranker "https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/ranking/reranker.py"
click node_evaluator "https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/evaluation/evaluator.py"
click node_reformulator "https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/agent/reformulator.py"
click node_context "https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/generation/context_builder.py"
click node_answer "https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/generation/answer_generator.py"
click node_llm "https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/llm/factory.py"
click node_providers "https://github.com/aditya25-yadav/enterprise-knowledge-agent/tree/main/backend/llm"
click node_checkpoints "https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/storage/checkpointers.py"
click node_graph_extract "https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/graph/github_extractor.py"
click node_graph_store "https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/graph/neo4j_client.py"
click node_entity_search "https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/retrieval/entity_graph.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_connectors,node_okf,node_catalog,node_chunker,node_chunk,node_embedder,node_pipeline,node_qdrant,node_bm25,node_user toneBlue
class node_tools,node_retrieval,node_security,node_reranker,node_entity_search toneAmber
class node_scope,node_planner,node_evaluator,node_reformulator,node_context,node_answer toneMint
class node_graph_extract,node_graph_store toneRose
class node_llm,node_providers,node_checkpoints toneIndigo
```

## Components

### Ingestion and indexing

- [Enterprise connectors](https://github.com/aditya25-yadav/enterprise-knowledge-agent/tree/main/backend/connectors): `backend/connectors`
- [OKF schema](https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/models/okf.py): `backend/models/okf.py`
- [Global catalog](https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/ingestion/catalog_aggregator.py): `backend/ingestion/catalog_aggregator.py`
- [Structure chunker](https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/ingestion/chunker.py): `backend/ingestion/chunker.py`
- [Knowledge chunks](https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/ingestion/chunk.py): `backend/ingestion/chunk.py`
- [Local embedder](https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/ingestion/embedder.py): `backend/ingestion/embedder.py`
- [Ingestion pipeline](https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/ingestion/pipeline.py): `backend/ingestion/pipeline.py`
- [Vector index](https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/storage/qdrant_client.py): `backend/storage/qdrant_client.py`
- [BM25 index](https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/storage/bm25_index.py): `backend/storage/bm25_index.py`

### Retrieval and security

- [Retrieval tools](https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/agent/tools.py): `backend/agent/tools.py`
- [Search suite](https://github.com/aditya25-yadav/enterprise-knowledge-agent/tree/main/backend/retrieval): `backend/retrieval`
- [RBAC enforcement](https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/security/rbac_resolver.py): `backend/security/rbac_resolver.py`
- [Cross-encoder reranker](https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/ranking/reranker.py): `backend/ranking/reranker.py`
- [Entity graph search](https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/retrieval/entity_graph.py): `backend/retrieval/entity_graph.py`

### Agent and answers

- [Query scope](https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/agent/query_scope.py): `backend/agent/query_scope.py`
- [LangGraph planner](https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/agent/langgraph_planner.py): `backend/agent/langgraph_planner.py`
- [Evidence evaluator](https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/evaluation/evaluator.py): `backend/evaluation/evaluator.py`
- [Query reformulator](https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/agent/reformulator.py): `backend/agent/reformulator.py`
- [Evidence context](https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/generation/context_builder.py): `backend/generation/context_builder.py`
- [Answer generator](https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/generation/answer_generator.py): `backend/generation/answer_generator.py`

### Developer graph

- [GitHub graph extractor](https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/graph/github_extractor.py): `backend/graph/github_extractor.py`
- [Developer graph store](https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/graph/neo4j_client.py): `backend/graph/neo4j_client.py`

### Providers and persistence

- [LLM provider factory](https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/llm/factory.py): `backend/llm/factory.py`
- [Gemini and Ollama](https://github.com/aditya25-yadav/enterprise-knowledge-agent/tree/main/backend/llm): `backend/llm`
- [Session checkpoints](https://github.com/aditya25-yadav/enterprise-knowledge-agent/blob/main/backend/storage/checkpointers.py): `backend/storage/checkpointers.py`

### Other components

- **User**

## Connections

- Enterprise connectors → OKF schema: normalize into
- Enterprise connectors → Global catalog: catalog assets
- OKF schema → Ingestion pipeline: ingest concepts (evidence: `backend/ingestion/pipeline.py`)
- Ingestion pipeline → Structure chunker: chunks concepts (evidence: `backend/ingestion/pipeline.py`)
- Structure chunker → Knowledge chunks: creates chunks (evidence: `backend/ingestion/chunker.py`)
- Ingestion pipeline → Local embedder: embeds chunks (evidence: `backend/ingestion/pipeline.py`)
- Ingestion pipeline → Vector index: upserts vectors (evidence: `backend/ingestion/pipeline.py`)
- Ingestion pipeline → BM25 index: indexes chunks (evidence: `backend/ingestion/pipeline.py`)
- User → Query scope: submits query (evidence: `backend/agent/query_scope.py`)
- Query scope → LangGraph planner: routes scoped query (evidence: `backend/agent/langgraph_planner.py`)
- LangGraph planner → Retrieval tools: dispatches tools (evidence: `backend/agent/langgraph_planner.py`)
- Retrieval tools → Search suite: invokes searches (evidence: `backend/agent/tools.py`)
- Search suite → Vector index: searches vectors
- Search suite → BM25 index: searches keywords
- Search suite → RBAC enforcement: filters by permissions
- Vector index → RBAC enforcement: builds RBAC filter (evidence: `backend/storage/qdrant_client.py`)
- LangGraph planner → Cross-encoder reranker: reranks evidence (evidence: `backend/agent/langgraph_planner.py`)
- LangGraph planner → Evidence evaluator: evaluates evidence (evidence: `backend/agent/langgraph_planner.py`)
- LangGraph planner → Query reformulator: reformulates query (evidence: `backend/agent/langgraph_planner.py`)
- LangGraph planner → Evidence context: builds context (evidence: `backend/agent/langgraph_planner.py`)
- Answer generator → Evidence context: formats evidence (evidence: `backend/generation/answer_generator.py`)
- LangGraph planner → LLM provider factory: requests tool reasoning (evidence: `backend/agent/langgraph_planner.py`)
- Answer generator → LLM provider factory: requests synthesis (evidence: `backend/generation/answer_generator.py`)
- LLM provider factory → Gemini and Ollama: selects provider (evidence: `backend/llm/factory.py`)
- LangGraph planner → Session checkpoints: persists sessions (evidence: `backend/agent/langgraph_planner.py`)
- Enterprise connectors → GitHub graph extractor: supplies GitHub data (evidence: `backend/graph/github_extractor.py`)
- GitHub graph extractor → Developer graph store: writes graph bundle (evidence: `backend/graph/neo4j_client.py`)
- Retrieval tools → Entity graph search: dispatches entity search (evidence: `backend/agent/tools.py`)
- Entity graph search → Developer graph store: traverses graph (evidence: `backend/retrieval/entity_graph.py`)
