task-distributor

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Task Distributor

任务分配器

Purpose

用途

Provides expertise in distributing tasks across multi-agent systems efficiently. Specializes in load balancing algorithms, capability-based routing, cost optimization, and ensuring optimal resource utilization across distributed agent pools.
提供多Agent系统任务高效分配的专业能力,专注于负载均衡算法、基于能力的路由、成本优化,以及确保分布式Agent池的资源最优利用。

When to Use

适用场景

  • Designing task distribution strategies for multi-agent systems
  • Implementing load balancing across worker pools
  • Optimizing for cost (token economics) vs speed trade-offs
  • Building routing logic based on agent capabilities
  • Managing task queues with priorities and deadlines
  • Implementing retry and failover strategies
  • Scaling agent pools dynamically based on demand
  • Monitoring and optimizing task throughput
  • 为多Agent系统设计任务分配策略
  • 在工作者池中实现负载均衡
  • 优化成本(Token Economics)与速度的权衡
  • 构建基于Agent能力的路由逻辑
  • 管理带优先级和截止期限的任务队列
  • 实现重试与故障转移策略
  • 根据需求动态扩展Agent池
  • 监控并优化任务吞吐量

Quick Start

快速开始

Invoke this skill when:
  • Designing task distribution strategies for multi-agent systems
  • Implementing load balancing across worker pools
  • Optimizing for cost (token economics) vs speed trade-offs
  • Building routing logic based on agent capabilities
  • Managing task queues with priorities and deadlines
Do NOT invoke when:
  • Designing overall agent architecture → use agent-organizer
  • Implementing individual agent logic → use appropriate domain skill
  • Handling agent errors and recovery → use error-coordinator
  • Building workflow orchestration → use workflow-orchestrator
在以下场景调用此技能:
  • 为多Agent系统设计任务分配策略
  • 在工作者池中实现负载均衡
  • 优化成本(Token Economics)与速度的权衡
  • 构建基于Agent能力的路由逻辑
  • 管理带优先级和截止期限的任务队列
请勿在以下场景调用:
  • 设计整体Agent架构 → 使用agent-organizer
  • 实现单个Agent逻辑 → 使用对应领域技能
  • 处理Agent错误与恢复 → 使用error-coordinator
  • 构建工作流编排 → 使用workflow-orchestrator

Decision Framework

决策框架

Distribution Strategy?
├── Uniform Workloads → Round-robin or random distribution
├── Variable Task Complexity → Weighted distribution by capability
├── Cost Sensitive → Route to cheapest capable agent
├── Latency Sensitive → Route to fastest/nearest agent
├── Specialized Tasks → Capability-based routing
└── Burst Traffic → Dynamic scaling + queue management
分配策略?
├── 均匀工作负载 → 轮询或随机分配
├── 可变任务复杂度 → 基于能力的加权分配
├── 成本敏感型 → 路由至成本最低的合格Agent
├── 延迟敏感型 → 路由至最快/最近的Agent
├── 专业化任务 → 基于能力的路由
└── 突发流量 → 动态扩展 + 队列管理

Core Workflows

核心工作流

1. Capability-Based Routing

1. 基于能力的路由

  1. Define capability taxonomy for agents
  2. Tag tasks with required capabilities
  3. Implement capability matching algorithm
  4. Score agents by capability fit and availability
  5. Route to best-matched agent
  6. Track capability utilization for optimization
  7. Adjust routing weights based on performance
  1. 定义Agent的能力分类体系
  2. 为任务标记所需能力
  3. 实现能力匹配算法
  4. 根据能力适配度和可用性为Agent评分
  5. 路由至最佳匹配的Agent
  6. 跟踪能力利用率以优化
  7. 根据性能调整路由权重

2. Cost-Optimized Distribution

2. 成本优化分配

  1. Define cost model per agent type (tokens, time, money)
  2. Estimate task cost based on complexity signals
  3. Set budget constraints and optimization targets
  4. Route to minimize cost while meeting SLAs
  5. Implement fallback to higher-cost agents when needed
  6. Track actual vs estimated costs
  7. Refine cost models from historical data
  1. 定义每种Agent类型的成本模型(代币、时间、资金)
  2. 根据复杂度信号估算任务成本
  3. 设置预算约束和优化目标
  4. 在满足SLA的前提下最小化成本
  5. 必要时实现向更高成本Agent的降级方案
  6. 跟踪实际成本与估算成本的差异
  7. 根据历史数据优化成本模型

3. Queue Management with Priorities

3. 带优先级的队列管理

  1. Define priority levels and SLA requirements
  2. Implement priority queue with deadline awareness
  3. Set up work stealing for idle agents
  4. Handle starvation of low-priority tasks
  5. Implement backpressure when queue depth exceeds threshold
  6. Monitor queue latency and throughput
  7. Scale agent pool based on queue metrics
  1. 定义优先级等级和SLA要求
  2. 实现支持截止期限感知的优先级队列
  3. 为空闲Agent设置任务窃取机制
  4. 处理低优先级任务的饥饿问题
  5. 当队列深度超过阈值时实现背压机制
  6. 监控队列延迟和吞吐量
  7. 根据队列指标扩展Agent池

Best Practices

最佳实践

  • Implement health checks and remove unhealthy agents from pool
  • Use exponential backoff with jitter for retries
  • Track per-agent metrics for informed routing decisions
  • Implement circuit breakers for failing agent types
  • Design for graceful degradation under load
  • Make routing decisions observable for debugging
  • 实现健康检查,将不健康的Agent从池中移除
  • 重试时使用带抖动的指数退避策略
  • 跟踪每个Agent的指标以辅助路由决策
  • 为故障Agent类型实现断路器
  • 设计负载下的优雅降级机制
  • 使路由决策可观测以便调试

Anti-Patterns

反模式

  • Static assignment → Use dynamic routing based on current state
  • Ignoring agent health → Remove unhealthy agents from rotation
  • FIFO only → Implement priority awareness for SLA compliance
  • Tight coupling → Decouple task producers from agent pool
  • No backpressure → Implement admission control under overload
  • 静态分配 → 基于当前状态使用动态路由
  • 忽略Agent健康 → 将不健康的Agent从轮换中移除
  • 仅使用FIFO → 实现优先级感知以符合SLA
  • 紧耦合 → 解耦任务生产者与Agent池
  • 无背压机制 → 在过载时实现准入控制