# krupashetty004/agentic-ai architecture

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

- Interactive diagram: https://gitdiagram.com/krupashetty004/agentic-ai
- Repository: https://github.com/krupashetty004/agentic-ai

## Overview

This is an authenticated, document-grounded multi-agent chat application. Users register or log in, ingest sample or uploaded files, then ask questions through the chat interface; a LangGraph workflow routes work among supervisor, search, and summary agents and returns an answer with sources and review information. Search and conversation state can use Elasticsearch and Redis, with local fallbacks. The README documents MCP tools and feedback-driven routing. Some workflow and integration internals were not excerpted, so those links rely on documented behavior rather than inspected call sites.

Main entry points: [`backend/app/workflows/chat_workflow.py`](https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/workflows/chat_workflow.py) (Chat workflow), [`backend/app/main.py`](https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/main.py) (FastAPI application), [`backend/app/routers/auth_router.py`](https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/routers/auth_router.py) (Auth routes), [`backend/app/dependencies/auth_dependencies.py`](https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/dependencies/auth_dependencies.py) (Bearer validation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui_api["Interface and API"]
  node_frontend["Chat interface<br/>[page.tsx]"]
  node_api["FastAPI application<br/>[main.py]"]
  node_chat_routes["Chat routes<br/>[chat_router.py]"]
end

subgraph group_identity["Identity and sessions"]
  node_auth_routes["Auth routes<br/>[auth_router.py]"]
  node_auth_service["Account service<br/>[auth_service.py]"]
  node_auth_dependency["Bearer validation"]
  node_token["Token service<br/>[token_service.py]"]
  node_memory[("Conversation memory<br/>[redis_memory.py]")]
end

subgraph group_knowledge["Knowledge ingestion and retrieval"]
  node_ingest_routes["Ingest routes<br/>[ingest_router.py]"]
  node_file_loader["File loaders<br/>[file_ingest.py]"]
  node_search[("Search and indexing<br/>[search_service.py]")]
end

subgraph group_agents["Agent workflow"]
  node_workflow["Chat workflow<br/>[chat_workflow.py]"]
  node_routing["Routing graph<br/>[routing_graph.py]"]
  node_supervisor["Supervisor agent"]
  node_search_agent["Search agent<br/>[search_agent.py]"]
  node_summary_agent["Summary agent<br/>[summary_agent.py]"]
  node_llm["LLM service<br/>[llm_service.py]"]
end

subgraph group_support["Feedback and tools"]
  node_feedback["Feedback metrics"]
  node_feedback_routes["Feedback routes<br/>[feedback_router.py]"]
  node_mcp_tools["MCP knowledge tools<br/>[mcp_tools.py]"]
  node_mcp_server["MCP server<br/>[mcp_server.py]"]
end

node_user(("User"))
node_elastic[("Elasticsearch")]
node_huggingface{{"Hugging Face"}}
node_mcp_clients(("MCP clients"))

node_user -->|"uses"| node_frontend
node_frontend -.->|"calls API"| node_api
node_api -->|"registers"| node_auth_routes
node_api -->|"registers"| node_chat_routes
node_api -->|"registers"| node_ingest_routes
node_api -->|"registers"| node_feedback_routes
node_auth_routes -->|"registers users"| node_auth_service
node_auth_routes -->|"creates tokens"| node_token
node_auth_service -->|"stores accounts"| node_memory
node_auth_routes -->|"uses"| node_auth_dependency
node_auth_dependency -->|"validates tokens"| node_token
node_auth_dependency -->|"loads user"| node_auth_service
node_auth_dependency -->|"reads account"| node_memory
node_chat_routes -->|"runs"| node_workflow
node_chat_routes -->|"reads or clears"| node_memory
node_ingest_routes -->|"loads files"| node_file_loader
node_ingest_routes -->|"indexes documents"| node_search
node_file_loader -.->|"documents indexed"| node_search
node_search -->|"indexes and searches"| node_elastic
node_workflow -->|"uses graph"| node_routing
node_workflow -->|"routes requests"| node_supervisor
node_workflow -->|"dispatches work"| node_search_agent
node_workflow -->|"dispatches work"| node_summary_agent
node_workflow -->|"uses conversation memory"| node_memory
node_search_agent -->|"retrieves documents"| node_search
node_search_agent -->|"uses tools"| node_mcp_tools
node_supervisor -->|"requests generation"| node_llm
node_llm -->|"generates text"| node_huggingface
node_feedback_routes -->|"records and reports"| node_feedback
node_workflow -->|"uses feedback routing"| node_feedback
node_mcp_clients -->|"requests tools"| node_mcp_server
node_mcp_server -->|"exposes tools"| node_mcp_tools

click node_frontend "https://github.com/krupashetty004/agentic-ai/blob/main/frontend/app/page.tsx"
click node_api "https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/main.py"
click node_auth_routes "https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/routers/auth_router.py"
click node_auth_service "https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/services/auth_service.py"
click node_auth_dependency "https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/dependencies/auth_dependencies.py"
click node_token "https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/services/token_service.py"
click node_memory "https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/memory/redis_memory.py"
click node_chat_routes "https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/routers/chat_router.py"
click node_ingest_routes "https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/routers/ingest_router.py"
click node_file_loader "https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/data_ingest/file_ingest.py"
click node_search "https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/services/search_service.py"
click node_workflow "https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/workflows/chat_workflow.py"
click node_routing "https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/workflows/routing_graph.py"
click node_supervisor "https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/agents/supervisor_agent.py"
click node_search_agent "https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/agents/search_agent.py"
click node_summary_agent "https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/agents/summary_agent.py"
click node_llm "https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/services/llm_service.py"
click node_feedback "https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/services/feedback_service.py"
click node_feedback_routes "https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/routers/feedback_router.py"
click node_mcp_tools "https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/services/mcp_tools.py"
click node_mcp_server "https://github.com/krupashetty004/agentic-ai/blob/main/backend/mcp_server.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_frontend,node_api,node_chat_routes,node_user,node_mcp_clients toneBlue
class node_auth_routes,node_auth_service,node_auth_dependency,node_token,node_memory,node_elastic toneAmber
class node_ingest_routes,node_file_loader,node_search toneMint
class node_workflow,node_routing,node_supervisor,node_search_agent,node_summary_agent,node_llm toneRose
class node_feedback,node_feedback_routes,node_mcp_tools,node_mcp_server,node_huggingface toneIndigo
```

## Components

### Interface and API

- [Chat interface](https://github.com/krupashetty004/agentic-ai/blob/main/frontend/app/page.tsx): `frontend/app/page.tsx`
- [FastAPI application](https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/main.py): `backend/app/main.py`
- [Chat routes](https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/routers/chat_router.py): `backend/app/routers/chat_router.py`

### Identity and sessions

- [Auth routes](https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/routers/auth_router.py): `backend/app/routers/auth_router.py`
- [Account service](https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/services/auth_service.py): `backend/app/services/auth_service.py`
- [Bearer validation](https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/dependencies/auth_dependencies.py): `backend/app/dependencies/auth_dependencies.py`
- [Token service](https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/services/token_service.py): `backend/app/services/token_service.py`
- [Conversation memory](https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/memory/redis_memory.py): `backend/app/memory/redis_memory.py`

### Knowledge ingestion and retrieval

- [Ingest routes](https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/routers/ingest_router.py): `backend/app/routers/ingest_router.py`
- [File loaders](https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/data_ingest/file_ingest.py): `backend/app/data_ingest/file_ingest.py`
- [Search and indexing](https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/services/search_service.py): `backend/app/services/search_service.py`

### Agent workflow

- [Chat workflow](https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/workflows/chat_workflow.py): `backend/app/workflows/chat_workflow.py`
- [Routing graph](https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/workflows/routing_graph.py): `backend/app/workflows/routing_graph.py`
- [Supervisor agent](https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/agents/supervisor_agent.py): `backend/app/agents/supervisor_agent.py`
- [Search agent](https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/agents/search_agent.py): `backend/app/agents/search_agent.py`
- [Summary agent](https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/agents/summary_agent.py): `backend/app/agents/summary_agent.py`
- [LLM service](https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/services/llm_service.py): `backend/app/services/llm_service.py`

### Feedback and tools

- [Feedback metrics](https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/services/feedback_service.py): `backend/app/services/feedback_service.py`
- [Feedback routes](https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/routers/feedback_router.py): `backend/app/routers/feedback_router.py`
- [MCP knowledge tools](https://github.com/krupashetty004/agentic-ai/blob/main/backend/app/services/mcp_tools.py): `backend/app/services/mcp_tools.py`
- [MCP server](https://github.com/krupashetty004/agentic-ai/blob/main/backend/mcp_server.py): `backend/mcp_server.py`

### Other components

- **User**
- **Elasticsearch**
- **Hugging Face**
- **MCP clients**

## Connections

- User → Chat interface: uses
- Chat interface → FastAPI application: calls API
- FastAPI application → Auth routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Chat routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Ingest routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Feedback routes: registers (evidence: `backend/app/main.py`)
- Auth routes → Account service: registers users (evidence: `backend/app/routers/auth_router.py`)
- Auth routes → Token service: creates tokens (evidence: `backend/app/routers/auth_router.py`)
- Account service → Conversation memory: stores accounts (evidence: `backend/app/services/auth_service.py`)
- Auth routes → Bearer validation: uses (evidence: `backend/app/routers/auth_router.py`)
- Bearer validation → Token service: validates tokens (evidence: `backend/app/dependencies/auth_dependencies.py`)
- Bearer validation → Account service: loads user (evidence: `backend/app/dependencies/auth_dependencies.py`)
- Bearer validation → Conversation memory: reads account (evidence: `backend/app/dependencies/auth_dependencies.py`)
- Chat routes → Chat workflow: runs (evidence: `backend/app/routers/chat_router.py`)
- Chat routes → Conversation memory: reads or clears (evidence: `backend/app/routers/chat_router.py`)
- Ingest routes → File loaders: loads files (evidence: `backend/app/routers/ingest_router.py`)
- Ingest routes → Search and indexing: indexes documents (evidence: `backend/app/routers/ingest_router.py`)
- File loaders → Search and indexing: documents indexed
- Search and indexing → Elasticsearch: indexes and searches
- Chat workflow → Routing graph: uses graph (evidence: `backend/app/workflows/chat_workflow.py`)
- Chat workflow → Supervisor agent: routes requests (evidence: `backend/app/workflows/chat_workflow.py`)
- Chat workflow → Search agent: dispatches work (evidence: `backend/app/workflows/chat_workflow.py`)
- Chat workflow → Summary agent: dispatches work (evidence: `backend/app/workflows/chat_workflow.py`)
- Chat workflow → Conversation memory: uses conversation memory (evidence: `backend/app/workflows/chat_workflow.py`)
- Search agent → Search and indexing: retrieves documents (evidence: `backend/app/agents/search_agent.py`)
- Search agent → MCP knowledge tools: uses tools (evidence: `backend/app/agents/search_agent.py`)
- Supervisor agent → LLM service: requests generation (evidence: `backend/app/agents/supervisor_agent.py`)
- LLM service → Hugging Face: generates text (evidence: `backend/app/services/llm_service.py`)
- Feedback routes → Feedback metrics: records and reports (evidence: `backend/app/routers/feedback_router.py`)
- Chat workflow → Feedback metrics: uses feedback routing (evidence: `backend/app/workflows/chat_workflow.py`)
- MCP clients → MCP server: requests tools
- MCP server → MCP knowledge tools: exposes tools (evidence: `backend/mcp_server.py`)
