Digital Employee Capability Routing Implementation Plan

Digital Employee Capability Routing Implementation Plan

Core Concept

Do not modify worker scripts, avoid hardcoding, fully utilize configuration via CapabilityRuntime

The current LiteScheduler already supports 5 execution paths:

| Path | Condition | Description |

|---|---|---|

| Path 0 | staff.pipeline | Multi-step capability chain, sequential execution of identify→compare→create |

| Path 1 | staff.worker | Hardcoded worker script (current mainstay, should be phased out gradually) |

| Path 2 | staff.capability | Single capability routing, automatically calls CapabilityRuntime |

| Path 3 | No worker/No capability | General processing |

All new employees should use Path 0/2, without writing worker scripts.


Implementation 1: DS-CRM-001 Customer Steward (30 minutes)

Configuration

- id: DS-CRM-001
  name: 小智-客户管家
  title: 客户关系管家
  description: 自动查询 SCSAI Customer/Sales Order,生成客户健康报告
  avatar: "?"
  level: 高级
  department: 销售部
  enabled: true
  cron: "0 8 * * 1-5"       # 工作日早8点
  worker: ""                  # 不走 worker 脚本
  capability: identify        # 路径 2 → CapabilityRuntime.identify
  llm: true
  item_types: [Customer, Part, Project]
  keywords: ["客户", "订单", "交付", "应收", "投诉", "customer", "order"]
  params:
    report_to: ["feishu", "email"]
    analyze_fields: ["name", "email", "phone", "orders"]

执行流

cron 触发 → _runWorker 路径2
  → CapabilityRuntime.identify({
      item_type: 'Customer',
      data: { analyze: true }
    })
  → SCSAI AML 查询 Customer
  → LLM 生成客户健康报告
  → 结果返回 LiteScheduler
  → 飞书推送

涉及改动

  • local.yaml:新增 YAML 块(20 行)
  • 不需要改任何 JavaScript 代码

实施 2:DS-BIZ-001 经营日报(1 小时)

配置

- id: DS-BIZ-001
  name: 小智-经营日报
  title: 经营日报生成器
  description: 每天早7点采集销售/采购/库存数据,生成经营简报推送飞书
  avatar: "?"
  level: 高级
  department: 管理层
  enabled: true
  cron: "0 7 * * 1-5"
  worker: ""
  capability: generate
  llm: true
  item_types: [Part, Vendor, Project, Customer]
  keywords: ["经营", "日报", "利润", "分析", "报告", "business", "daily"]
  params:
    reportType: daily_brief
    channels: ["feishu", "email"]

执行流

cron → 路径2 generate
  → CapabilityRuntime.generate({
      report_type: 'daily_brief',
      item_types: [Part, Vendor, Customer]
    })
  → LLM 汇总昨日数据 → 生成自然语言日报
  → LiteScheduler 接收结果
  → feishu-bot.pushMessage() 推飞书
  → sendEmail() 发邮件

涉及改动

  • local.yaml:新增 YAML 块(20 行)
  • 不需要改任何 JavaScript 代码

实施 3:DS-SCM-001 供应智囊(1 小时)

配置(pipeline 路径 0)

- id: DS-SCM-001
  name: 小智-供应智囊
  title: 供应链智能体
  description: 端到端供应链管理:供应商识别→比价→生成采购单
  avatar: "?"
  level: 高级
  department: 采购部
  enabled: true
  cron: ""
  worker: ""
  pipeline:
    - capability: identify
      item_types: [Vendor]
      params:
        product: "伺服电机"
        maxResults: 5
    - capability: compare
      item_types: [Vendor]
      params:
        criteria: price
        topN: 1
    - capability: create
      item_types: [PurchaseOrder]
      params:
        autoApprove: false
  llm: true
  item_types: [Vendor, Part, BOM, Manufacturer]
  params:
    product: "伺服电机"
    quantity: 10
    budget: 90000
  keywords: ["采购", "供应商", "询价", "比价", "PO"]

执行流

手动触发 → 路径0 pipeline
  → Step1: CapabilityRuntime.identify(Vendor, {product})
    → SCSAI 查询供应商
    → 返回候选供应商列表
  → Step2: CapabilityRuntime.compare(Vendor, {candidates})
    → LLM 比价分析
    → 返回推荐供应商
  → Step3: CapabilityRuntime.create(PurchaseOrder, {vendor, product, qty})
    → SCSAI 创建采购订单
    → 返回 PO 编号

涉及改动

  • local.yaml:新增 YAML 块(30 行)
  • 不需要改任何 JavaScript 代码

实施 4:DS-PROC-DATA-001 数据修复员(30 分钟)

配置

- id: DS-PROC-DATA-001
  name: 小智-数据修复员
  title: 数据自动修复员
  description: 凌晨自动检测并修复 SCSAI 数据不一致问题
  avatar: "?"
  level: 中级
  department: IT部
  enabled: true
  cron: "0 3 * * *"
  worker: ""
  capability: repair
  llm: true
  item_types: [Part, Vendor, Document, Customer]
  params:
    autoFix: true
    fixTypes: ["missing_email", "invalid_phone", "incomplete_address"]
    notifyOnFix: true

涉及改动

  • local.yaml:新增 YAML 块(20 行)
  • 不需要改任何 JavaScript 代码

实施 5:协作触发 repair/optimize/compare(1 小时)

在现有 worker 末尾加协作任务创建(总共 20 行):

Add at the end of procurement.js

// 采购完成后,触发供应智囊自动查替代料
if (result?.success && ctx.taskQueue && result.vendor) {
  ctx.taskQueue.createTask({
    title: `查${result.product}替代料`,
    description: `采购 ${result.product} ${result.quantity} 件于 ${result.vendor},检查是否有更优替代料`,
    type: 'optimize',
    priority: 'low',
    assignedTo: 'DS-SCM-001',
  });
}

vendor-review.js 评分下降加

// 低分供应商,触发数据修复
if (lowScore.length > 0 && ctx.taskQueue) {
  for (const v of lowScore) {
    ctx.taskQueue.createTask({
      title: `Repair${v.name}数据`,
      description: `供应商 ${v.name} 评分 ${v.score},数据可能不完整,需修复`,
      type: 'repair',
      assignedTo: 'DS-PROC-DATA-001',
    });
  }
}

改动汇总

| 实施 | 改动文件 | 行数 | 工期 |

|---|---|---|---|

| DS-CRM-001 | local.yaml +20 | 20 | 30 minutes |

| DS-BIZ-001 | local.yaml +20 | 20 | 1 hour |

| DS-SCM-001 | local.yaml +30 | 30 | 1 hour |

| DS-PROC-DATA-001 | local.yaml +20 | 20 | 30 minutes |

| Collaboration Trigger | procurement.js +10, vendor-review.js +10 | 20 | 1 hour |

| Total | 5 files | ~110 lines | Half a day |

Key Point: Out of the 110 lines of changes, 90 lines are YAML configuration, and only 20 lines are JavaScript.

← 返回案例列表

Try 左帮右臂 Industrial Agent — your digital workforce

Available as a WeChat mini program, web app (ylxt.chat) and desktop client. Start from whichever fits your workflow.

🌐 Web App 💻 Desktop Download 📞 Call 189-8606-6876
WeChat mini program QR
Scan for the WeChat mini program
Share:
🤖 Try Now →
🤖
🎁