Module 5 · Lesson 3 · 15 min read
Collaboration patterns between agents
Multi-Agent Collaboration Patterns
Introduction
Agents in a team can be arranged in different ways, and each arrangement has strengths and costs. In this lesson we review four main patterns: sequential, parallel, hierarchical and collaborative, and we apply two of them with runnable Python code.
Learning objectives
- Describe the sequential, parallel, hierarchical and collaborative patterns
- Implement a parallel pattern with a step that aggregates the results
- Choose the right pattern for a given task and justify the choice
- Read an example of a sequential team in the CrewAI framework
Why talk about patterns?
A pattern is a recurring solution to a recurring problem. Instead of designing each team from scratch, you start from a known pattern and adapt it. In its article on building effective agents, Anthropic names patterns such as prompt chaining, routing, parallelization, orchestrator-workers and evaluator-optimizer, which are the same building blocks from which teams are built.
The sequential pattern
The work passes through the agents like a production line: the output of the first is the input of the second, and so on. Example: a researcher, then a writer, then a proofreader.
- Advantages: simple and easy to trace, and each stage is tested on its own.
- Disadvantages: slow, because each agent waits for the one before it, and an error in the first stage carries over to the ones after it.
The CrewAI framework supports this pattern directly through Process.sequential (according to the official documentation, reviewed 18 November 2026). The following example needs the library installed and an API key for a language model, and will not run without them:
# Requires: pip install crewai and an API key for a language model
from crewai import Agent, Task, Crew, Process
researcher = Agent(role="Researcher", goal="Gather documented facts about renewable energy",
backstory="A meticulous researcher who cites the source of every piece of information")
writer = Agent(role="Writer", goal="Write a clear summary for first-year students",
backstory="A science writer who simplifies concepts")
research = Task(description="Gather five facts about renewable energy",
expected_output="A list of five facts with their sources", agent=researcher)
write = Task(description="Write a summary from the gathered facts",
expected_output="One clear paragraph", agent=writer)
crew = Crew(agents=[researcher, writer], tasks=[research, write],
process=Process.sequential)
print(crew.kickoff())The parallel pattern
The work is distributed among several agents working at the same time on independent parts (fan-out), then an agent or an aggregator function collects the results (fan-in). Example: three agents, each searching a different source.
The condition for parallelism is that the tasks are independent; if one agent needs another agent's result, there is no point in running them together. This is a Python simulation without external libraries, in which the agents are deterministic functions:
from concurrent.futures import ThreadPoolExecutor
SOURCES = {
"library": ["Solar energy is a renewable source"],
"course_notes": ["Wind energy needs sites with steady winds"],
"glossary": ["Solar energy is a renewable source", "Geothermal energy uses the heat of the Earth's interior"],
}
def search_agent(source):
return {"source": source, "facts": SOURCES[source]}
def aggregator(results):
merged = {}
for r in results:
for fact in r["facts"]:
merged.setdefault(fact, []).append(r["source"])
return merged
with ThreadPoolExecutor(max_workers=3) as pool:
results = list(pool.map(search_agent, SOURCES))
for fact, srcs in aggregator(results).items():
print(f"{fact} <- {', '.join(srcs)}")Notice that the aggregator removed the duplicate and kept the sources, so the fact that appeared in two sources became a single line with two sources. Aggregation is a real design step: do you merge? Do you vote? Do you choose the highest confidence?
The hierarchical pattern and the collaborative pattern
In the hierarchical pattern a supervisor or manager agent splits the task and distributes it to worker agents, then collects their results, and the supervisor may have sub-supervisors beneath it. We cover it in detail in the next lesson.
In the collaborative pattern the agents work as peers: one proposes a solution and another critiques it, or each gives an answer and then a vote is held. It helps in problems that benefit from multiple viewpoints, but it is the most prone to long loops if termination rules are not set.
| Pattern | Speed | Ease of tracing | A suitable example |
|---|---|---|---|
| Sequential | Relatively slow | High | Research, then writing, then proofreading |
| Parallel | Fast for independent tasks | Medium | Searching several sources |
| Hierarchical | Depends on the supervisor | Medium | A project with varied subtasks |
| Collaborative | May take long | Low | A critical review of a proposed solution |
A practical example: choosing the pattern
A student builds an exam preparation assistant: it collects questions from three chapters, then orders them by difficulty, then writes model answers. Collecting the questions from the three chapters is independent, so parallelism suits it, while ordering and then writing the answers each depend on the step before, so sequencing suits them. The final design is therefore a compound pattern: a parallel stage followed by a chain.
Summary
The four main patterns are sequential, parallel, hierarchical and collaborative. The sequential pattern is simple and easy to trace but slow, and the parallel pattern is fast provided the tasks are independent, and needs a well-thought-out aggregation step. The hierarchical pattern relies on a supervisor that distributes and collects, and the collaborative pattern benefits from mutual critique but needs strict termination rules. And many real systems mix more than one pattern.
Terms
| Term | English | Definition |
|---|---|---|
| Sequential pattern | Sequential Pattern | Passing the work from one agent to the next like a production line |
| Parallel pattern | Parallel Pattern | Running agents on independent tasks at the same time |
| Aggregator | Aggregator | A component that merges the results of several agents into a single result |
| Hierarchical pattern | Hierarchical Pattern | A supervisor that distributes the work to worker agents and collects their results |
| Collaborative pattern | Collaborative Pattern | Peer agents that propose and critique, or vote |
Review questions
- What is the basic condition for applying the parallel pattern?
- Why does an error in the first stage of the sequential pattern carry over to the rest of the stages?
- Name three possible strategies for the aggregation step.
- Design a compound pattern for the task of preparing a presentation on a scientific topic.
References
- Building effective agents (Anthropic) www.anthropic.com Reviewed on 2026-11-18
- CrewAI Tasks docs.crewai.com Reviewed on 2026-11-18
