How bittuvaibhav/multi-agent-ai-platform works
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: Implementations Specialized agents · ProcessChatCommand.cs Chat command pipeline · docker-compose.yml Local deployment stack · CorrelationIdMiddleware.cs HTTP pipeline
Components 21
API & Clients
- Razor Pages UI · Calls the API.
src/Enterprise.Agent.Ui/Program.cs - ASP.NET Core API · Primary service entry point.
src/Enterprise.Agent.Api/Program.cs - HTTP pipeline · Correlation IDs and centralized errors.
src/Enterprise.Agent.Api/Middleware/CorrelationIdMiddleware.cs - API key / JWT auth
src/Enterprise.Agent.Security/ApiKey/ApiKeyAuthenticationHandler.cs - Chat API & hub · Chat enters through the controller; hub supports realtime clients.
src/Enterprise.Agent.Api/Controllers/ChatController.cs
Workflow Core
- Chat command pipeline · Validation and logging behaviors surround command handling.
src/Enterprise.Agent.Core/Application/Chat/ProcessChatCommand.cs - Agent orchestrator · Executes workflow steps with policy, retry, timeout, and history.
src/Enterprise.Agent.Core/Orchestration/AgentOrchestrator.cs - Workflow contracts · Workflow plans and execution context.
src/Enterprise.Agent.Models/Orchestration/WorkflowPlan.cs - Planner · LLM planning with deterministic keyword fallback.
src/Enterprise.Agent.Core/Orchestration/LlmPlanner.cs - Agent registry · Resolves specialized IAgent implementations.
src/Enterprise.Agent.Core/Agents/AgentRegistry.cs - Specialized agents · Coordinator, RAG, SQL, research, writing, code, and analytics agents.
src/Enterprise.Agent.Core/Agents/Implementations
AI & Tools
- Prompt registry · Loads embedded system and planner prompts.
src/Enterprise.Agent.Prompts/Registry/PromptRegistry.cs - LLM provider adapter · Selects OpenAI or Azure OpenAI.
src/Enterprise.Agent.Infrastructure/AI/SemanticKernelChatProvider.cs - Tool registry & plugins · Catalogues plugin tools for agents.
src/Enterprise.Agent.Plugins/ToolRegistry.cs
Knowledge & Persistence
- RAG service · Extracts, chunks, embeds, stores, and retrieves document content.
src/Enterprise.Agent.Infrastructure/Rag/RagService.cs - Vector store · PostgreSQL/pgvector or Azure AI Search.
src/Enterprise.Agent.VectorStore/Postgres/PostgresVectorStore.cs - Conversation & semantic memory · Redis conversation memory plus vector semantic memory.
src/Enterprise.Agent.Memory/Redis/RedisConversationMemory.cs - Guarded SQL service · Generates, validates read-only SQL, executes, and summarizes.
src/Enterprise.Agent.Infrastructure/Sql/SqlAgentService.cs - SQL safety validator
src/Enterprise.Agent.Infrastructure/Sql/SqlSafetyValidator.cs - Operational persistence · SQL Server-backed operational data and migrations.
src/Enterprise.Agent.Persistence/AgentDbContext.cs - Local deployment stack · API, SQL Server, Redis, and PostgreSQL.
docker-compose.yml
Connections 27
- 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