技能标识:skill-orchestra
Skill-aware agent routing with explicit competence/cost modeling. +22.5% accuracy, 700x cheaper than RL routers. Based on arXiv:2602.19672.
v2.0.0 增强功能: 新增路由缓存、模式学习与预测路由
一个基于细粒度技能需求与显式性能-成本权衡的智能体路由框架。
┌─────────────────────────────────────────────────────────────┐
│ SKILLOrCHESTRA │
├─────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ 技能手册 │───▶│ 智能体档案 │───▶│ 路由决策 │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ 上下文映射 每项技能的能力+成本 性能-成本权衡 │
│ 至技能需求 │
│ │
└─────────────────────────────────────────────────────────────┘
| 指标 | SkillOrchestra | 强化学习路由器 |
|---|---|---|
| 准确率 | +22.5% | 基线 |
| 学习成本 |
将上下文映射到带有需求分数的技能。
powershell
function Invoke-SkillDemandInference {
param(
[string]$Context,
[hashtable]$SkillHandbook
)
$skills = @()
# 模式匹配用于技能识别
foreach ($pattern in $SkillHandbook.Patterns) {
if ($Context -match $pattern.Regex) {
$skills += @{
Name = $pattern.Skill
Demand = $pattern.Weight
}
}
}
return $skills
}
追踪每个智能体每项技能的能力和成本。
powershell
class AgentProfile {
[string]$Name
[hashtable]$Competence # 技能 -> 分数 (0-1)
[hashtable]$Cost # 技能 -> 成本 (代币/美元)
[float]$BaseCost
[float]GetScore([string[]]$RequiredSkills, [float[]]$Demands) {
$competence = 0
$cost = 0
for ($i = 0; $i -lt $RequiredSkills.Count; $i++) {
$skill = $RequiredSkills[$i]
$demand = $Demands[$i]
$competence += $demand * $this.Competence[$skill]
$cost += $demand * $this.Cost[$skill]
}
return $competence / ($cost + 0.001) # 性能-成本比率
}
}
选择最大化性能/成本比率的智能体。
powershell
function Select-OptimalAgent {
param(
[AgentProfile[]]$Agents,
[hashtable[]]$RequiredSkills,
[float]$MaxSameAgentRatio = 0.7
)
$skillNames = $RequiredSkills.Name
$skillDemands = $RequiredSkills.Demand
# 为每个智能体评分
$scores = @{}
foreach ($agent in $Agents) {
$scores[$agent.Name] = $agent.GetScore($skillNames, $skillDemands)
}
# 获取最佳智能体
$best = $scores.GetEnumerator() | Sort-Object Value -Descending | Select-Object -First 1
# 检查路由崩溃(如果追踪历史)
if (Test-RoutingCollapse -Agent $best.Key -Ratio $MaxSameAgentRatio) {
# 返回次优智能体
$secondBest = $scores.GetEnumerator() | Sort-Object Value -Descending | Select-Object -Skip 1 -First 1
return $secondBest.Key
}
return $best.Key
}
powershell
$Global:SkillHandbook = @{
Patterns = @(
@{ Skill = 推理; Regex = 分析|决定|评估|比较; Weight = 1.0 },
@{ Skill = 编码; Regex = 代码|函数|实现|调试; Weight = 1.0 },
@{ Skill = 研究; Regex = 研究|查找|搜索|调查; Weight = 0.8 },
@{ Skill = 写作; Regex = 撰写|创作|起草|生成内容; Weight = 0.9 },
@{ Skill = 数学; Regex = 计算|运算|求解|方程; Weight = 1.0 },
@{ Skill = 创意; Regex = 创意|想象|头脑风暴|构思; Weight = 0.7 }
)
}
powershell
$Global:AgentProfiles = @(
[AgentProfile]@{
Name = GLM-4
Competence = @{
推理 = 0.85
编码 = 0.80
研究 = 0.75
写作 = 0.85
数学 = 0.80
创意 = 0.75
}
Cost = @{
推理 = 1.0
编码 = 1.0
研究 = 1.0
写作 = 1.0
数学 = 1.0
创意 = 1.0
}
BaseCost = 0.001 # 美元/1K 代币
},
[AgentProfile]@{
Name = GLM-5
Competence = @{
推理 = 0.95
编码 = 0.92
研究 = 0.88
写作 = 0.90
数学 = 0.93
创意 = 0.85
}
Cost = @{
推理 = 2.0
编码 = 2.0
研究 = 2.0
写作 = 2.0
数学 = 2.0
创意 = 2.0
}
BaseCost = 0.002 # 美元/1K 代币
}
)
powershell
$Global:RoutingHistory = [System.Collections.Queue]::new(100)
function Test-RoutingCollapse {
param(
[string]$Agent,
[float]$Ratio = 0.7
)
if ($Global:RoutingHistory.Count -lt 10) {
return $false
}
$recent = $Global:RoutingHistory | Select-Object -Last 10
$sameCount = ($recent | Where-Object { $_ -eq $Agent }).Count
return ($sameCount / 10) -gt $Ratio
}
function Register-RoutingDecision {
param([string]$Agent)
if ($Global:RoutingHistory.Count -ge 100) {
$Global:RoutingHistory.Dequeue()
}
$Global:RoutingHistory.Enqueue($Agent)
}
powershell
Write-Host 选中的智能体: $agent
SkillOrchestra 可以增强现有的模型路由器技能:
powershell
function Route-Request {
param([string]$Context)
# 使用 SkillOrchestra 进行智能路由
$skills = Invoke-SkillDemandInference -Context $Context
$agent = Select-OptimalAgent -Agents $Global:AgentProfiles -RequiredSkills $skills
# 注册以预防崩溃
Register-RoutingDecision -Agent $agent
return $agent
}
arXiv:2602.19672 - Skill
以下为平台配置的接入选项,并非逐项实测通过。能否安装取决于客户端支持、技能来源和运行环境:
帮我安装 SkillHub 和 skill-orchestra-1776292485 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 skill-orchestra-1776292485 技能
skillhub install skill-orchestra-1776292485
文件大小: 9.22 KB | 发布时间: 2026-4-16 15:40