learning-it by example

#236 Enterprise architecture and AI agents 5.3 min

Agent Orchestration Patterns: Supervisor, Pipeline, Swarm

The same three agents solved four tickets, or six, depending on how I organised them.

1. Which advice on choosing an agent orchestration pattern does the Azure architecture guide to AI agent design patterns give?
2. In the Python comparison of a pipeline, a supervisor and a swarm run on the same seven support tickets, what did the supervisor score?
3. In the orchestration patterns example, how does the supervisor handle a ticket compared with the pipeline?
4. Which of the seven support tickets did none of the three orchestration patterns solve, and what does it need?
5. What is the risk of a swarm of agents that hand tickets to each other with no limit on handoffs?

Practice only: nothing is saved and no score counts towards anything. Each answer comes with the reason.

  1. Read the three numbers

    Copy the code folder first. Run python compare.py. For each of the three lines, write down in your own words what the three numbers mean: tickets solved, agent calls and handoffs. Then say which pattern is cheapest in calls and which pattern solved the most tickets. When I ran it the pipeline made 7 calls and solved 4 of 7.

    A hint

    The pipeline and the supervisor never hand tickets to a peer, so their handoffs are 0.

  2. Remove the flaky failure

    In crew.py, change the line that starts FLAKY so the set is empty: FLAKY = set(). Predict how the three lines change, then run python compare.py. When I ran it, the pipeline solved 5 of 7, the supervisor made 10 calls and the swarm made 14 calls with 7 handoffs. Then put the FLAKY line back as it was before the next task.

    A hint

    The tech agent no longer fails the first time on the crash ticket, so there is nothing to retry.

  3. Shorten the swarm limit

    In patterns.py, change the swarm default from limit=4 to limit=2. Predict how many tickets the swarm solves and how many handoffs it makes, then run python compare.py. When I ran it the swarm solved 5 of 7, with 12 calls and 5 handoffs.

    A hint

    The swarm starts at the account agent, so tickets for other agents need a handoff before they can be solved.

  4. Take away the second chance

    In patterns.py, in the supervisor function, change for kind in (best, second, best): to for kind in (best,):. Predict the supervisor line before you run python compare.py. When I ran it the supervisor solved 4 of 7 with 7 calls, the same as the pipeline.

    A hint

    With only one try per ticket the supervisor works like the pipeline.

These tasks are for you to try on your own machine. Nothing is checked or saved.

What this does not show

Plain functions with keyword rules, not models; seven made-up tickets, three of them traps I set; the swarm always starts at the same agent; cost is counted in calls, not seconds or money; only a pipeline, a supervisor and a swarm are built.

Up next in Enterprise architecture and AI agents

More in Enterprise architecture and AI agents

All Enterprise architecture and AI agents videos

Related videos