项目概述 / Project Overview
随着大语言模型(LLMs)在多智能体系统中的广泛应用,任务往往需要多轮推理、结构化输出和智能体间的协作决策。然而,现有框架普遍缺乏明确支持任务分解、智能体通信和运行时优化的领域特定语言(DSL)。
With the widespread adoption of Large Language Models (LLMs) in multi-agent systems, tasks often require multi-round reasoning, structured outputs, and collaborative decision-making among agents. However, existing frameworks generally lack a Domain-Specific Language (DSL) that explicitly supports task decomposition, agent communication, and runtime optimization.
受SGLang(NeurIPS 2024)启发,我们引入了一个新颖的多智能体DSL框架,旨在统一高级智能体编程与高效低级执行。这项工作弥合了面向智能体的编程与高性能运行时之间的差距,为多智能体协作、结构化生成和AI系统工程研究提供了一个可重现和可扩展的平台。
Inspired by SGLang (NeurIPS 2024), we introduce a novel Multi-Agent DSL framework designed to unify high-level agent programming with efficient low-level execution. This work bridges the gap between agent-oriented programming and high-performance runtimes, offering a reproducible and extensible platform for research in multi-agent collaboration, structured generation, and AI systems engineering.
核心创新 / Core Innovations
扩展DSL原语 / Extended DSL Primitives
引入spawn
、route
、gather
、with_sla
、contract
、blackboard
、on
和emit
等原语,明确建模任务分解、路由、约束和协作。
We introduce primitives like spawn, route, gather, with_sla, contract, blackboard, on, and emit to explicitly model task decomposition, routing, constraints, and collaboration.
运行时优化 / Runtime Optimizations
RadixTrie前缀缓存:通过在不同任务间复用公共前缀来减少冗余计算。
缓存感知调度:优先处理具有更长前缀的任务,提高吞吐量和响应时间。
RadixTrie Prefix Caching: Reduces redundant computations by reusing common prefixes across different tasks.
Cache-Aware Scheduling: Prioritizes tasks with longer prefixes to improve throughput and response time.
结构化输出生成 / Structured Output Generation
支持Regex和轻量级cFSM验证,确保输出符合所需格式。
Supports Regex and lightweight cFSM validation to ensure outputs conform to the required format.
事件驱动架构 / Event-Driven Architecture
内置EventBus支持智能体间的异步通信和协调。
A built-in EventBus enables asynchronous communication and coordination among agents.
全栈可重现性 / Full-Stack Reproducibility
框架提供集成示例、实验、单元测试、A/B比较工具和CLI,实现零依赖执行。
The framework is delivered with integrated examples, experiments, unit tests, A/B comparison tools, and a CLI for zero-dependency execution.
系统架构图 / System Architecture Diagrams

系统架构概览 / System Architecture Overview

数据流图 / Data Flow Diagram

组件交互图 / Component Interaction Diagram
实验结果 / Experimental Results
我们的框架在多个基准测试中展现了卓越的性能表现。 / Our framework demonstrates exceptional performance across multiple benchmark tests.
智能城市性能 / Smart City Performance



自动驾驶性能 / Autonomous Driving Performance



缓存优化效果 / Cache Optimization Results



演示与结果 / Demo & Results
我们的框架在两个具有挑战性的用例中得到了验证:智能城市和自动驾驶。 / Our framework has been validated in two challenging use cases: Smart City and Autonomous Driving.
🚀 如何查看完整演示 / How to View Full Demo
选择最适合您的部署方式,快速体验我们的多智能体DSL框架 / Choose the deployment method that suits you best to quickly experience our Multi-Agent DSL framework
本地开发环境 / Local Development Environment
简单 / Easy环境准备 / Environment Setup
确保系统已安装Python 3.8+和Node.js 16+ / Ensure Python 3.8+ and Node.js 16+ are installed
python --version && node --version
克隆项目 / Clone Repository
获取项目源代码 / Get the project source code
git clone https://github.com/Max-YUAN-22/Final-DSL.git
安装依赖 / Install Dependencies
安装Python和Node.js依赖包 / Install Python and Node.js dependencies
pip install -r requirements.txt
cd frontend && npm install
启动服务 / Start Services
分别启动后端和前端服务 / Start backend and frontend services separately
# 终端1: 启动后端 / Terminal 1: Start Backend
python backend/main.py
# 终端2: 启动前端 / Terminal 2: Start Frontend
cd frontend && npm start
访问系统 / Access System
在浏览器中打开系统 / Open the system in your browser
http://localhost:3001
Docker容器化部署 / Docker Containerized Deployment
中等 / Medium构建镜像 / Build Image
使用Dockerfile构建项目镜像 / Build project image using Dockerfile
docker build -t multi-agent-dsl:latest .
运行容器 / Run Container
启动Docker容器并映射端口 / Start Docker container with port mapping
docker run -d -p 3001:3001 --name multi-agent-dsl multi-agent-dsl:latest
验证部署 / Verify Deployment
检查容器状态和日志 / Check container status and logs
docker ps
docker logs multi-agent-dsl
云服务部署 / Cloud Service Deployment
高级 / Advanced🎯 演示功能特性 / Demo Features
实时监控 / Real-time Monitoring
系统性能指标实时展示 / Real-time system performance metrics display
事件处理 / Event Processing
智能事件路由和处理 / Intelligent event routing and processing
缓存优化 / Cache Optimization
RadixTrie前缀缓存效果展示 / RadixTrie prefix caching effect demonstration
交互式控制 / Interactive Control
动态调整系统参数和配置 / Dynamically adjust system parameters and configuration
应用场景 / Use Cases
智能城市 / Smart City
通过智能事件处理优化城市服务,如311事件响应。实现亚秒级处理时间,提高城市管理效率。 / Optimizing urban services like 311 incident response through intelligent event processing. Achieves sub-second processing times for critical events.
- 缓存命中率优化 / Cache Hit Rate Optimization
- 延迟分布优化 / Latency Distribution Optimization
- 实时事件处理 / Real-time Event Processing
自动驾驶 / Autonomous Driving
增强自动驾驶车辆协调的安全性和交通流量。支持快速、关键的决策制定,用于重新路由和场景清理。 / Enhancing safety and traffic flow in autonomous vehicle coordination. Enables rapid, critical decision-making for rerouting and scene clearance.
- 事件类型分布 / Event Type Distribution
- 决策时间优化 / Decision Time Optimization
- 安全场景管理 / Safety Scene Management
更多应用场景 / More Use Cases
我们的框架具有广泛的适用性,可以应用于多个领域。 / Our framework has broad applicability across multiple domains.
智慧医疗物联网 / Smart Healthcare IoT
实时监控患者生命体征,智能预警异常情况,优化医疗资源配置。
Real-time monitoring of patient vital signs, intelligent early warning of abnormalities, optimizing medical resource allocation.
- 患者监护 / Patient Monitoring
- 药物管理 / Medication Management
- 设备维护 / Equipment Maintenance
医学影像智能分析 / Medical Image Analysis
AI辅助诊断,提高影像识别准确率,缩短诊断时间。
AI-assisted diagnosis, improving image recognition accuracy and reducing diagnosis time.
- CT/MRI分析 / CT/MRI Analysis
- 病理检测 / Pathology Detection
- 诊断辅助 / Diagnostic Assistance
量化金融情感分析 / Quantitative Finance Sentiment
实时分析市场情绪,预测价格波动,优化投资策略。
Real-time market sentiment analysis, price volatility prediction, investment strategy optimization.
- 情绪监控 / Sentiment Monitoring
- 风险评估 / Risk Assessment
- 交易决策 / Trading Decisions
遥感城镇分析 / Remote Sensing Urban Analysis
卫星图像分析,城市规划优化,环境监测预警。
Satellite image analysis, urban planning optimization, environmental monitoring and early warning.
- 土地利用 / Land Use
- 环境监测 / Environmental Monitoring
- 灾害预警 / Disaster Warning
智能制造 / Smart Manufacturing
生产线优化,质量检测,预测性维护。
Production line optimization, quality inspection, predictive maintenance.
- 质量控制 / Quality Control
- 设备维护 / Equipment Maintenance
- 生产优化 / Production Optimization
网络安全 / Cybersecurity
威胁检测,异常行为分析,安全事件响应。
Threat detection, anomaly behavior analysis, security incident response.
- 入侵检测 / Intrusion Detection
- 恶意软件分析 / Malware Analysis
- 安全响应 / Security Response