BossAgents · GOAI新智基座赛道 部署与运行指南
环境要求
- Node.js >= 18(推荐 20 LTS)
- npm >= 9
- 操作系统:Linux / macOS / Windows 10+
- 内存:>= 512MB(SQLite 加载 13000+ 对象模型)
- 网络访问(LLM API端点)
- 端口 3006 可用
快速启动
# 1. 安装依赖
npm install
# 2. 配置环境变量
# .env 已预配置,无需修改
# 如需自定义LLM,参考以下配置:
# LLM_ENDPOINT=https://api.sensenova.com/v1/chat/completions
# LLM_API_KEY=your_api_key_here
# LLM_MODEL=deepseek-v4-flash
# LLM_TIMEOUT=120000
# PORT=3006
# 3. 启动服务器
node server.js
# 4. 验证
curl https://ylxt.chat/api/health
# 预期: {"status":"ok",...}
演示验证
1. 查看可用岗位
curl https://ylxt.chat/api/goai-demo/positions
预期返回3个岗位:POS-GOAI / POS-PROCURE-CHAIN / POS-INSPECT-LOOP
2. 场景一:车间复合指令
curl -X POST https://ylxt.chat/api/goai-demo/collaboration/goai \
-H "Content-Type: application/json" \
-d '{"instruction":"3号泵备件库存不足,当前仅剩2件安全库存10件,同时3号离心泵保养即将到期需要安排定期保养"}'
预期:3个Agent串行执行,约18.4秒完成(实测)
3. 场景二:采购闭环
curl -X POST https://ylxt.chat/api/goai-demo/collaboration/procure \
-H "Content-Type: application/json" \
-d '{"instruction":"采购伺服电机SM-750A 50台,预算90万,15天内到货"}'
预期:4个Agent串行执行,约22.1秒完成(实测)
4. 场景三:巡检修复闭环
curl -X POST https://ylxt.chat/api/goai-demo/collaboration/inspect \
-H "Content-Type: application/json" \
-d '{"instruction":"检查Part数据质量,发现并修复问题"}'
预期:3个Agent串行执行,约12.5秒完成(实测)
5. Agent接口验证
# 任务分发
curl -X POST https://ylxt.chat/api/agents/dispatch \
-H "Content-Type: application/json" \
-d '{"customer_id":"test","task":"查询库存","agent_card":{"agent_id":"test-001","name":"TestAgent","capabilities":["test"],"endpoint":"https://test.com"}}'
# 结果回传(替换trace_id)
curl -X POST https://ylxt.chat/api/agents/callback \
-H "Content-Type: application/json" \
-d '{"trace_id":"替换为上一步返回的trace_id","agent_id":"test-001","result":{"ok":true},"span":1}'
# 审计查询(替换trace_id)
curl https://ylxt.chat/api/agents/audit/替换为trace_id
6. 审计日志查询
curl https://ylxt.chat/api/goai-demo/audit-logs
7. 开放平台验证
# 申请API Key
curl -X POST https://ylxt.chat/api/open/keys \
-H "Content-Type: application/json" \
-d '{"customer_id":"test","name":"测试Key","plan":"free"}'
# 带Key查询71个数字员工
curl https://ylxt.chat/api/digital-staff/list \
-H "X-API-Key: ba_demo_key_00000000_00000000_00000000"
# 带Key触发员工执行
curl -X POST https://ylxt.chat/api/digital-staff/run \
-H "X-API-Key: ba_demo_key_00000000_00000000_00000000" \
-H "Content-Type: application/json" \
-d '{"staffId":"DS-SYS-001","intent":"","parameters":{},"skip_mtclaw":true}'
# 在线API文档(浏览器打开)
# https://ylxt.chat/api/open/docs
# OpenAPI 3.0规范
curl https://ylxt.chat/api/open/spec
# 查询调用统计
curl "https://ylxt.chat/api/open/usage?days=7" \
-H "X-API-Key: ba_demo_key_00000000_00000000_00000000"
8. 跨岗位编队验证
# 发起编队(需人工审批)
curl -X POST https://ylxt.chat/api/digital-staff/taskforce/adhoc \
-H "Content-Type: application/json" \
-d '{"title":"采购-成本-质量闭环","members":["DS-PROC-001","DS-COST-001","DS-VEN-001"],"sharedBlackboard":{"partNo":"P-1001","qty":50},"requireHumanApproval":true}'
# 查询待审批编队
curl https://ylxt.chat/api/digital-staff/taskforce/pending
# 事件总线触发器
curl https://ylxt.chat/api/digital-staff/event/triggers
故障排查
| 问题 | 原因 | 解决 |
|------|------|------|
| 服务器无法启动 | 端口占用 | netstat -ano | findstr 3006 找到占用进程并终止 |
| LLM超时 | 网络问题 | 检查.env中LLM端点可达性 |
| Agent返回空 | DB中worker字段为空 | 重启服务器(YAML→DB自动同步) |
| 审计日志无trace_id | 旧表无此列 | 重启后自动ALTER TABLE添加 |
文件结构
server/
├── server.js # 主入口
├── boss-scheduler/
│ ├── position-runtime.js # 岗位编排引擎
│ ├── lite-scheduler.js # 调度器(含WORKERS注册表)
│ ├── workers/
│ │ ├── goai-agent-worker.js # GOAI+巡检闭环Worker
│ │ └── procurement-chain-worker.js # 采购闭环Worker
│ └── profiles/local.yaml # 岗位+员工YAML定义
├── routes/goai-demo.js # GOAI Demo路由+Agent接口
├── utils/audit-logger.js # 审计引擎(trace_id/span)
└── data/
├── digital-staff-config.json # 数字员工配置
└── boss_analytics.db # 审计日志数据库
BossAgents