Spring Boot (Java 21) backend service for the AI Workforce Platform.
- Java 21 · Spring Boot 3.4
- Spring Web (REST) · Spring Data JPA · Spring Security · Bean Validation
- H2 (in-memory) for local dev · PostgreSQL for production
- Maven (with wrapper — no local Maven install needed)
Java packages can't contain hyphens, so diagram names like
support-agent/ai-enginemap tosupportagent/aiengine.
Phase 3 — Multi-Agent System.
src/main/java/com/company
│
├── aiengine # AI execution layer (the "brain")
│ ├── orchestrator # decides which agent runs, runs the agent loop
│ ├── llm # LLM client abstraction + providers
│ ├── prompts # loads system prompts from resources/prompts
│ ├── tools # LLM-callable tool wrappers the agent invokes
│ │ ├── gmail · calendar · whatsapp · crm · search
│ ├── memory # conversation / short- & long-term memory
│ ├── vectorsearch # embeddings + similarity search
│ └── workflow # agentic execution graphs (LLM chains)
│
├── agents # the AI workforce — one sub-module per agent role
│ ├── support # ┐ each agent is layered:
│ ├── sales # │ controller · service ·
│ ├── meeting # ├ repository · entity · dto
│ ├── hr # │
│ └── invoice # ┘
│
├── workflow # workflow automation (one package per business process)
│ ├── leadworkflow · supportworkflow · recruitmentworkflow · invoiceworkflow
├── events # event-driven backbone (Kafka)
│ ├── producer · consumer · kafka · schemas
├── integrations # external service clients
│ ├── gmail · slack · hubspot · zoho · whatsapp · salesforce
│
├── auth # authentication & login ┐ supporting
├── organization # tenant / company accounts │ domain +
├── user # platform users │ infra
├── knowledgebase # documents & embeddings │ modules
├── notification # email / in-app notifications ┘
│
├── security # Spring Security config (JWT/auth rules)
├── common # shared utilities, base classes, health endpoint
└── config # cross-cutting configuration (beans, CORS, etc.)
System prompts live on the classpath at:
src/main/resources/prompts
├── support/system.txt sales/system.txt meeting/system.txt
├── hr/system.txt invoice/system.txt
└── common/guidelines.txt # shared rules applied to every agent
| Concern | aiengine (AI layer) |
Top-level module (infra/business layer) |
|---|---|---|
| Acting on the world | aiengine/tools — LLM-callable wrappers with schemas the agent invokes mid-reasoning |
integrations — the actual external API clients (auth, raw calls) the tools delegate to |
| Multi-step processes | aiengine/workflow — agentic execution graphs / LLM chains |
workflow — business-process automation across agents (lead, support, recruitment, invoice) |
agents/<role>owns the REST API + persistence for that agent (config, tasks, conversations).aiengineowns LLM reasoning, prompts, memory, and retrieval.eventsdecouples modules via a Kafka-based producer/consumer backbone.
cd backend
./mvnw spring-boot:runThen:
- Health check: http://localhost:8080/api/health
- H2 console (dev): http://localhost:8080/h2-console
./mvnw clean verify # compile + run tests
./mvnw clean package # build the runnable jar (target/*.jar)SPRING_PROFILES_ACTIVE=prod \
DB_URL=jdbc:postgresql://localhost:5432/aiworkforce \
DB_USERNAME=postgres DB_PASSWORD=secret \
./mvnw spring-boot:runThe current
securityconfig is a permissive placeholder so the app runs during scaffolding. Real auth rules are implemented per the business requirements.