Skip to content

Latest commit

 

History

History
104 lines (85 loc) · 4.4 KB

File metadata and controls

104 lines (85 loc) · 4.4 KB

AI Workforce Platform — Backend

Spring Boot (Java 21) backend service for the AI Workforce Platform.

Stack

  • 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)

Package structure

Java packages can't contain hyphens, so diagram names like support-agent / ai-engine map to supportagent / 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

Two-layer design (why some names appear twice)

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).
  • aiengine owns LLM reasoning, prompts, memory, and retrieval.
  • events decouples modules via a Kafka-based producer/consumer backbone.

Run locally

cd backend
./mvnw spring-boot:run

Then:

Build & test

./mvnw clean verify        # compile + run tests
./mvnw clean package       # build the runnable jar (target/*.jar)

Use PostgreSQL (production)

SPRING_PROFILES_ACTIVE=prod \
DB_URL=jdbc:postgresql://localhost:5432/aiworkforce \
DB_USERNAME=postgres DB_PASSWORD=secret \
./mvnw spring-boot:run

The current security config is a permissive placeholder so the app runs during scaffolding. Real auth rules are implemented per the business requirements.