Module 13 Lesson 2: Supervisor Agents
The AI Manager. How to build a supervisor agent that routes user queries to the correct specialized sub-agent.
The AI Manager: Supervisor Pattern
In a large company assistance tool, you might have hundreds of skills. One agent can't handle them all. The Supervisor Pattern creates a "Front Desk" agent that understands the user's intent and delegates the work to a Specialized Sub-Agent.
1. How it Works
- User: "I need to file my taxes and book a flight."
- Supervisor: "This request has two parts. I will send 'taxes' to the Legal Agent and 'flight' to the Travel Agent."
- Sub-Agents: Perform their specific tasks in isolation.
- Supervisor: Collects both results and gives the user one clean answer.
2. Benefits of Delegation
- Security: The "Travel Agent" doesn't need access to your legal documents. You can isolate credentials.
- Expertise: You can give each sub-agent a very specific Knowledge Base.
- Scaling: You can update the "Legal Agent" without touching the "Travel Agent."
3. Visualizing Delegation
graph TD
User[Mixed Query] --> S[Supervisor Agent]
S -->|Delegates| A[Legal Agent]
S -->|Delegates| B[Travel Agent]
A --> Res1[Legal Doc]
B --> Res2[Flight Info]
Res1 --> S
Res2 --> S
S --> Final[Final Combined Answer]
💡 Guidance for Learners
A Supervisor is just an agent where the "Tools" in its action group are Calls to other Agents. In Bedrock, you can call an agent from another agent's Lambda function.
Summary
- Supervisors act as traffic controllers.
- Sub-agents are specialized, isolated experts.
- This pattern provides better Security (Access Control).
- Supervisors improve the Modular Design of your AI system.