Multi-Agent Orchestration
When one employee isn't enough, hire a team (of AI)
At some point, one agent won't be enough. Just like one employee can't run a whole company. This chapter covers how to build an AI team — and how each platform handles multi-agent differently.
🔍 Research Agent = Your market analyst. Reads everything, spots trends, reports findings.
🔨 Builder Agent = Your developer. Writes code, deploys things, fixes bugs.
✍️ Content Agent = Your marketing person. Writes posts, manages social, engages community.
⚙️ Ops Agent = Your operations manager. Monitors systems, handles alerts, maintains infrastructure.
You = The CEO. Vision, strategy, final decisions, and the occasional "no, absolutely not."
Architecture Patterns
You're the hub. Each agent is a spoke. They communicate through shared files, not direct messages. Simple, debuggable, scalable.
Research Agent → writes to knowledge/research/
Content Agent → reads research, writes to content/drafts/
You → approve drafts
Content Agent → publishes
Agent A's output becomes Agent B's input. Like an assembly line. Best for content creation, data processing, code review.
Research → Draft → Edit → Format → Publish (each step = different agent or prompt)
Multiple agents work on the same problem from different angles. A coordinator agent synthesizes results. Best for research, analysis, competitive intelligence.
Agent A searches Reddit + Agent B searches Twitter + Agent C checks competitors → Coordinator combines findings
🔌 Multi-Agent on Every Platform
🐾 OpenClaw — Native Multi-Agent
OpenClaw has built-in sub-agent spawning. The main agent can create isolated sessions for specific tasks.
# In your main agent session, spawn a research sub-agent:
sessions_spawn(
task: "Research the top 5 AI agent frameworks.
Compare features, pricing, community size.
Save findings to knowledge/research/frameworks.md",
model: "sonnet",
mode: "run" # one-shot: runs task and returns result
)
# Spawn a content sub-agent:
sessions_spawn(
task: "Read knowledge/research/frameworks.md.
Draft a Twitter thread comparing them.
Save to content/drafts/frameworks-thread.md",
model: "sonnet",
mode: "run"
)
# Main agent reviews both outputs and publishes🤖 Claude — Projects + Claude Code
Claude doesn't have native multi-agent, but you can simulate it with Projects and parallel conversations.
# Create separate Claude Projects for each "agent":
Project: "Research Agent"
- Instructions: "You are a research analyst.
Your job is to find data and write briefs."
- Upload: industry reports, competitor lists
Project: "Content Agent"
- Instructions: "You are a content writer.
You write in [my voice]. Never be corporate."
- Upload: tacit.md, brand guidelines, past posts
# Workflow:
# 1. Ask Research Agent to investigate topic
# 2. Copy findings into Content Agent conversation
# 3. Content Agent drafts posts
# 4. You review and post
# With Claude Code CLI (true multi-agent):
# Run separate Claude Code instances in different
# terminal tabs, each with different system prompts💬 ChatGPT — Custom GPTs as Agents
Create multiple Custom GPTs, each specialized for a role. Use the API for automated orchestration.
# Create Custom GPTs:
GPT: "Market Researcher"
Instructions: "You research markets. You use
browsing to find real data. Output structured
markdown reports."
GPT: "Content Writer"
Instructions: "You write social media content.
You match [voice examples]. You output
platform-ready drafts."
GPT: "Code Reviewer"
Instructions: "You review code for bugs,
security issues, and best practices.
You are brutally honest."
# API orchestration (Python):
import openai
# Step 1: Research
research = openai.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "system", "content": researcher_prompt},
{"role": "user", "content": "Research AI agents market"}
]
)
# Step 2: Content (uses research output)
content = openai.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "system", "content": writer_prompt},
{"role": "user", "content": f"Write a thread based on: {research}"}
]
)🚀 CrewAI — Purpose-Built Multi-Agent
CrewAI was literally designed for this. Define agents, give them roles, assign tasks, and let them collaborate.
from crewai import Agent, Task, Crew
researcher = Agent(
role="Market Research Analyst",
goal="Find validated business opportunities",
backstory="You're a veteran analyst who reads Reddit, "
"Twitter, and HN to find pain points.",
tools=[SearchTool(), WebScrapeTool()],
llm="claude-sonnet-4-20250514"
)
writer = Agent(
role="Content Strategist",
goal="Turn research into engaging content",
backstory="You write punchy, no-BS content that "
"sounds human, not corporate.",
llm="gpt-4o"
)
# Define tasks
research_task = Task(
description="Find 5 pain points in the AI agent space",
agent=researcher,
expected_output="Markdown report with quotes and sources"
)
content_task = Task(
description="Write a Twitter thread from the research",
agent=writer,
expected_output="Thread draft, 5-7 tweets",
context=[research_task] # Depends on research output
)
# Run the crew
crew = Crew(
agents=[researcher, writer],
tasks=[research_task, content_task],
verbose=True
)
result = crew.kickoff()🦜 LangChain — Chain-Based Orchestration
from langchain.agents import initialize_agent, Tool
from langchain.chat_models import ChatOpenAI
# Create specialized chains
research_llm = ChatOpenAI(model="gpt-4o", temperature=0)
content_llm = ChatOpenAI(model="gpt-4o", temperature=0.7)
# Define tools for research agent
tools = [
Tool(name="Search", func=search_tool,
description="Search the web for information"),
Tool(name="ReadReddit", func=reddit_tool,
description="Read Reddit posts and comments"),
]
# Research agent
researcher = initialize_agent(
tools, research_llm,
agent="zero-shot-react-description",
verbose=True
)
# Pipeline: research → content
research_output = researcher.run(
"Find pain points about AI agents on Reddit"
)
content_output = content_llm.predict(
f"Write a thread based on: {research_output}"
)🤖 AutoGPT — Autonomous Multi-Agent
- • AutoGPT runs fully autonomous — it decides its own sub-tasks
- • Define a high-level goal: "Build and validate a SaaS idea"
- • It creates its own agent team internally
- • Warning: Can be unpredictable. Set spending limits and review checkpoints.
- • Best for: exploration and brainstorming. Not for production workflows (yet).
- • Use our memory architecture (AGENTS.md, knowledge base) as AutoGPT's workspace files
⚡ n8n / Make / Zapier — Visual Multi-Agent
No-code platforms handle multi-agent through workflow chains. Each AI node is effectively an "agent."
# n8n Workflow: Research → Draft → Approve → Post
Node 1: Schedule Trigger (7 AM daily)
↓
Node 2: HTTP Request → Search Twitter API
↓
Node 3: AI Agent (OpenAI) → "Analyze these tweets.
Find 3 trending topics in [niche]."
↓
Node 4: AI Agent (Claude) → "Write 3 tweet drafts
about the top topic. Voice: [examples]."
↓
Node 5: Slack Message → Send drafts to #content-review
↓
Node 6: Wait for Approval (Slack reaction ✅)
↓
Node 7: HTTP Request → Post to Twitter API
# Make.com: Same flow, drag-and-drop modules
# Zapier: Same concept, but use "Paths" for branching💻 Cursor / Windsurf / Cline — Coding Agent Teams
Coding agents benefit from the same memory architecture, but applied to code.
# Project Memory Architecture ## Knowledge Base (always available) - /docs/architecture.md — system design decisions - /docs/api-spec.md — API contracts - /docs/patterns.md — preferred code patterns ## Decision Protocols - New component? → Use shadcn/ui + Tailwind - State management? → Zustand for client, React Query for server - Database? → Convex (dev) / Postgres (production) - Testing? → Vitest + Playwright ## Tacit Knowledge (my preferences) - I prefer composition over inheritance - Use named exports, not default exports - Error messages should be user-friendly - Comments explain WHY, not WHAT - Keep functions under 50 lines ## Multi-Agent Setup - Tab 1: "Architect" — designs components, writes interfaces - Tab 2: "Builder" — implements from architect's design - Tab 3: "Reviewer" — reviews builder's code, catches bugs
When to Add Another Agent
- • Current agent is maxing out context window
- • Tasks need genuinely different expertise/models
- • You need parallel execution (research while drafting)
- • One agent's output feeds another's input cleanly
- • One agent can handle it with better prompting
- • You're adding complexity for complexity's sake
- • The coordination overhead exceeds the benefit
- • You haven't eliminated bottlenecks on agent #1 yet
The Orchestration Maturity Path
- ✗One agent tries to do everything
- ✗Context window overloaded with unrelated info
- ✗Agent forgets mid-task because too much is loaded
- ✗One failure breaks the entire workflow
- ✗Can't scale beyond what one context window holds
- ✓Each agent has a focused, specific role
- ✓Clean context — each agent only loads what it needs
- ✓Failures are isolated — one agent down doesn't kill the rest
- ✓Agents can run in parallel for faster execution
- ✓Scales horizontally by adding specialized agents
Communication Patterns
How agents talk to each other matters more than how many you have. Here are the three patterns that actually work:
Hub & Spoke is what you want 90% of the time. One "manager" agent that understands the big picture and delegates specific tasks to specialist agents. The manager doesn't do the work — it coordinates.
Pipeline works for content workflows: Research Agent → Writing Agent → Editing Agent → Publishing Agent. Each agent is excellent at one thing and passes the baton.
Event-Driven is for monitoring setups: a price-change event triggers the trading agent, a new-mention event triggers the social media agent, a deploy event triggers the QA agent. No central coordinator needed.
Share this chapter
Chapter navigation
15 of 36