MSBA-371 · Lesson 6 of 12 · 19 min

Multi-agent patterns

▶ Video coming soon A video version of this lesson is on the way.

Seraphine joined the sixth session in person; she was in Portland for a supplier meeting and stayed for the afternoon. Skerry had started using several agents together, and she brought both a success and a mess. The success was a documentation pipeline in which one agent drafted API reference pages and another checked them against the code. The mess was a Monday on which three developers had each assigned an agent to related issues in the checkout service, and by Tuesday there were three pull requests that changed the same validation function in three incompatible ways.

The GH-600 domain on orchestrating multi-agent coordination carries 15 to 20 percent of the exam. Its first objective is to operate multi-agent workflows: apply an orchestration pattern, configure agent isolation for parallel execution, and detect and resolve conflicts such as overlapping code changes, duplicated effort and contradictory outputs. This lesson covers those three skills. Later lessons cover handoffs, observability, failures and the lifecycle of agents.

Start with one agent

The first rule of multi-agent design is to avoid it until you need it. Every extra agent adds handoffs, more context to keep consistent, more cost and more places for failures to hide. A single well-configured agent with good tools and a clear plan handles most tasks a team assigns. Multiple agents earn their keep when a task has parts that need different instructions or tools, parts that can run in parallel, or a step that benefits from an independent check.

Seraphine's documentation pipeline met two of those tests: the drafting agent needed write tools and the house style guide, while the checking agent needed read-only tools and a strict rubric, and keeping them separate meant the checker was not marking its own homework.

The common patterns

Most multi-agent systems are built from a handful of patterns. The names vary between vendors and papers; the shapes do not.

Five small diagrams in a grid. Sequential: three boxes in a row joined by arrows. Orchestrator and workers: one box at the top with arrows down to three boxes and back. Parallel fan-out: one task splitting into three boxes that join into a merge box. Writer and reviewer: two boxes with arrows in both directions forming a loop. Router: one box with arrows to three alternatives, only one highlighted.
Five orchestration patterns. Real systems often combine them, for example an orchestrator whose workers each run a writer and reviewer loop.
Orchestration patterns, what they are good for and how they fail.
PatternShapeGood forMain risk
Sequential pipelineAgent A finishes, hands to B, then CStages with different skills: plan, implement, documentErrors early in the chain propagate
Orchestrator and workersOne agent splits the task, assigns parts, collects resultsLarge tasks with separable partsOrchestrator's split is wrong or parts overlap
Parallel fan-outSeveral agents work at once on parts or on the same taskIndependent parts; or several attempts to choose fromConflicts when parts touch the same code
Writer and reviewer (evaluator-optimizer)One agent produces, another critiques, repeatQuality checks against clear criteriaEndless loops; reviewer too lenient or too strict
RouterOne agent classifies the task and sends it to a specialistMixed incoming work such as issues of many kindsMisrouting

Sequential pipelines are the easiest to reason about. A planning agent produces a plan, an implementation agent carries it out, a documentation agent updates the README. Each stage has narrow instructions and tools. The risk is that a mistake in the plan flows through every later stage, so a person often checks the output between stages, which the next lesson covers as a handoff.

Orchestrator and workers suits tasks too large for one context. The orchestrator breaks the task into parts, gives each to a worker with only the context it needs, and assembles the results. Workers often run as subagents: separate agent runs with their own context window, started by the orchestrator, returning only a summary. Subagents keep the orchestrator's context small, because it sees each worker's conclusion rather than every file the worker read. The orchestrator's split is the weak point: parts that are not really independent will collide.

Parallel fan-out runs several agents at the same time. Sometimes they do different parts; sometimes they attempt the same task, and a person or another agent chooses the best result. GitHub supports the second form directly: an issue can be assigned to more than one agent, including third-party agents an enterprise allows, so a team can compare their pull requests side by side.

Writer and reviewer loops pair a producer with a critic that checks the output against criteria and sends it back with comments. They work when the criteria are clear and checkable. They need a limit on rounds, or the pair can loop forever over matters of taste.

Routers classify incoming work and send it to the right specialist: a dependency-update agent, a documentation agent, a test-writing agent, or a person. A router is often the cheapest way to make specialist agents useful, and misrouting is easy to measure on a test set.

Multi-agent features in GitHub's tools

GitHub's agent platform supports these patterns in several places, and the features moved quickly through 2025 and 2026, so check current documentation for details. Custom agents define specialists with their own instructions, tools and MCP servers. In editors such as VS Code, a custom agent's file can list the other agents it may call as subagents, and can define handoffs, buttons that move the conversation to another agent with a prepared prompt, which is a sequential pipeline with a person pressing the button. The cloud agent runs each assigned task in its own session and branch, so assigning several issues is a natural fan-out. Agent HQ, which GitHub announced in late October 2025, brings third-party coding agents into the same assignment, review and governance surfaces as Copilot, with a central view for tracking agent sessions; GitHub announced Claude and Codex agents there in February 2026. Enterprise administrators decide which agents are allowed through the enterprise AI controls covered in MSBA-370.

Outside GitHub, the Agent2Agent protocol (A2A), started by Google in 2025 and now hosted by the Linux Foundation, defines how agents built on different platforms describe themselves and pass tasks to each other. MCP, covered in MSBA-370, connects an agent to tools and data; A2A connects agents to other agents. Microsoft's agent platforms, including Copilot Studio and Foundry, support A2A for connecting agents, which the Copilot Studio courses in this program cover. Most coding teams on GitHub meet A2A only when they connect to agents outside GitHub.

Isolation for parallel execution

When agents work in parallel, each needs its own place to work. The study guide calls this configuring agent isolation. Without isolation, two agents editing the same working copy overwrite each other's files, run tests against each other's half-finished changes and produce results nobody can attribute.

Levels of isolation for agents working in parallel. The cloud agent gives branch, environment and context isolation by default; local agents need worktrees or separate clones.
Isolation levelHowWhat it protects
BranchEach agent works on its own branchCommits do not mix; each result is a separate pull request
Working copySeparate clones or Git worktrees for local agentsFiles and build outputs do not collide on one machine
EnvironmentSeparate cloud environments, as the cloud agent uses for each sessionProcesses, caches, network rules and credentials are separate
ContextSeparate sessions or subagents with their own context windowOne agent's reasoning does not contaminate another's
PermissionsEach agent has only the tools and tokens its role needsA mistake in one role cannot reach another role's resources

The cloud agent provides isolation by design: every session gets a fresh environment, its own copilot/ branch and its own context. Local agents need more care. Running two editor agents in the same folder is asking for trouble; Git worktrees, which let one repository have several working folders on different branches, are a common way to give each local agent its own copy cheaply. Copilot CLI and several editors support running agents in separate worktrees or background sessions for this reason.

Conflicts: overlapping changes, duplicated effort, contradictory outputs

Isolation stops agents interfering while they work. It does not stop their results conflicting when they come back. The study guide names three kinds of conflict.

Overlapping code changes are what Skerry's checkout team hit: three branches changing the same function. Git reports them as merge conflicts when the second and third pull requests try to merge, which is late. They are cheaper to prevent: assign related issues to one agent, or have an orchestrator split work by file or module, or check before assignment whether open agent pull requests touch the same files.

Duplicated effort is two agents doing the same work, usually because two people assigned overlapping issues, or an orchestrator gave two workers overlapping parts. It wastes money and review time. Prevention is visibility: a single place to see which agent is working on what, linked issues, and an orchestrator that records which parts it has assigned.

Contradictory outputs are results that disagree: one agent's review says a change is safe and another's says it is not, or a documentation agent describes behavior the implementation agent changed. They are dangerous when nobody notices. Resolution needs a rule: which agent's output wins for which question, or which contradictions go to a person.

Worked problem

Untangling Skerry's three pull requests

Three agent pull requests changed validateGiftMessage() in the checkout service in three different ways. Seraphine described how the team resolved it.

Show solution
  1. Detect: the second pull request showed a merge conflict after the first merged; a reviewer noticed the third touched the same function and paused it.
  2. Diagnose: the three issues described symptoms of one underlying problem, the lack of a single length limit shared with the gift-card printer.
  3. Resolve: Teodric Nnaji-Lund, who owns the checkout service, closed two pull requests, wrote one issue describing the real problem with the agreed limit, and assigned it to one agent with a plan.
  4. Prevent: the commerce team added a check to its assignment habit: before assigning an agent, search open pull requests for the same files. They also linked related issues to a parent issue so the overlap would show.

Choosing a pattern: a worked decision

Lena tried the decision on a real Tidewater task: updating all six of the organization's actions to a new major version of the Actions toolkit library, which had a breaking change. Each action lived in its own repository. The work was the same kind in each, each repository was independent, and each change could be checked by that repository's tests.

That is a good fit for parallel fan-out with strong isolation: six issues, six cloud agent sessions, six branches, six pull requests. There is no shared code to conflict over, and each pull request is small. An orchestrator would add little, since the split is obvious. A reviewer agent might help if the change were subtle; here the tests were enough.

A contrasting task, splitting TrailCheck's large import module into three modules, was a poor fit for fan-out: the three parts shared types and helper functions, so three agents would collide. A single agent with a plan, or an orchestrator that did the shared refactoring first and only then fanned out, was the better design.

The cost of coordination

Every pattern in this lesson has a price beyond the agents' own work. An orchestrator spends tokens planning, assigning and assembling. A summarizer reads everything the specialists produced. A writer and reviewer loop doubles the number of model calls for each round. Parallel attempts multiply the cost of a task by the number of attempts, and someone must still review the results to choose one.

MSBA-370's lesson on cost and latency applies directly. Before adopting a multi-agent design, estimate its cost per task against the single-agent baseline, and measure both on the test set. Skerry's documentation pipeline cost roughly twice as much per page as a single agent, which the team accepted because the checking agent caught errors that had previously reached published pages. A fan-out of three attempts per bug fix, which a commerce team tried for a month, cost three times as much and saved little, because reviewers rarely found the second and third attempts better than the first; the team dropped it except for tasks that had already failed once.

Common mistakes

  • MistakeStarting with a team of agents for an ordinary task.

    InsteadStart with one agent; add agents only for different tools or instructions, parallel parts or an independent check.

  • MistakeRunning two local agents in the same working folder.

    InsteadGive each agent its own branch and worktree or clone.

  • MistakeFanning out parts that share code.

    InsteadDo shared changes first, or split by file and module, or use one agent.

  • MistakeLetting a writer and reviewer loop without a round limit.

    InsteadSet a maximum number of rounds and escalate disagreements to a person.

  • MistakeDiscovering overlapping agent work at merge time.

    InsteadCheck open agent pull requests and link related issues before assigning.

Summary and key terms

  • Use multiple agents only when parts need different tools or instructions, can run in parallel, or need an independent check.
  • Common patterns are sequential pipelines, orchestrator and workers, parallel fan-out, writer and reviewer, and routers.
  • Subagents keep the orchestrator's context small by returning summaries.
  • GitHub supports custom agents, subagents and handoffs in editors, parallel cloud agent sessions and third-party agents through Agent HQ.
  • A2A connects agents to agents; MCP connects agents to tools and data.
  • Isolate parallel agents by branch, working copy, environment, context and permissions.
  • Prevent and resolve overlapping changes, duplicated effort and contradictory outputs.
Orchestrator
An agent that splits a task, assigns parts to other agents and assembles results.
Subagent
An agent run started by another agent, with its own context, returning a summary.
Parallel fan-out
Running several agents at once on parts of a task or on the same task.
Evaluator-optimizer
A pattern in which one agent produces output and another critiques it in rounds.
Router
An agent that classifies work and sends it to a specialist.
Worktree
An extra working folder for the same Git repository, on its own branch.
Agent2Agent protocol (A2A)
An open protocol for agents on different platforms to describe themselves and exchange tasks.
Agent HQ
GitHub's approach, announced in 2025, to running Copilot and third-party agents through common surfaces.

Practice problems

Work each problem on paper first, then reveal the answer to check.

  1. Why was updating six independent actions a good fit for fan-out?

    Show answer

    The parts were independent repositories with their own tests, so there was nothing to conflict over.

  2. What does a subagent return to its orchestrator?

    Show answer

    A summary of its result, not its whole context.

  3. Which protocol connects agents to tools, and which connects agents to agents?

    Show answer

    MCP connects agents to tools and data; A2A connects agents to other agents.

Lesson quiz · 5 questions

Score 60% or more to complete this lesson.

Take the quiz