Single agents hit a wall when tasks become complex. Multi-agent orchestration breaks a problem into specialised roles β€” a planner, a researcher, a writer β€” and lets them collaborate. This tutorial walks through the three patterns you'll use most.

Pattern 1: Pipeline (sequential)

The simplest orchestration. Each agent hands its output to the next.

from openclaw import Agent, Pipeline

researcher = Agent(name="researcher", instructions="Gather facts on the topic.")
outliner   = Agent(name="outliner",   instructions="Turn facts into an outline.")
writer     = Agent(name="writer",     instructions="Write a polished article from the outline.")

article = Pipeline([researcher, outliner, writer]).run("the impact of LLMs on education")
print(article.text)

Use this when later stages strictly depend on earlier ones.

Pattern 2: Supervisor / workers

A supervisor agent decides which worker to invoke and merges results.

from openclaw import Agent, Supervisor

coder    = Agent(name="coder",    tools=[run_python], instructions="Write Python code.")
reviewer = Agent(name="reviewer", instructions="Review the code for bugs.")

supervisor = Supervisor(workers=[coder, reviewer],
                        strategy="react", max_steps=8)
result = supervisor.run("Build a REST API for a todo list and review it.")

Best for open-ended tasks where the order isn't known up front.

Pattern 3: Group chat (collaboration)

Multiple agents discuss the problem in a shared message thread.

from openclaw import GroupChat

chat = GroupChat(participants=[planner, critic, executor],
                 moderator=planner,
                 max_rounds=12)
final = chat.run("Design a launch plan for a new mobile app.")

Best for creative or strategic problems where debate improves the output.

Shared memory

All patterns benefit from a shared memory backend:

from openclaw.memory import RedisMemory

memory = RedisMemory(url="redis://localhost:6379")
agent  = Agent(name="researcher", memory=memory)
AdvertisementAd slot (in-article / responsive)

Observability

Enable tracing to see every agent's reasoning, tool call and token usage:

import openclaw
openclaw.configure(tracing=True, dashboard="https://obs.openclaw.ai")

Common pitfalls

  • ❌ Too many agents β€” coordination overhead dwarfs the benefit. Start with 2–3.
  • ❌ Overlapping roles β€” agents will fight. Give each one a clearly different mandate.
  • ❌ No termination criterion β€” agents can loop forever. Always set max_steps.
πŸ’‘ Rule of thumb

If a single well-prompted agent can do the job reliably, don't add more agents. Multi-agent is a complexity tax β€” pay it only when you must.