A production-grade Chief AI Officer microservice designed to handle complex, multi-intent customer queries by orchestrating specialized AI Agents.
This system bridges legacy JVM enterprise architectures with modern Generative AI by utilizing Java 21 Virtual Threads for massive concurrency and Spring AI for robust Agent/LLM abstractions.
For a deep dive into the architecture and components, please review the following:
- Architecture Design
- Component Specifications
- Communication & IPC Strategy
- UI/UX Dashboard Blueprint
- Project Roadmap
- Bug Tracking
When a user submits a query, the system does not rely on a single, hallucination-prone monolithic LLM. Instead, it utilizes an Orchestrator pattern:
- Supervisor Agent (
SupervisorAgent.java): The master orchestrator. It intercepts natural language requests, breaks them down, and distributes sub-tasks concurrently to specialized worker agents usingCompletableFuturerunning on Java 21 Virtual Threads. - Billing MCP Server (Sandboxed): A specialized worker agent extracted into its own standalone microservice module. It uses the Model Context Protocol (MCP) to expose database queries (H2) without giving the Orchestrator direct data access.
- Support Agent (RAG): A specialized worker agent dedicated to parsing IT Manuals and documentation to provide deterministic tech support.
graph TD;
User([User Request]) -->|REST Endpoint| SwarmOrchestrator[Swarm Orchestrator]
subgraph Multi-Module Architecture
SwarmOrchestrator
BillingMCPServer[Billing MCP Server]
Support[Tech Support Agent]
SwarmOrchestrator -- Concurrently Routes --> BillingClient
SwarmOrchestrator -- Concurrently Routes --> Support
BillingClient -.->|MCP Protocol| BillingMCPServer
BillingMCPServer -.->|JPA| DB[(H2 SQL Database)]
Support -.->|RAG| VectorDB[(Vector Store)]
end
- Spring AI: Abstracted chat clients and prompt engineering.
- Function Calling: Defined via standard Java
@Beanand@Descriptionannotations, seamlessly translated into LLM tools. - JPA & H2 In-Memory DB: Secure sandbox for the Billing Agent.
- Java 21 Project Loom: Non-blocking Virtual Threads to ensure the Supervisor can handle hundreds of concurrent agent conversations without OS thread starvation.
Our core Enterprise Swarm logic has roughly 80% total Instruction Coverage (480 covered / 122 missed instructions)! Here are the highlights for our most complex mathematically-driven components:
- DebateResolver: 100% Covered! 🟢
- CausalArmorInterceptor: 95.7% Covered! 🟢
- SupervisorAgent: 81.1% Covered! 🟢
The only things lightly covered are the basic Spring Boot Application runner and the ChatController (which just delegates).
To test the entire Swarm Ecosystem locally, you will need 3 separate terminal tabs.
- Add your OpenAI API key to
swarm-orchestrator/src/main/resources/application.yml(or export it asOPENAI_API_KEY). - Build the entire multi-module project (if you haven't yet):
./mvnw clean install -DskipTests
- Terminal 1: Boot the Billing MCP Server:
cd billing-mcp-server ../mvnw spring-boot:run - Terminal 2: Boot the Swarm Orchestrator:
cd swarm-orchestrator ../mvnw spring-boot:run - Terminal 3: Boot the React Dashboard UI:
cd swarm-dashboard npm install npm run dev
Once all three are running, open your browser to http://localhost:5173 (or the port Vite provides) to interact with the Swarm via the premium glassmorphic UI!
The React + Vite Dashboard has been engineered with enterprise-grade UX in mind. Be sure to test the following features:
- Multi-Channel Chat: Click on the different agents in the left sidebar (Supervisor, Billing, Support, Sales). Each agent maintains its own completely isolated, persistent chat history powered by a global Zustand store.
- Dynamic Theming: Open the
Settingstab (Gear icon) and toggle the global themes (Dark,Light,AMOLED,Cyberpunk) to see the CSS variables dynamically swap the entire aesthetic. - Observability Telemetry: Open the
Observabilitytab to view real-time frontend telemetry simulation, tracking Virtual Threads and active MCP sessions connected to the backend. - Responsive Layouts: Toggle
Compact Layoutin the settings to switch the entire application between a spacious glassmorphic UI and a data-dense, compact enterprise grid.