Module 5: Multi-Agent & MCP Standards · 2h
01 · UNDERSTAND
Day 23 Theory — Orchestration Patterns: Router, Planner, Evaluator and Agents-as-Tools
Not every workflow needs the same orchestration pattern
As agent systems grow, teams sometimes reach immediately for “multi-agent.” Often a simpler pattern is enough.
Today we study several orchestration shapes and the problem each one solves.
Router
A router chooses one specialized path.
request -> router
├─ identity path
├─ billing path
└─ network path
Use it when the main problem is classification and dispatch.
Planner
A planner proposes a sequence or set of steps for a broader task.
A plan is not automatically executable truth. The runtime still validates steps and tool permissions.
Planning is useful when tasks have meaningful decomposition, but unnecessary planning can add latency and failure points.
Evaluator / critic
An evaluator examines an output and decides whether it satisfies defined criteria.
generate -> evaluate
├─ pass -> finish
└─ fail -> revise
Evaluation loops need bounded retries. Otherwise the system can repeatedly “improve” without converging.
Agents as tools
One agent can expose a bounded capability to another agent, just as ordinary functions are exposed as tools.
This is often easier to control than allowing several autonomous agents to share an open conversation.
The caller sees a clear contract and receives a result.
Choose the simplest pattern that fits
Ask:
- Is this really one decision? Use a router.
- Is the task decomposable? Consider planning.
- Do we need quality verification? Add an evaluator.
- Is a specialist capability reusable? Expose it as a tool.
Complexity should earn its place through measurable value.
Service Desk connection
Today we refactor orchestration around explicit patterns instead of treating every new capability as another giant prompt.
The principle is:
Choose orchestration from the problem shape. Multi-agent is one option, not the default destination.
02 · APPLY
Lesson Overview
This is the applied companion for Day 23. Read DAY_23_THEORY.md first for the beginner-first teaching of Orchestration Patterns: Router, Planner, Evaluator and Agents-as-Tools. Then use the real service-desk-day-23/ project to trace, run, debug, and explain the concept.
Service Desk Alignment
Day 23 adds Orchestration Patterns: Router, Planner, Evaluator and Agents-as-Tools to the running Service Desk. Start with router.py, planner.py, evaluator_optimizer.py, benchmark.py, orchestrator.py, specialist_agents.py, then follow imports and tests to identify the actual runtime path.
Why This Topic Matters
The theory chapter explains why Orchestration Patterns: Router, Planner, Evaluator and Agents-as-Tools is needed. Here the goal is evidence: identify where the capability is implemented, what observable behavior changes, and how the repository proves both success and failure behavior.
System Architecture
This is a repository surface map, not a claim that modules call each other in the displayed order. The modules are ranked by relevance to today's theory.
graph LR
T[Day 23: Orchestration Patterns - Router, Planner, Evaluator and Agents-as-Tools]
T --> M1[router.py]
T --> M2[planner.py]
T --> M3[evaluator_optimizer.py]
T --> M4[benchmark.py]
T --> M5[orchestrator.py]
T --> M6[specialist_agents.py]
T --> M7[models.py]
Follow imports and tests to discover the actual runtime flow.
Repository Implementation Map
Use the real Day 23 repository, not a fabricated sample, to connect theory to implementation.
Theory concepts to locate:
- Not every workflow needs the same orchestration pattern
- Router
- Planner
- Evaluator / critic
Most relevant implementation modules first:
service_desk/router.pyservice_desk/planner.pyservice_desk/evaluator_optimizer.pyservice_desk/benchmark.pyservice_desk/orchestrator.pyservice_desk/specialist_agents.pyservice_desk/models.py
Follow imports/calls from the relevant module and confirm behavior in tests. Record input → mechanism → observable output/state → failure evidence.
Code Walkthrough & Mechanics
Read router.py, planner.py, evaluator_optimizer.py, benchmark.py, orchestrator.py, specialist_agents.py, models.py with these theory sections beside you:
- Not every workflow needs the same orchestration pattern — locate its implementation and evidence.
- Router — locate its implementation and evidence.
- Planner — locate its implementation and evidence.
- Evaluator / critic — locate its implementation and evidence.
- Agents as tools — locate its implementation and evidence.
For each concept identify the real function/class/protocol boundary, its input/state, its observable result, and the assertion in tests/test_orchestration_patterns.py that proves the behavior. If a concept has no implementation or evidence, record that as a gap rather than inventing one.
Common Mistakes & Debugging Guidance
Use the theory—not generic timeout or .env advice—to decide what can fail today.
Failure lens: revisit Evaluator / critic, Agents as tools.
- Reproduce the smallest case that violates one of those expectations.
- Trace the real Day 23 modules until you find the first incorrect state/output/decision.
- Use
tests/test_orchestration_patterns.pyas executable evidence. - Add a regression test if the failure is not already represented.
- Fix the smallest responsible boundary and rerun the relevant test before the full suite.
Your debugging explanation must name the topic-specific invariant that failed, not merely say “an exception occurred.”
Practical Lab Instructions
- Summarize these theory ideas before opening the implementation:
- Not every workflow needs the same orchestration pattern
- Router
- Planner
- Evaluator / critic
- Inspect the most relevant real Day 23 modules first:
service_desk/router.pyservice_desk/planner.pyservice_desk/evaluator_optimizer.pyservice_desk/benchmark.pyservice_desk/orchestrator.pyservice_desk/specialist_agents.pyservice_desk/models.py
- Inspect the automated evidence:
tests/test_orchestration_patterns.py
- Establish the baseline:
cd service-desk-day-23 PYTHONPATH=. pytest tests/test_orchestration_patterns.py -q - Trace one theory concept through the actual nested modules and tests.
- Run one success case and record input → mechanism → observable result.
- Exercise one topic-specific failure/boundary case and name the invariant that protects the system.
- Re-run the relevant tests and explain theory → implementation → evidence.
Done when: another student can reproduce your trace without relying on an invented sample.
Key Takeaways
- Be able to explain Not every workflow needs the same orchestration pattern and point to its implementation/evidence in Day 23.
- Be able to explain Router and point to its implementation/evidence in Day 23.
- Be able to explain Planner and point to its implementation/evidence in Day 23.
Knowledge Check & Scenario Questions
- Concept: Using Not every workflow needs the same orchestration pattern, explain the engineering problem Day 23 is solving without naming a framework as the answer.
- Mechanism: How does Router appear in the real project? Start from
service_desk/router.pyand name the observable state/output/event that changes. - Failure: For Planner, describe one incorrect implementation or boundary condition and the evidence you would expect in
tests/test_orchestration_patterns.py. - Design review: Which assumption in today's design would you verify before reusing this implementation in a different production system?
Official References
- Building Effective Agents (Anthropic Research): https://www.anthropic.com/research/building-effective-agents
- LangGraph Multi-Agent Architecture: https://langchain-ai.github.io/langgraph/concepts/multi_agent/
03 · EXPLAIN
Interview checkpoint
Explain one design decision from this lesson, the alternative you rejected, and the failure mode or evidence that justified your choice.