English | 简体中文 | 日本語 | 한국어 | Русский | Español
🚀 An enterprise-grade multi-agent architecture platform based on Spring AI and WebFlux, supporting advanced paradigms like Function Calling and ReAct, providing powerful and flexible infrastructure for building intelligent conversational systems.
- 🤖 Multi-Agent Collaboration Architecture - Unified management and scheduling of various types of intelligent agents
- 🔄 Function Calling Support - Complete tool calling capabilities with custom function extensions
- ⚡ ReAct Paradigm Implementation - Reasoning-Action cycles enabling complex multi-step reasoning
- 🌊 Reactive Programming - Non-blocking asynchronous architecture based on WebFlux
- 💾 Multi-Data Source Support - Dual data storage strategy with PostgreSQL + Redis
- 🐳 Containerized Deployment - Complete Docker support with one-click deployment
- 🔧 Highly Configurable - Flexible configuration management supporting multiple LLM providers
- 🎯 Enterprise Features - User isolation, permission management, session persistence
graph TB
A[User Request] --> B[Assistant Controller]
B --> C[Intent Agent]
C --> D[Agent Manager]
D --> E[Specific Agent Instance]
E --> F[LLM Service]
F --> G[Function Calling]
G --> H[Tool Execution]
G --> I[Card Rendering]
H --> F
I --> J[Response Return]
subgraph "Data Layer"
K[PostgreSQL]
L[Redis]
end
D -.-> K
D -.-> L
- Java: 17+
- Maven: 3.6+
- PostgreSQL: 12+
- Redis: 6+
-
Clone Project
git clone https://github.com/your-username/multi-agent-arch.git cd multi-agent-arch -
Configure Database
Create PostgreSQL database:
CREATE DATABASE assistant;
-
Configure Environment Variables
Copy and edit configuration file:
# Database configuration export SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/assistant export SPRING_DATASOURCE_USERNAME=your_username export SPRING_DATASOURCE_PASSWORD=your_password # Redis configuration export SPRING_REDIS_HOST=localhost export SPRING_REDIS_PORT=6379 export SPRING_REDIS_PASSWORD=your_redis_password # LLM configuration (OpenAI compatible API) export LLM_MODEL_SERIES=qwen export LLM_API_KEY=your_api_key export LLM_ADDRESS=https://dashscope.aliyuncs.com/compatible-mode/v1 export LLM_MODEL=qwen-plus
-
Run Application
mvn spring-boot:run
Or build and run:
mvn clean package java -jar target/mss-ai.jar
-
Verify Service
After service startup, visit health check endpoint:
curl http://localhost:8080/ai/actuator/health
-
Build Image
mvn clean package docker build -t multi-agent-arch . -
Run Container
docker run -d \ --name multi-agent-arch \ -p 8080:8080 \ -e SPRING_DATASOURCE_URL=jdbc:postgresql://host.docker.internal:5432/assistant \ -e SPRING_DATASOURCE_USERNAME=your_username \ -e SPRING_DATASOURCE_PASSWORD=your_password \ -e LLM_API_KEY=your_api_key \ multi-agent-arch
POST /ai/chat/completions
Initiate conversation with agents, supporting streaming responses.
curl -X POST http://localhost:8080/ai/chat/completions \
-H "Content-Type: application/json" \
-d '{
"content": "Help me check today'\''s weather",
"extra": {
"location": "Beijing",
"language": "zh-CN"
}
}'Request Parameters:
content(string, required): User input message contentextra(object, optional): Additional context information
Response Format:
{
"content": "OK, let me help you check the weather information in Beijing...",
"status": "REPLYING",
"data": {},
"design": {}
}The system automatically recognizes user intents and dispatches corresponding agents:
- General Conversation Agent - Handles daily conversations
- Tool Calling Agent - Executes specific function calls
- Knowledge Retrieval Agent - Performs information queries and analysis
The system supports complete function calling lifecycle:
- Function Registration - Define available tool functions in agent configuration
- Call Parsing - LLM automatically identifies functions to call
- Parameter Extraction - Extract function call parameters from conversations
- Function Execution - Call actual business logic
- Result Processing - Feed execution results back to LLM for next step processing
Responsible for agent lifecycle management:
- Agent type loading and management
- Agent instance creation and destruction
- Session state timeout management (15-minute auto-expiration)
LLM-based intent recognition system:
- Analyze business type of user input
- Auto-dispatch to corresponding professional agents
- Support dynamic intent configuration
Unified LLM calling interface:
- Support multiple LLM providers (currently implements Qwen)
- Streaming and non-streaming response modes
- Complete Function Calling support
Extensible function calling framework:
- Support local and remote function calls
- Unified calling interface and response format
- Support card-style response rendering
# Basic service configuration
spring:
webflux:
base-path: /ai
data:
redis:
host: ${SPRING_REDIS_HOST:localhost}
port: ${SPRING_REDIS_PORT:6379}
password: ${SPRING_REDIS_PASSWORD}
datasource:
url: ${SPRING_DATASOURCE_URL:jdbc:postgresql://localhost:5432/assistant}
username: ${SPRING_DATASOURCE_USERNAME}
password: ${SPRING_DATASOURCE_PASSWORD}
driver-class-name: org.postgresql.Driver
jpa:
hibernate:
ddl-auto: update
show-sql: true
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQLDialect
# Business configuration
business:
llm:
model-series: ${LLM_MODEL_SERIES:qwen}
api-key: ${LLM_API_KEY}
url: ${LLM_ADDRESS}
model: ${LLM_MODEL}
# Logging configuration
logging:
level:
root: ${LOGGING_LEVEL:info}
site.nullpointer.mss.ai: DEBUGcurl -X POST http://localhost:8080/ai/chat/completions \
-H "Content-Type: application/json" \
-d '{
"content": "Hello, please introduce yourself"
}'curl -X POST http://localhost:8080/ai/chat/completions \
-H "Content-Type: application/json" \
-d '{
"content": "Help me create a todo: complete project documentation",
"extra": {
"priority": "high",
"category": "work"
}
}'curl -X POST http://localhost:8080/ai/chat/completions \
-H "Content-Type: application/json" \
-d '{
"content": "I need to analyze user purchase behavior data, can you help me?"
}'The system will automatically execute the following steps:
- Analyze user requirements
- Call data analysis tools
- Parse analysis results
- Provide insights and recommendations
- Insert new agent type in database:
INSERT INTO agent_type (type, system_prompt, function_tools, temperature, description, is_public, enterprise_id)
VALUES (
'CUSTOM_AGENT',
'You are a professional data analysis assistant...',
'[{"function": {"name": "analyze_data", "description": "Analyze data"}}]',
0.7,
'Data Analysis Agent',
true,
'default'
);- Restart application or call AgentManager's
loadAgentType()method to reload configuration.
- Implement
FunctionCallServiceinterface:
@Service
public class CustomFunctionCallService implements FunctionCallService {
@Override
public FunctionCallResult apply(FunctionCallRequest request) {
// Implement your business logic
return FunctionCallResult.builder()
.content("Execution result")
.build();
}
}- Register your function in agent configuration:
{
"function": {
"name": "custom_function",
"description": "Custom function description",
"parameters": {
"type": "object",
"properties": {
"param1": {"type": "string"}
}
}
}
}We welcome all forms of contributions! Please read the following guidelines:
- Fork this repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow Spring Boot best practices
- Use Lombok to reduce boilerplate code
- Keep code clean and readable
- Add appropriate unit tests
This project is licensed under the Apache License 2.0. See LICENSE file for details.
- Spring AI - Providing powerful AI integration framework
- Spring WebFlux - Reactive web framework
- Qwen - Providing excellent LLM capabilities
- Project homepage: https://github.com/your-username/multi-agent-arch
- Issue feedback: Issues
- Discussions: Discussions
If this project helps you, please give us a ⭐️
Made with ❤️ by the Multi-Agent Architecture Team