Skip to content
>_<
AI EngineeringWiki

Task Delegation Pattern

Patterns Β· 5 min

The Problem

A single agent can't do everything better than specialized tools. You need a system that selects the right agent for the right task.

Architecture β€” illustration from the German article

Architecture

User Request
     |
     v
[Orchestrator Agent]
     |
     +---> [Research Agent] ----> Web Search, Docs
     |
     +---> [Coder Agent] ----> Code Generation
     |
     +---> [Review Agent] ----> PR Review, Tests
     |
     v
  Final Response

Implementation

1. Intent Classification

The Orchestrator classifies the user request and routes it to the appropriate agent.

2. Routing Matrix

const routes = {
  'code-generation': coderAgent,
  'research': researchAgent,
  'review': reviewAgent,
  'deployment': deployAgent,
  'question': qaAgent,
}

3. Priority Queue

For multiple concurrent tasks: Set priorities (1 = highest). Deadline tracking prevents tasks from waiting forever.

4. Result Aggregation

The Orchestrator collects results from all sub-agents and synthesizes a final response.

Important Aspects

  • Timeout: Each sub-agent needs a max timeout
  • Retry: Max 2x on errors
  • Fallback: What if all agents fail?
  • Cost Control: Budget limits per task

Sources

Related articles

Was this article helpful?

Continue the learning path

The learning path puts these articles in order, and the Hub carries the building blocks we have checked in our own operations.

Why AI Engineering
  • Local and self-hosted
  • Documented and verifiable
  • From our own operations
  • Made in Austria
Not legal advice.