Why Your Next AI Agent Should Probably Be a Manager
The Problem with Jack-of-All-Trades Agents
A single LLM agent handling a complex workflow hits a wall quickly. You give it:
- Access to 15+ API endpoints
- A 3,000-word system prompt
- Instructions for edge cases in six different domains
- Tools for everything from data validation to PDF generation
What you get back is an agent that:
- Picks the wrong tool 20% of the time
- Hallucinates when context exceeds its sweet spot
- Can't specialise deeply enough to handle domain-specific nuance
- Becomes exponentially harder to debug as complexity grows
Sound familiar? It's the same reason we stopped building monoliths and started building microservices.
Enter the Supervisor Pattern
The supervisor and sub-agents pattern flips the model. Your supervisor agent doesn't do the work-it routes it. Here's a simplified flow:
# Pseudocode: Supervisor agent receives a task
task = "Analyse this customer complaint and update their support ticket"
# Supervisor decomposes and delegates
supervisor.analyse(task)
# Output: [
# {"agent": "sentiment_analyser", "input": complaint_text},
# {"agent": "crm_updater", "input": ticket_id, "sentiment": result}
# ]
# Each specialist does one thing well
sentiment = sentiment_agent.run(complaint_text)
crm_agent.update(ticket_id, sentiment)
The supervisor's job is orchestration, not execution. It:
- Breaks down the user's request into subtasks
- Determines which specialist agent handles each subtask
- Passes context between agents
- Aggregates results and responds
Each sub-agent has:
- A narrow, well-defined role
- A smaller, focused system prompt
- Only the tools it actually needs
- Higher accuracy within its domain
Why This Works (and Why It's Familiar)
If you've built distributed systems, this should feel natural. It's the same principles:
- Single Responsibility Principle: Each agent does one thing well
- Loose Coupling: Agents don't need to know about each other
- Bounded Context: Clear domain boundaries reduce complexity
- Graceful Degradation: One agent failing doesn't tank the whole system
You wouldn't build a microservice that handles payments, inventory, and email notifications. Don't build agents that way either.
Dynamic Spawning: The Next Level
Static sub-agent pools work, but the real power comes when your supervisor can spawn agents dynamically. Frameworks like LangGraph, AutoGen, and CrewAI support this. Imagine your supervisor encounters a task it's never seen:
# Task: "Translate this legal document to French and summarise it"
# Supervisor spawns specialists on-the-fly:
supervisor.spawn_agent(
role="legal_translator",
tools=["translation_api"],
context="French legal terminology, formal tone"
)
supervisor.spawn_agent(
role="document_summariser",
tools=["text_analysis"],
context="Legal summary, bullet points, max 200 words"
)
No need to pre-define every possible agent. The supervisor adapts to the task.
The Gotchas (Because There Always Are)
Routing errors are your biggest risk. If the supervisor sends a task to the wrong specialist, you're worse off than with a generalist. Mitigation strategies:
- Use structured outputs (JSON, Pydantic models) for routing decisions
- Log every delegation decision for debugging
- Implement confidence scores-if the supervisor isn't sure, escalate to a human
- Test routing logic obsessively
Token costs add up. Multiple agents mean multiple LLM calls. Profile your usage and optimise:
- Use smaller models for specialist tasks
- Cache common decompositions
- Consider local models for low-stakes subtasks
Observability is critical. Distributed agent systems are harder to debug than single agents. Invest in:
- Tracing (OpenTelemetry, LangSmith)
- Structured logging with request IDs
- Dashboards showing agent performance and routing patterns
Should You Build This?
If your agent workflow has:
- Multiple distinct domains (e.g., data retrieval + analysis + reporting)
- More than 8โ10 tools
- Frequent routing mistakes
- Growing system prompts that feel unwieldy
...then yes, try the supervisor pattern. If you're building a simple chatbot or single-purpose assistant, stick with one agent. Don't over-engineer.
Where to Start
Pick one complex agent workflow you've already built. Identify two or three distinct subtasks. Refactor into a supervisor + two specialists. Measure accuracy and token usage before and after. You'll know quickly if it's the right pattern for your use case.
For teams working on AI automation and software development at scale, this pattern is increasingly becoming the default. It's not about replacing single agents-it's about knowing when orchestration beats execution. Now go build something modular.
Comments
No comments yet. Start the discussion.