MODULE 06 OF 12 · RELEASE 2 · OUTLINE
Agent Orchestration
Knowing when to follow a simple rule, and when you genuinely need to ask the AI.
This module is an outline. The plain-language explanation and the lab specification below are final. The full written lesson and its runnable lab repository are still being prepared, and enrolment is not open.
A restaurant does not hold a staff meeting about where to seat each guest. There is a rule: parties of two go to the small tables. The manager only gets involved when something is genuinely unusual. Asking the manager about everything would be slower, costlier, and no better.
So what is this really about?
Lots of AI systems ask the model to make decisions that a simple rule already settles. That costs money, adds delay, and introduces a chance of being wrong about something that had a definite answer. Use rules where the answer is knowable; use the model where real judgement is needed. And whenever something loops, give it a hard stop.
QUICK CHECK
An AI loop keeps saying "I need one more step" and never finishes. What stops it?
The words you will hear
- Routing
- Deciding which path a piece of work takes.
- Deterministic
- Same input, same answer, every time. A rule, not a judgement.
- Orchestration
- Coordinating several steps or several agents to finish one job.
- Termination condition
- The hard stop. "After ten tries, or one minute, or £1, give up and say so."
By the end you will be able to
- Use a rule wherever the input already decides the answer.
- Give every loop a limit it cannot argue with.
- Justify a second agent with a measurement, not a hunch.
How it is put together
A router inspects structured input and dispatches by rule. Model-driven decisions are used only where the branch genuinely depends on language understanding. Any iterative step carries a step ceiling, a wall-clock budget and a cost budget; exceeding any one terminates the run in a defined state rather than continuing.
Where you start
A single agent with a loop that ends when the model says it is finished — which is to say, an unbounded loop.
The lab
- Replace model-decided routing with deterministic rules wherever the input already determines the branch.
- Add a step ceiling, a time budget and a cost budget to the loop.
- Add a terminal state for each way the run can stop, including exhaustion.
- Introduce one specialist agent as a tool, with its own bounded budget.
- Measure the specialist against doing the same work inline, and keep it only if the measurement justifies it.
What goes wrong, on purpose
The scenario. The model never emits its completion signal and keeps requesting another step.
What should happen. The step ceiling or budget terminates the run in a defined state, with partial results preserved and the reason recorded.
How you prove it works
- A test with a model double that never terminates, asserting the run stops at the ceiling.
- A test asserting deterministic inputs never reach the model router.
- A comparison test recording cost and latency with and without the specialist agent.
What you walk away with
An orchestrator that cannot loop forever, deterministic routing for deterministic decisions, and a measurement justifying any multi-agent structure.
