# nashtech-garage/ntg-agent architecture

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

- Interactive diagram: https://gitdiagram.com/nashtech-garage/ntg-agent
- Repository: https://github.com/nashtech-garage/ntg-agent

## Overview

NTG Agent is a multi-UI chatbot platform: users select an agent, send prompts, and receive model responses, with document knowledge and interactive tools extending chat. The repository also includes agent/provider administration, skills, sharing, token tracking, and anonymous access. The README documents the deployed services and LightRAG’s per-agent containers; sampled source confirms container reconciliation and ingestion-status polling. Many runtime controllers and UI components are present in the tree but were not sampled, so uncertain request-flow links are omitted or marked unverified.

Main entry points: [`src/NTG.Agent.Orchestrator/Services/Agents/AgentFactory.cs`](https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.Orchestrator/Services/Agents/AgentFactory.cs) (Agent factory), [`src/NTG.Agent.AppHost/Program.cs`](https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.AppHost/Program.cs) (Aspire host), [`src/NTG.Agent.Orchestrator/Controllers/AgentAdminController.cs`](https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.Orchestrator/Controllers/AgentAdminController.cs) (Agent administration), [`src/NTG.Agent.WebClient/NTG.Agent.WebClient`](https://github.com/nashtech-garage/ntg-agent/tree/main/src/NTG.Agent.WebClient/NTG.Agent.WebClient) (Blazor chat)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Chat experience"]
  node_blazor["Blazor chat"]
  node_copilot["CopilotKit chat"]
  node_chat_api["Chat endpoints"]
  node_conversation_state["Conversation state"]
  node_sharing["Conversation sharing"]
end

subgraph group_runtime["Agent runtime"]
  node_agent_model["Agent configuration<br/>[Agent.cs]"]
  node_agent_factory["Agent factory<br/>[AgentFactory.cs]"]
  node_provider_models["LLM providers<br/>[Provider.cs]"]
  node_tools["AI tools"]
  node_mcp["MCP tools<br/>[WeatherTools.cs]"]
  node_token_usage["Token tracking"]
end

subgraph group_knowledge["Knowledge and skills"]
  node_documents["Document handling"]
  node_knowledge_service["Knowledge service"]
  node_rag_containers["Per-agent RAG"]
  node_ingestion_worker["Ingestion status"]
  node_skills["Skills registry<br/>[SkillRegistry.cs]"]
end

subgraph group_management["Administration"]
  node_agent_admin["Agent administration"]
  node_admin_ui["Admin dashboard<br/>[NTG.Agent.Admin]"]
end

subgraph group_platform["Platform services"]
  node_database[("Agent database<br/>[AgentDbContext.cs]")]
  node_apphost["Aspire host<br/>[Program.cs]"]
end

node_user(("User"))
node_llm(("LLM provider"))
node_sql[("SQL Server")]

node_user -->|"chats in"| node_blazor
node_user -->|"chats in"| node_copilot
node_blazor -.->|"sends prompts"| node_chat_api
node_copilot -.->|"requests chat"| node_chat_api
node_blazor -->|"maintains state"| node_conversation_state
node_chat_api -.->|"runs agent"| node_agent_factory
node_agent_admin -->|"configures"| node_agent_model
node_agent_admin -->|"provisions"| node_rag_containers
node_agent_factory -.->|"uses provider"| node_provider_models
node_agent_factory -.->|"generates with"| node_llm
node_agent_factory -.->|"offers tools"| node_tools
node_agent_factory -.->|"loads skills"| node_skills
node_documents -.->|"stores knowledge"| node_knowledge_service
node_knowledge_service -.->|"queries"| node_rag_containers
node_ingestion_worker -->|"checks status"| node_knowledge_service
node_ingestion_worker -->|"updates status"| node_database
node_agent_admin -->|"persists agents"| node_database
node_admin_ui -.->|"manages agents"| node_agent_admin
node_sharing -.->|"stores shares"| node_database
node_token_usage -.->|"records usage"| node_database
node_apphost -->|"starts database"| node_sql
node_apphost -->|"launches"| node_admin_ui
node_apphost -->|"launches"| node_blazor
node_apphost -->|"launches"| node_copilot
node_mcp -.->|"provides tools"| node_llm

click node_blazor "https://github.com/nashtech-garage/ntg-agent/tree/main/src/NTG.Agent.WebClient/NTG.Agent.WebClient"
click node_copilot "https://github.com/nashtech-garage/ntg-agent/tree/main/src/NTG.Agent.CopilotKitApp"
click node_chat_api "https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.Orchestrator/Controllers/ConversationsController.cs"
click node_conversation_state "https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.WebClient/NTG.Agent.WebClient.Client/States/ConversationState.cs"
click node_agent_admin "https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.Orchestrator/Controllers/AgentAdminController.cs"
click node_admin_ui "https://github.com/nashtech-garage/ntg-agent/tree/main/src/NTG.Agent.Admin/NTG.Agent.Admin"
click node_agent_model "https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.Orchestrator/Models/Agents/Agent.cs"
click node_agent_factory "https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.Orchestrator/Services/Agents/AgentFactory.cs"
click node_provider_models "https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.Orchestrator/Models/Agents/Provider.cs"
click node_tools "https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.AITools/NTG.Agent.AITools.SearchOnlineTool/SearchOnlineTool.cs"
click node_mcp "https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.MCP.Server/McpTools/WeatherTools.cs"
click node_documents "https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.Orchestrator/Controllers/DocumentsController.cs"
click node_knowledge_service "https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.LightRag/LightRagKnowledge.cs"
click node_rag_containers "https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.LightRag/LightRagContainerManager.cs"
click node_ingestion_worker "https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.LightRag/BackgroundServices/LightRagIngestionStatusHostedService.cs"
click node_skills "https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.Orchestrator/Services/Skills/SkillRegistry.cs"
click node_sharing "https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.Orchestrator/Controllers/SharedConversationsController.cs"
click node_token_usage "https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.Orchestrator/Services/TokenTracking/TokenTrackingService.cs"
click node_database "https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.Orchestrator/Data/AgentDbContext.cs"
click node_apphost "https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.AppHost/Program.cs"

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_blazor,node_copilot,node_chat_api,node_conversation_state,node_sharing,node_user toneBlue
class node_agent_model,node_agent_factory,node_provider_models,node_tools,node_mcp,node_token_usage,node_sql toneAmber
class node_documents,node_knowledge_service,node_rag_containers,node_ingestion_worker,node_skills toneMint
class node_agent_admin,node_admin_ui toneRose
class node_database,node_apphost,node_llm toneIndigo
```

## Components

### Chat experience

- [Blazor chat](https://github.com/nashtech-garage/ntg-agent/tree/main/src/NTG.Agent.WebClient/NTG.Agent.WebClient): `src/NTG.Agent.WebClient/NTG.Agent.WebClient`
- [CopilotKit chat](https://github.com/nashtech-garage/ntg-agent/tree/main/src/NTG.Agent.CopilotKitApp): `src/NTG.Agent.CopilotKitApp`
- [Chat endpoints](https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.Orchestrator/Controllers/ConversationsController.cs): `src/NTG.Agent.Orchestrator/Controllers/ConversationsController.cs`
- [Conversation state](https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.WebClient/NTG.Agent.WebClient.Client/States/ConversationState.cs): `src/NTG.Agent.WebClient/NTG.Agent.WebClient.Client/States/ConversationState.cs`
- [Conversation sharing](https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.Orchestrator/Controllers/SharedConversationsController.cs): `src/NTG.Agent.Orchestrator/Controllers/SharedConversationsController.cs`

### Agent runtime

- [Agent configuration](https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.Orchestrator/Models/Agents/Agent.cs): `src/NTG.Agent.Orchestrator/Models/Agents/Agent.cs`
- [Agent factory](https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.Orchestrator/Services/Agents/AgentFactory.cs): `src/NTG.Agent.Orchestrator/Services/Agents/AgentFactory.cs`
- [LLM providers](https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.Orchestrator/Models/Agents/Provider.cs): `src/NTG.Agent.Orchestrator/Models/Agents/Provider.cs`
- [AI tools](https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.AITools/NTG.Agent.AITools.SearchOnlineTool/SearchOnlineTool.cs): `src/NTG.Agent.AITools/NTG.Agent.AITools.SearchOnlineTool/SearchOnlineTool.cs`
- [MCP tools](https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.MCP.Server/McpTools/WeatherTools.cs): `src/NTG.Agent.MCP.Server/McpTools/WeatherTools.cs`
- [Token tracking](https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.Orchestrator/Services/TokenTracking/TokenTrackingService.cs): `src/NTG.Agent.Orchestrator/Services/TokenTracking/TokenTrackingService.cs`

### Knowledge and skills

- [Document handling](https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.Orchestrator/Controllers/DocumentsController.cs): `src/NTG.Agent.Orchestrator/Controllers/DocumentsController.cs`
- [Knowledge service](https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.LightRag/LightRagKnowledge.cs): `src/NTG.Agent.LightRag/LightRagKnowledge.cs`
- [Per-agent RAG](https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.LightRag/LightRagContainerManager.cs): `src/NTG.Agent.LightRag/LightRagContainerManager.cs`
- [Ingestion status](https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.LightRag/BackgroundServices/LightRagIngestionStatusHostedService.cs): `src/NTG.Agent.LightRag/BackgroundServices/LightRagIngestionStatusHostedService.cs`
- [Skills registry](https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.Orchestrator/Services/Skills/SkillRegistry.cs): `src/NTG.Agent.Orchestrator/Services/Skills/SkillRegistry.cs`

### Administration

- [Agent administration](https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.Orchestrator/Controllers/AgentAdminController.cs): `src/NTG.Agent.Orchestrator/Controllers/AgentAdminController.cs`
- [Admin dashboard](https://github.com/nashtech-garage/ntg-agent/tree/main/src/NTG.Agent.Admin/NTG.Agent.Admin): `src/NTG.Agent.Admin/NTG.Agent.Admin`

### Platform services

- [Agent database](https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.Orchestrator/Data/AgentDbContext.cs): `src/NTG.Agent.Orchestrator/Data/AgentDbContext.cs`
- [Aspire host](https://github.com/nashtech-garage/ntg-agent/blob/main/src/NTG.Agent.AppHost/Program.cs): `src/NTG.Agent.AppHost/Program.cs`

### Other components

- **User**
- **LLM provider**
- **SQL Server**

## Connections

- User → Blazor chat: chats in (evidence: `README.md`)
- User → CopilotKit chat: chats in (evidence: `README.md`)
- Blazor chat → Chat endpoints: sends prompts
- CopilotKit chat → Chat endpoints: requests chat
- Blazor chat → Conversation state: maintains state
- Chat endpoints → Agent factory: runs agent
- Agent administration → Agent configuration: configures (evidence: `src/NTG.Agent.Orchestrator/Controllers/AgentAdminController.cs`)
- Agent administration → Per-agent RAG: provisions (evidence: `src/NTG.Agent.Orchestrator/Controllers/AgentAdminController.cs`)
- Agent factory → LLM providers: uses provider
- Agent factory → LLM provider: generates with
- Agent factory → AI tools: offers tools
- Agent factory → Skills registry: loads skills
- Document handling → Knowledge service: stores knowledge
- Knowledge service → Per-agent RAG: queries
- Ingestion status → Knowledge service: checks status (evidence: `src/NTG.Agent.LightRag/BackgroundServices/LightRagIngestionStatusHostedService.cs`)
- Ingestion status → Agent database: updates status (evidence: `src/NTG.Agent.LightRag/BackgroundServices/LightRagIngestionStatusHostedService.cs`)
- Agent administration → Agent database: persists agents (evidence: `src/NTG.Agent.Orchestrator/Controllers/AgentAdminController.cs`)
- Admin dashboard → Agent administration: manages agents
- Conversation sharing → Agent database: stores shares
- Token tracking → Agent database: records usage
- Aspire host → SQL Server: starts database (evidence: `README.md`)
- Aspire host → Admin dashboard: launches (evidence: `README.md`)
- Aspire host → Blazor chat: launches (evidence: `README.md`)
- Aspire host → CopilotKit chat: launches (evidence: `README.md`)
- MCP tools → LLM provider: provides tools
