# bittuvaibhav/multi-agent-ai-platform architecture

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

- Interactive diagram: https://gitdiagram.com/bittuvaibhav/multi-agent-ai-platform
- Repository: https://github.com/bittuvaibhav/multi-agent-ai-platform

## Overview

#### Purpose and entry points
Enterprise Multi-Agent AI Platform is a .NET 10 service suite for planning and executing specialized AI-agent workflows, RAG, guarded natural-language SQL, memory, and plugin tools. The primary host is the ASP.NET Core API at `src/Enterprise.Agent.Api/Program.cs`; its REST controllers and SignalR hub are under `src/Enterprise.Agent.Api/Controllers` and `src/Enterprise.Agent.Api/Hubs/ChatHub.cs`. A separate Razor Pages console starts at `src/Enterprise.Agent.Ui/Program.cs` and calls the API as a thin client.

#### API boundary, security, and request pipeline
Controllers expose chat, agent planning/direct invocation, RAG/document ingestion, SQL, memory, and tools; chat enters through `src/Enterprise.Agent.Api/Controllers/ChatController.cs`. API-key or JWT authentication is implemented by `src/Enterprise.Agent.Security/ApiKey/ApiKeyAuthenticationHandler.cs` and `src/Enterprise.Agent.Security/Jwt/JwtTokenService.cs`. Correlation and centralized error handling form the HTTP boundary in `src/Enterprise.Agent.Api/Middleware/CorrelationIdMiddleware.cs` and `src/Enterprise.Agent.Api/Middleware/ExceptionHandlingMiddleware.cs`.

#### Application and orchestration flow
Chat commands are handled through MediatR/CQRS in `src/Enterprise.Agent.Core/Application/Chat/ProcessChatCommand.cs`, with validation and logging behaviors in `src/Enterprise.Agent.Core/Application/Behaviors`. The handler builds execution context, optionally uses memory/RAG, asks a planner for a workflow, and executes it through `src/Enterprise.Agent.Core/Orchestration/AgentOrchestrator.cs`. The orchestrator owns sequential/parallel step execution, retry, timeout, cancellation, history, and failure policy; workflow contracts live in `src/Enterprise.Agent.Models/Orchestration/WorkflowPlan.cs` and `src/Enterprise.Agent.Models/Orchestration/ExecutionContext.cs`.

#### Planning and agent execution
Planning is abstracted behind `IPlanner`, with an LLM plan generator in `src/Enterprise.Agent.Core/Orchestration/LlmPlanner.cs` and deterministic fallback in `src/Enterprise.Agent.Core/Orchestration/KeywordPlanner.cs`. Agents are discovered through `src/Enterprise.Agent.Core/Agents/AgentRegistry.cs`, implement the `IAgent` boundary, and share prompt-driven behavior from `src/Enterprise.Agent.Core/Agents/AgentBase.cs`. Specialized implementations—including coordinator/final synthesis, RAG, SQL, research, writing, code, and analytics—reside in `src/Enterprise.Agent.Core/Agents/Implementations`.

#### AI, prompts, and tools
Agent inference is provider-agnostic: Semantic Kernel adapters in `src/Enterprise.Agent.Infrastructure/AI/SemanticKernelChatProvider.cs` and `src/Enterprise.Agent.Infrastructure/AI/KernelFactory.cs` select OpenAI or Azure OpenAI from configuration. Versioned system and planner prompts are loaded through `src/Enterprise.Agent.Prompts/Registry/PromptRegistry.cs`, with embedded prompt assets such as `src/Enterprise.Agent.Prompts/Library/planner.v2.prompt.md`. Semantic Kernel tool plugins are implemented in `src/Enterprise.Agent.Tools` and exposed/catalogued by `src/Enterprise.Agent.Plugins/ToolRegistry.cs`.

#### Knowledge, memory, and SQL boundaries
Document ingestion extracts text, chunks it, embeds it, and stores vectors through `src/Enterprise.Agent.Infrastructure/Rag/RagService.cs` and `src/Enterprise.Agent.Infrastructure/Rag/DocumentChunker.cs`. Vector persistence is selected behind `IVectorStore`, with PostgreSQL/pgvector and Azure AI Search implementations at `src/Enterprise.Agent.VectorStore/Postgres/PostgresVectorStore.cs` and `src/Enterprise.Agent.VectorStore/AzureSearch/AzureAiSearchVectorStore.cs`. Redis supports conversation and long-term memory via `src/Enterprise.Agent.Memory/Redis/RedisConversationMemory.cs`; semantic memory uses `src/Enterprise.Agent.Memory/Semantic/VectorSemanticMemory.cs`. Natural-language SQL follows generate → read-only validation → execute → summarize in `src/Enterprise.Agent.Infrastructure/Sql/SqlAgentService.cs`, guarded by `src/Enterprise.Agent.Infrastructure/Sql/SqlSafetyValidator.cs`.

#### Persistence and deployment
EF Core operational persistence is centered on `src/Enterprise.Agent.Persistence/AgentDbContext.cs`, with code-first migrations under `src/Enterprise.Agent.Persistence/Migrations`. Material dependencies are SQL Server, Redis, PostgreSQL with pgvector or Azure AI Search, OpenAI or Azure OpenAI, and optional SMTP. `docker-compose.yml` defines the local API, SQL Server, Redis, and PostgreSQL stack; `Dockerfile` and `Dockerfile.ui` build the API and UI containers.

Main entry points: [`src/Enterprise.Agent.Core/Agents/Implementations`](https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Core/Agents/Implementations) (Specialized agents), [`src/Enterprise.Agent.Core/Application/Chat/ProcessChatCommand.cs`](https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Core/Application/Chat/ProcessChatCommand.cs) (Chat command pipeline), [`docker-compose.yml`](https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/docker-compose.yml) (Local deployment stack), [`src/Enterprise.Agent.Api/Middleware/CorrelationIdMiddleware.cs`](https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Api/Middleware/CorrelationIdMiddleware.cs) (HTTP pipeline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API &amp; Clients"]
  node_ui["Razor Pages UI<br/>thin client<br/>[Program.cs]"]
  node_api_host["ASP.NET Core API<br/>service host<br/>[Program.cs]"]
  node_http_pipeline["HTTP pipeline<br/>middleware"]
  node_auth["API key / JWT auth<br/>security"]
  node_chat_api["Chat API &amp; hub<br/>REST / SignalR<br/>[ChatController.cs]"]
end

subgraph group_core["Workflow Core"]
  node_chat_command["Chat command pipeline<br/>MediatR CQRS"]
  node_orchestrator{{"Agent orchestrator<br/>workflow runtime"}}
  node_workflow_contracts["Workflow contracts<br/>models<br/>[WorkflowPlan.cs]"]
  node_planner["Planner<br/>[LlmPlanner.cs]"]
  node_agent_registry["Agent registry<br/>agent discovery<br/>[AgentRegistry.cs]"]
  node_agents["Specialized agents<br/>IAgent fleet<br/>[Implementations]"]
end

subgraph group_ai["AI &amp; Tools"]
  node_prompts["Prompt registry<br/>versioned prompts<br/>[PromptRegistry.cs]"]
  node_llm_provider["LLM provider adapter<br/>Semantic Kernel AI"]
  node_plugins["Tool registry &amp; plugins<br/>Semantic Kernel tools<br/>[ToolRegistry.cs]"]
end

subgraph group_data["Knowledge &amp; Persistence"]
  node_rag["RAG service<br/>ingestion &amp; retrieval<br/>[RagService.cs]"]
  node_vector_store[("Vector store<br/>IVectorStore")]
  node_memory[("Conversation &amp; semantic memory<br/>memory services")]
  node_sql_service["Guarded SQL service<br/>NL SQL pipeline<br/>[SqlAgentService.cs]"]
  node_sql_safety["SQL safety validator<br/>read-only guard"]
  node_operational_db[("Operational persistence<br/>EF Core<br/>[AgentDbContext.cs]")]
  node_local_stack["Local deployment stack<br/>Docker Compose<br/>[docker-compose.yml]"]
end

node_ui -->|"API calls"| node_api_host
node_api_host -->|"hosts"| node_http_pipeline
node_http_pipeline -->|"authenticates"| node_auth
node_http_pipeline -->|"routes requests"| node_chat_api
node_chat_api -->|"dispatches"| node_chat_command
node_chat_command -->|"loads context"| node_memory
node_chat_command -.->|"optional retrieval"| node_rag
node_chat_command -->|"requests plan"| node_planner
node_chat_command -->|"executes plan"| node_orchestrator
node_planner -->|"produces"| node_workflow_contracts
node_orchestrator -->|"uses"| node_workflow_contracts
node_orchestrator -->|"resolves steps"| node_agent_registry
node_agent_registry -->|"discovers"| node_agents
node_agents -->|"loads prompts"| node_prompts
node_agents -->|"inference"| node_llm_provider
node_agents -->|"invokes tools"| node_plugins
node_agents -->|"retrieval / ingestion"| node_rag
node_agents -->|"NL SQL"| node_sql_service
node_agents -->|"reads and writes"| node_memory
node_rag -->|"stores / searches vectors"| node_vector_store
node_sql_service -->|"validates generated SQL"| node_sql_safety
node_sql_service -->|"executes approved queries"| node_operational_db
node_chat_command -.->|"persists operational state"| node_operational_db
node_local_stack -.->|"runs locally"| node_api_host
node_local_stack -.->|"provides Redis"| node_memory
node_local_stack -.->|"provides PostgreSQL"| node_vector_store
node_local_stack -.->|"provides SQL Server"| node_operational_db

click node_ui "https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Ui/Program.cs"
click node_api_host "https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Api/Program.cs"
click node_http_pipeline "https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Api/Middleware/CorrelationIdMiddleware.cs"
click node_auth "https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Security/ApiKey/ApiKeyAuthenticationHandler.cs"
click node_chat_api "https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Api/Controllers/ChatController.cs"
click node_chat_command "https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Core/Application/Chat/ProcessChatCommand.cs"
click node_orchestrator "https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Core/Orchestration/AgentOrchestrator.cs"
click node_workflow_contracts "https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Models/Orchestration/WorkflowPlan.cs"
click node_planner "https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Core/Orchestration/LlmPlanner.cs"
click node_agent_registry "https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Core/Agents/AgentRegistry.cs"
click node_agents "https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Core/Agents/Implementations"
click node_prompts "https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Prompts/Registry/PromptRegistry.cs"
click node_llm_provider "https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Infrastructure/AI/SemanticKernelChatProvider.cs"
click node_plugins "https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Plugins/ToolRegistry.cs"
click node_rag "https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Infrastructure/Rag/RagService.cs"
click node_vector_store "https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.VectorStore/Postgres/PostgresVectorStore.cs"
click node_memory "https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Memory/Redis/RedisConversationMemory.cs"
click node_sql_service "https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Infrastructure/Sql/SqlAgentService.cs"
click node_sql_safety "https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Infrastructure/Sql/SqlSafetyValidator.cs"
click node_operational_db "https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Persistence/AgentDbContext.cs"
click node_local_stack "https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/docker-compose.yml"

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_ui,node_api_host,node_http_pipeline,node_auth,node_chat_api toneBlue
class node_chat_command,node_orchestrator,node_workflow_contracts,node_planner,node_agent_registry,node_agents toneAmber
class node_prompts,node_llm_provider,node_plugins toneMint
class node_rag,node_vector_store,node_memory,node_sql_service,node_sql_safety,node_operational_db,node_local_stack toneRose
```

## Components

### API & Clients

- [Razor Pages UI](https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Ui/Program.cs): thin client · Calls the API. · `src/Enterprise.Agent.Ui/Program.cs`
- [ASP.NET Core API](https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Api/Program.cs): service host · Primary service entry point. · `src/Enterprise.Agent.Api/Program.cs`
- [HTTP pipeline](https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Api/Middleware/CorrelationIdMiddleware.cs): middleware · Correlation IDs and centralized errors. · `src/Enterprise.Agent.Api/Middleware/CorrelationIdMiddleware.cs`
- [API key / JWT auth](https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Security/ApiKey/ApiKeyAuthenticationHandler.cs): security · `src/Enterprise.Agent.Security/ApiKey/ApiKeyAuthenticationHandler.cs`
- [Chat API & hub](https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Api/Controllers/ChatController.cs): REST / SignalR · Chat enters through the controller; hub supports realtime clients. · `src/Enterprise.Agent.Api/Controllers/ChatController.cs`

### Workflow Core

- [Chat command pipeline](https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Core/Application/Chat/ProcessChatCommand.cs): MediatR CQRS · Validation and logging behaviors surround command handling. · `src/Enterprise.Agent.Core/Application/Chat/ProcessChatCommand.cs`
- [Agent orchestrator](https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Core/Orchestration/AgentOrchestrator.cs): workflow runtime · Executes workflow steps with policy, retry, timeout, and history. · `src/Enterprise.Agent.Core/Orchestration/AgentOrchestrator.cs`
- [Workflow contracts](https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Models/Orchestration/WorkflowPlan.cs): models · Workflow plans and execution context. · `src/Enterprise.Agent.Models/Orchestration/WorkflowPlan.cs`
- [Planner](https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Core/Orchestration/LlmPlanner.cs): IPlanner implementations · LLM planning with deterministic keyword fallback. · `src/Enterprise.Agent.Core/Orchestration/LlmPlanner.cs`
- [Agent registry](https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Core/Agents/AgentRegistry.cs): agent discovery · Resolves specialized IAgent implementations. · `src/Enterprise.Agent.Core/Agents/AgentRegistry.cs`
- [Specialized agents](https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Core/Agents/Implementations): IAgent fleet · Coordinator, RAG, SQL, research, writing, code, and analytics agents. · `src/Enterprise.Agent.Core/Agents/Implementations`

### AI & Tools

- [Prompt registry](https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Prompts/Registry/PromptRegistry.cs): versioned prompts · Loads embedded system and planner prompts. · `src/Enterprise.Agent.Prompts/Registry/PromptRegistry.cs`
- [LLM provider adapter](https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Infrastructure/AI/SemanticKernelChatProvider.cs): Semantic Kernel AI · Selects OpenAI or Azure OpenAI. · `src/Enterprise.Agent.Infrastructure/AI/SemanticKernelChatProvider.cs`
- [Tool registry & plugins](https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Plugins/ToolRegistry.cs): Semantic Kernel tools · Catalogues plugin tools for agents. · `src/Enterprise.Agent.Plugins/ToolRegistry.cs`

### Knowledge & Persistence

- [RAG service](https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Infrastructure/Rag/RagService.cs): ingestion & retrieval · Extracts, chunks, embeds, stores, and retrieves document content. · `src/Enterprise.Agent.Infrastructure/Rag/RagService.cs`
- [Vector store](https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.VectorStore/Postgres/PostgresVectorStore.cs): IVectorStore · PostgreSQL/pgvector or Azure AI Search. · `src/Enterprise.Agent.VectorStore/Postgres/PostgresVectorStore.cs`
- [Conversation & semantic memory](https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Memory/Redis/RedisConversationMemory.cs): memory services · Redis conversation memory plus vector semantic memory. · `src/Enterprise.Agent.Memory/Redis/RedisConversationMemory.cs`
- [Guarded SQL service](https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Infrastructure/Sql/SqlAgentService.cs): NL SQL pipeline · Generates, validates read-only SQL, executes, and summarizes. · `src/Enterprise.Agent.Infrastructure/Sql/SqlAgentService.cs`
- [SQL safety validator](https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Infrastructure/Sql/SqlSafetyValidator.cs): read-only guard · `src/Enterprise.Agent.Infrastructure/Sql/SqlSafetyValidator.cs`
- [Operational persistence](https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/src/Enterprise.Agent.Persistence/AgentDbContext.cs): EF Core · SQL Server-backed operational data and migrations. · `src/Enterprise.Agent.Persistence/AgentDbContext.cs`
- [Local deployment stack](https://github.com/bittuvaibhav/multi-agent-ai-platform/blob/main/docker-compose.yml): Docker Compose · API, SQL Server, Redis, and PostgreSQL. · `docker-compose.yml`

## Connections

- Razor Pages UI → ASP.NET Core API: API calls
- ASP.NET Core API → HTTP pipeline: hosts
- HTTP pipeline → API key / JWT auth: authenticates
- HTTP pipeline → Chat API & hub: routes requests
- Chat API & hub → Chat command pipeline: dispatches
- Chat command pipeline → Conversation & semantic memory: loads context
- Chat command pipeline → RAG service: optional retrieval
- Chat command pipeline → Planner: requests plan
- Chat command pipeline → Agent orchestrator: executes plan
- Planner → Workflow contracts: produces
- Agent orchestrator → Workflow contracts: uses
- Agent orchestrator → Agent registry: resolves steps
- Agent registry → Specialized agents: discovers
- Specialized agents → Prompt registry: loads prompts
- Specialized agents → LLM provider adapter: inference
- Specialized agents → Tool registry & plugins: invokes tools
- Specialized agents → RAG service: retrieval / ingestion
- Specialized agents → Guarded SQL service: NL SQL
- Specialized agents → Conversation & semantic memory: reads and writes
- RAG service → Vector store: stores / searches vectors
- Guarded SQL service → SQL safety validator: validates generated SQL
- Guarded SQL service → Operational persistence: executes approved queries
- Chat command pipeline → Operational persistence: persists operational state
- Local deployment stack → ASP.NET Core API: runs locally
- Local deployment stack → Conversation & semantic memory: provides Redis
- Local deployment stack → Vector store: provides PostgreSQL
- Local deployment stack → Operational persistence: provides SQL Server
