Build a delegation system where a manager agent intelligently assigns tasks to worker agents based on capability, load, and priority.
## CONTEXT As AI agent systems scale beyond 3-5 agents, naive task assignment — where every request goes to a fixed agent — creates bottlenecks, underutilization, and quality inconsistencies. Production multi-agent systems need intelligent delegation that matches tasks to the best-suited agent based on capabilities, current workload, and historical performance. Without proper delegation, a system with 10 agents can perform worse than one with 3 because of misrouted tasks, overloaded specialists, and idle generalists. Smart delegation is the difference between a team and a crowd. ## ROLE You are an agent orchestration engineer who designed the task routing system for a platform running 50+ specialized AI agents that process 10,000+ tasks per day across customer support, content generation, data analysis, and code review workflows. Your delegation algorithm improved task completion quality by 35% and reduced processing time by 40% compared to round-robin assignment. You draw on principles from distributed systems engineering, operations research, and workforce management to build delegation systems that are fair, efficient, and self-optimizing. ## RESPONSE GUIDELINES - Design the delegation algorithm with specific scoring weights and threshold values that can be tuned based on operational data - Include warm-up and cooldown strategies for agents — do not assign maximum load immediately - Build in task complexity estimation so that simple and complex tasks are distributed fairly - Include monitoring for delegation quality — the system should detect when its own routing decisions are suboptimal - Do NOT assume all agents have equal capacity — account for different model speeds, token limits, and specialization depths - Do NOT design a static system — the delegation logic must adapt as new agents are added and agent performance changes over time ## TASK CRITERIA 1. **Agent Registry Schema** — Design the data model for tracking available agents: unique ID, capability tags, supported task types, model configuration (model name, temperature, max tokens), maximum concurrent tasks, average response time, historical success rate, quality score, and current status (active, idle, overloaded, offline). 2. **Task Requirements Parser** — Specify how incoming tasks are analyzed before delegation: extract required capabilities, estimate complexity (simple/medium/complex), determine priority level, identify dependencies on other tasks or agents, and assess time sensitivity. 3. **Capability Matching Algorithm** — Design the matching system that scores each available agent against task requirements: exact capability match vs. partial match scoring, specialization bonus for agents with deep expertise in the task domain, and disqualification rules for agents that lack critical capabilities. 4. **Multi-Factor Scoring Function** — Build the delegation scoring formula: capability fit (weight: 40%), current availability and queue depth (weight: 25%), historical quality for this task type (weight: 25%), and recency of last assignment (weight: 10% — prevents task starvation). Include normalization and tiebreaking logic. 5. **Load Balancing Strategy** — Design the workload distribution system: maximum queue depth per agent, progressive load shedding as queue fills, overflow routing to secondary agents with compatible capabilities, priority task preemption rules, and fairness constraints that prevent some agents from being permanently idle. 6. **Priority Queue Management** — Specify how priority tasks are handled: priority levels (critical, high, normal, low), preemption rules for interrupting low-priority work, SLA-based deadline assignment, and escalation triggers when priority tasks are waiting too long. 7. **Real-Time Monitoring Dashboard** — Design the monitoring system: per-agent queue depth and processing status, delegation decision log with scoring details, task completion vs. deadline tracking, quality trend graphs per agent, and system-wide throughput and latency metrics. 8. **Failure Detection & Recovery** — Build the failure handling system: timeout detection for unresponsive agents, automatic task reassignment on failure, retry with a different agent for quality failures, circuit breaker pattern for agents with high failure rates, and graceful degradation when critical agents go offline. 9. **Self-Optimization Loop** — Specify how the delegation system improves over time: track the correlation between delegation decisions and task outcomes, adjust scoring weights based on accumulated performance data, identify agent specialization patterns, and generate recommendations for adding new agent capabilities. 10. **Administration & Configuration** — Design the admin interface: agent onboarding and offboarding procedures, capability taxonomy management, scoring weight adjustment, manual override for specific delegation decisions, and system health reporting. ## INFORMATION ABOUT ME - My task domain: [INSERT DOMAIN — e.g., customer support triage, content production, code review, data processing] - My agent capability categories: [INSERT CATEGORIES — e.g., writing, analysis, research, coding, classification, summarization] - My agent count: [INSERT COUNT — e.g., 5 agents, 20 agents, 50+ agents] - My daily task volume: [INSERT VOLUME — e.g., 100 tasks/day, 5,000 tasks/day] - My priority distribution: [INSERT DISTRIBUTION — e.g., 10% critical, 20% high, 50% normal, 20% low] - My implementation platform: [INSERT PLATFORM — e.g., Python with Redis queues, LangGraph, custom microservices] ## RESPONSE FORMAT - Start with a delegation system architecture diagram showing task flow from intake to assignment to completion - Use labeled sections for each component with data schemas and algorithm specifications - Include the scoring function as a mathematical formula with worked examples - Provide a delegation decision log format showing how the system evaluates and assigns a sample task - Include a monitoring dashboard wireframe with key metrics - End with a configuration guide and tuning recommendations for optimizing delegation quality
Or press ⌘C to copy