# entbappy/enterprise-it-support-agentic-rag-copilot architecture

> Architecture diagram of the GitHub repository entbappy/enterprise-it-support-agentic-rag-copilot, 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/entbappy/enterprise-it-support-agentic-rag-copilot
- Repository: https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot

## Overview

This is an employee-facing enterprise IT support copilot. Employees submit questions through the web UI; the API invokes a LangGraph workflow that routes simple chat directly and handles support questions by retrieving and grading private knowledge, falling back to web search when needed, and returning a grounded answer with citations and a decision trace. Authorized staff can upload documents for indexing. The graph preserves these domain stages and the audit/configuration layers. Relationships reflect the README and excerpted source; unsampled template behavior and other undocumented wiring are not inferred.

Main entry points: [`app/api/routes.py`](https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/api/routes.py) (API routes), [`app/rag/workflow.py`](https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/rag/workflow.py) (Evidence grading), [`app/main.py`](https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/main.py) (Application setup), [`app/rag/vectorstore.py`](https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/rag/vectorstore.py) (Vector store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_web_ui["Web interface<br/>[app.js]"]
  node_page["Home page<br/>[index.html]"]
end

subgraph group_api["API and services"]
  node_api_routes["API routes<br/>[routes.py]"]
  node_app_main["Application setup<br/>[main.py]"]
  node_ingestion["Document ingestion<br/>[ingestion.py]"]
  node_audit[("Query audit<br/>[audit.py]")]
end

subgraph group_rag["Agentic RAG"]
  node_state["Workflow state<br/>[state.py]"]
  node_workflow["Workflow orchestration<br/>[workflow.py]"]
  node_route_stage["Question routing<br/>[workflow.py]"]
  node_retrieve_stage["Private retrieval<br/>[workflow.py]"]
  node_grade_stage["Evidence grading<br/>[workflow.py]"]
  node_web_stage["Web fallback<br/>[workflow.py]"]
  node_rewrite_stage["Query rewriting<br/>[workflow.py]"]
  node_answer_stage["Answer generation<br/>[workflow.py]"]
end

subgraph group_infra["State and integrations"]
  node_config["Settings<br/>[config.py]"]
  node_logging["Logging setup<br/>[logging.py]"]
  node_vectorstore["Vector store<br/>[vectorstore.py]"]
  node_pinecone[("Pinecone KB")]
  node_openai["OpenAI models"]
  node_tavily["Tavily search"]
  node_audit_db[("SQLite audit DB<br/>[audit.db]")]
end

node_employee(("Employee"))

node_employee -->|"asks question"| node_web_ui
node_web_ui -->|"posts chat"| node_api_routes
node_app_main -->|"registers routes"| node_api_routes
node_app_main -->|"renders home"| node_page
node_api_routes -->|"calls ask"| node_workflow
node_api_routes -->|"writes trace"| node_audit
node_app_main -->|"initializes DB"| node_audit
node_audit -->|"writes records"| node_audit_db
node_api_routes -->|"loads and chunks"| node_ingestion
node_api_routes -->|"adds chunks"| node_vectorstore
node_workflow -->|"dispatches"| node_route_stage
node_route_stage -->|"routes support"| node_retrieve_stage
node_route_stage -->|"routes direct"| node_answer_stage
node_retrieve_stage -->|"retrieves chunks"| node_vectorstore
node_retrieve_stage -->|"passes evidence"| node_grade_stage
node_grade_stage -->|"uses good KB"| node_answer_stage
node_grade_stage -->|"falls back"| node_web_stage
node_web_stage -->|"searches web"| node_tavily
node_web_stage -->|"grades web evidence"| node_grade_stage
node_grade_stage -->|"retries weak evidence"| node_rewrite_stage
node_rewrite_stage -->|"retries query"| node_retrieve_stage
node_answer_stage -->|"generates answer"| node_openai
node_route_stage -->|"classifies question"| node_openai
node_grade_stage -->|"grades evidence"| node_openai
node_rewrite_stage -->|"rewrites query"| node_openai
node_vectorstore -->|"reads and writes vectors"| node_pinecone
node_vectorstore -->|"embeds documents"| node_openai
node_workflow -->|"uses typed state"| node_state
node_app_main -->|"loads settings"| node_config
node_app_main -->|"configures logging"| node_logging
node_api_routes -->|"checks settings"| node_config

click node_web_ui "https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/static/js/app.js"
click node_page "https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/templates/index.html"
click node_api_routes "https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/api/routes.py"
click node_app_main "https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/main.py"
click node_ingestion "https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/services/ingestion.py"
click node_audit "https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/services/audit.py"
click node_config "https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/core/config.py"
click node_logging "https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/core/logging.py"
click node_state "https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/rag/state.py"
click node_workflow "https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/rag/workflow.py"
click node_route_stage "https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/rag/workflow.py"
click node_retrieve_stage "https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/rag/workflow.py"
click node_grade_stage "https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/rag/workflow.py"
click node_web_stage "https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/rag/workflow.py"
click node_rewrite_stage "https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/rag/workflow.py"
click node_answer_stage "https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/rag/workflow.py"
click node_vectorstore "https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/rag/vectorstore.py"
click node_audit_db "https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/data/audit.db"

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_web_ui,node_page toneBlue
class node_api_routes,node_app_main,node_ingestion,node_audit toneAmber
class node_state,node_workflow,node_route_stage,node_retrieve_stage,node_grade_stage,node_web_stage,node_rewrite_stage,node_answer_stage toneMint
class node_config,node_logging,node_vectorstore,node_pinecone,node_openai,node_tavily,node_audit_db toneRose
class node_employee toneIndigo
```

## Components

### User interface

- [Web interface](https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/static/js/app.js): `static/js/app.js`
- [Home page](https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/templates/index.html): `templates/index.html`

### API and services

- [API routes](https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/api/routes.py): `app/api/routes.py`
- [Application setup](https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/main.py): `app/main.py`
- [Document ingestion](https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/services/ingestion.py): `app/services/ingestion.py`
- [Query audit](https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/services/audit.py): `app/services/audit.py`

### Agentic RAG

- [Workflow state](https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/rag/state.py): `app/rag/state.py`
- [Workflow orchestration](https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/rag/workflow.py): `app/rag/workflow.py`
- [Question routing](https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/rag/workflow.py): `app/rag/workflow.py`
- [Private retrieval](https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/rag/workflow.py): `app/rag/workflow.py`
- [Evidence grading](https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/rag/workflow.py): `app/rag/workflow.py`
- [Web fallback](https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/rag/workflow.py): `app/rag/workflow.py`
- [Query rewriting](https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/rag/workflow.py): `app/rag/workflow.py`
- [Answer generation](https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/rag/workflow.py): `app/rag/workflow.py`

### State and integrations

- [Settings](https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/core/config.py): `app/core/config.py`
- [Logging setup](https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/core/logging.py): `app/core/logging.py`
- [Vector store](https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/app/rag/vectorstore.py): `app/rag/vectorstore.py`
- **Pinecone KB**
- **OpenAI models**
- **Tavily search**
- [SQLite audit DB](https://github.com/entbappy/enterprise-it-support-agentic-rag-copilot/blob/main/data/audit.db): `data/audit.db`

### Other components

- **Employee**

## Connections

- Employee → Web interface: asks question (evidence: `README.md`)
- Web interface → API routes: posts chat (evidence: `static/js/app.js`)
- Application setup → API routes: registers routes (evidence: `app/main.py`)
- Application setup → Home page: renders home (evidence: `app/main.py`)
- API routes → Workflow orchestration: calls ask (evidence: `app/api/routes.py`)
- API routes → Query audit: writes trace (evidence: `app/api/routes.py`)
- Application setup → Query audit: initializes DB (evidence: `app/main.py`)
- Query audit → SQLite audit DB: writes records (evidence: `app/services/audit.py`)
- API routes → Document ingestion: loads and chunks (evidence: `app/api/routes.py`)
- API routes → Vector store: adds chunks (evidence: `app/api/routes.py`)
- Workflow orchestration → Question routing: dispatches (evidence: `app/rag/workflow.py`)
- Question routing → Private retrieval: routes support (evidence: `app/rag/workflow.py`)
- Question routing → Answer generation: routes direct (evidence: `app/rag/workflow.py`)
- Private retrieval → Vector store: retrieves chunks (evidence: `app/rag/workflow.py`)
- Private retrieval → Evidence grading: passes evidence (evidence: `app/rag/workflow.py`)
- Evidence grading → Answer generation: uses good KB (evidence: `app/rag/workflow.py`)
- Evidence grading → Web fallback: falls back (evidence: `app/rag/workflow.py`)
- Web fallback → Tavily search: searches web (evidence: `app/rag/workflow.py`)
- Web fallback → Evidence grading: grades web evidence (evidence: `app/rag/workflow.py`)
- Evidence grading → Query rewriting: retries weak evidence (evidence: `app/rag/workflow.py`)
- Query rewriting → Private retrieval: retries query (evidence: `app/rag/workflow.py`)
- Answer generation → OpenAI models: generates answer (evidence: `app/rag/workflow.py`)
- Question routing → OpenAI models: classifies question (evidence: `app/rag/workflow.py`)
- Evidence grading → OpenAI models: grades evidence (evidence: `app/rag/workflow.py`)
- Query rewriting → OpenAI models: rewrites query (evidence: `app/rag/workflow.py`)
- Vector store → Pinecone KB: reads and writes vectors (evidence: `app/rag/vectorstore.py`)
- Vector store → OpenAI models: embeds documents (evidence: `app/rag/vectorstore.py`)
- Workflow orchestration → Workflow state: uses typed state (evidence: `app/rag/workflow.py`)
- Application setup → Settings: loads settings (evidence: `app/main.py`)
- Application setup → Logging setup: configures logging (evidence: `app/main.py`)
- API routes → Settings: checks settings (evidence: `app/api/routes.py`)
