worker-integration
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWorker-Agent Integration Skill
Worker-Agent集成技能
Intelligent coordination between background workers and specialized agents.
实现后台工作进程与专用Agent之间的智能协调。
Quick Start
快速开始
bash
undefinedbash
undefinedView agent recommendations for a trigger
查看触发器对应的Agent推荐
npx agentic-flow workers agents ultralearn
npx agentic-flow workers agents optimize
npx agentic-flow workers agents ultralearn
npx agentic-flow workers agents optimize
View performance metrics
查看性能指标
npx agentic-flow workers metrics
npx agentic-flow workers metrics
View integration stats
查看集成统计信息
npx agentic-flow workers stats --integration
undefinednpx agentic-flow workers stats --integration
undefinedAgent Mappings
Agent映射关系
Workers automatically dispatch to optimal agents based on trigger type:
| Trigger | Primary Agents | Fallback | Pipeline Phases |
|---|---|---|---|
| researcher, coder | planner | discovery → patterns → vectorization → summary |
| performance-analyzer, coder | researcher | static-analysis → performance → patterns |
| security-analyst, tester | reviewer | security → secrets → vulnerability-scan |
| performance-analyzer | coder, tester | performance → metrics → report |
| tester | coder | discovery → coverage → gaps |
| documenter, researcher | coder | api-discovery → patterns → indexing |
| researcher, security-analyst | coder | call-graph → deps → trace |
| coder, reviewer | researcher | complexity → smells → patterns |
工作进程会根据触发器类型自动调度至最优Agent:
| 触发器 | 首选Agent | 备选Agent | 流水线阶段 |
|---|---|---|---|
| researcher, coder | planner | discovery → patterns → vectorization → summary |
| performance-analyzer, coder | researcher | static-analysis → performance → patterns |
| security-analyst, tester | reviewer | security → secrets → vulnerability-scan |
| performance-analyzer | coder, tester | performance → metrics → report |
| tester | coder | discovery → coverage → gaps |
| documenter, researcher | coder | api-discovery → patterns → indexing |
| researcher, security-analyst | coder | call-graph → deps → trace |
| coder, reviewer | researcher | complexity → smells → patterns |
Performance-Based Selection
基于性能的Agent选择
The system learns from execution history to improve agent selection:
typescript
// Agent selection considers:
// 1. Quality score (0-1)
// 2. Success rate
// 3. Average latency
// 4. Execution count
const { agent, confidence, reasoning } = selectBestAgent('optimize');
// agent: "performance-analyzer"
// confidence: 0.87
// reasoning: "Selected based on 45 executions with 94.2% success"系统会从执行历史中学习,优化Agent选择机制:
typescript
// Agent选择会考虑以下因素:
// 1. 质量评分(0-1)
// 2. 成功率
// 3. 平均延迟
// 4. 执行次数
const { agent, confidence, reasoning } = selectBestAgent('optimize');
// agent: "performance-analyzer"
// confidence: 0.87
// reasoning: "Selected based on 45 executions with 94.2% success"Memory Key Patterns
内存存储关键模式
Workers store results using consistent patterns:
{trigger}/{topic}/{phase}
Examples:
- ultralearn$auth-module$analysis
- optimize$database$performance
- audit$payment$vulnerabilities
- benchmark$api$metrics工作进程采用统一模式存储结果:
{trigger}/{topic}/{phase}
示例:
- ultralearn$auth-module$analysis
- optimize$database$performance
- audit$payment$vulnerabilities
- benchmark$api$metricsBenchmark Thresholds
性能基准阈值
Agents are monitored against performance thresholds:
json
{
"researcher": {
"p95_latency": "<500ms",
"memory_mb": "<256MB"
},
"coder": {
"p95_latency": "<300ms",
"quality_score": ">0.85"
},
"security-analyst": {
"scan_coverage": ">95%",
"p95_latency": "<1000ms"
}
}系统会根据性能基准阈值监控Agent:
json
{
"researcher": {
"p95_latency": "<500ms",
"memory_mb": "<256MB"
},
"coder": {
"p95_latency": "<300ms",
"quality_score": ">0.85"
},
"security-analyst": {
"scan_coverage": ">95%",
"p95_latency": "<1000ms"
}
}Feedback Loop
反馈循环机制
Workers provide feedback for continuous improvement:
typescript
import { workerAgentIntegration } from 'agentic-flow$workers$worker-agent-integration';
// Record execution feedback
workerAgentIntegration.recordFeedback(
'optimize', // trigger
'coder', // agent
true, // success
245, // latency ms
0.92 // quality score
);
// Check compliance
const { compliant, violations } = workerAgentIntegration.checkBenchmarkCompliance('coder');工作进程会提供反馈以实现持续优化:
typescript
import { workerAgentIntegration } from 'agentic-flow$workers$worker-agent-integration';
// 记录执行反馈
workerAgentIntegration.recordFeedback(
'optimize', // 触发器
'coder', // Agent
true, // 是否成功
245, // 延迟(毫秒)
0.92 // 质量评分
);
// 检查合规性
const { compliant, violations } = workerAgentIntegration.checkBenchmarkCompliance('coder');Integration Statistics
集成统计信息
bash
$ npx agentic-flow workers stats --integration
Worker-Agent Integration Stats
══════════════════════════════
Total Agents: 6
Tracked Agents: 4
Total Feedback: 156
Avg Quality Score: 0.89
Model Cache Stats
─────────────────
Hits: 1,234
Misses: 45
Hit Rate: 96.5%bash
$ npx agentic-flow workers stats --integration
Worker-Agent Integration Stats
══════════════════════════════
Total Agents: 6
Tracked Agents: 4
Total Feedback: 156
Avg Quality Score: 0.89
Model Cache Stats
─────────────────
Hits: 1,234
Misses: 45
Hit Rate: 96.5%Configuration
配置说明
Enable integration features in :
.claude$settings.jsonjson
{
"workers": {
"enabled": true,
"parallel": true,
"memoryDepositEnabled": true,
"agentMappings": {
"ultralearn": ["researcher", "coder"],
"optimize": ["performance-analyzer", "coder"]
}
}
}在中启用集成功能:
.claude$settings.jsonjson
{
"workers": {
"enabled": true,
"parallel": true,
"memoryDepositEnabled": true,
"agentMappings": {
"ultralearn": ["researcher", "coder"],
"optimize": ["performance-analyzer", "coder"]
}
}
}