AIs That Work as a Team — Multi-Agent Systems


Written by Thierry K (human) · AI-assisted
Multi-agent systems — Claudie and Siwol welcome you to the world of AI teamwork

🤝 Solo AI vs Team AI

In the last episode, we assembled a single agent with Claude Agent SDK, right? But what happens when you dump every complex real-world task on one agent? Research, write, analyze SEO, plan images… the results get messy fast.

Siwol
Wait, was this post written by an AI team too? Not just one agent?
Claudie
Exactly! Researcher, Writer, Editor… this blog actually has 10 agents working as a team. When each one focuses only on their role, the results are so much better.

Think of it like a company. A company where each department has specialists is way more efficient than one where the CEO handles marketing, development, design, and sales all alone, right? Multi-agent systems work on the same principle.

Multi-Agent System
A system where multiple AI agents — each with their own role, tools, and instructions — collaborate to complete complex tasks that would be difficult for a single agent. The Agent Loop (Think→Act→Observe) we learned in Episode 5 runs independently for each agent.

🔀 Three Patterns of Multi-Agent Design

There are three main patterns for designing multi-agent systems. Each has clear pros and cons, so picking the right one for your situation is key.

Three multi-agent patterns compared — Sequential, Parallel, and Orchestrator

1. Sequential Pattern

Like a relay race — A finishes, hands the baton to B, B finishes, passes to C. It’s the simplest and easiest to understand.

Claudie
Think about blog writing: the Researcher has to finish their research before the Writer can start drafting, right? This pattern is perfect for tasks where order matters.

In Claude Agent SDK, you define each agent’s role with AgentDefinition and specify the order in the orchestrator’s system prompt.

agents = {
    "researcher": AgentDefinition(
        description=(
            "Researches a topic and "
            "returns a briefing."
        ),
        prompt=(
            "You are a tech "
            "researcher. Find key "
            "facts, recent trends, "
            "and concrete examples "
            "about the topic. Return"
            " a structured briefing "
            "with bullet points."
        ),
        tools=[
            "WebSearch",
            "WebFetch",
        ],
    ),
    "writer": AgentDefinition(
        description=(
            "Writes blog posts from "
            "research briefings."
        ),
        prompt=(
            "You are a blog writer. "
            "Using the research "
            "provided, write an "
            "engaging blog post "
            "with clear sections "
            "and a friendly tone."
        ),
        tools=[],
    ),
}

async for msg in query(
    prompt=(
        "Create a short blog "
        "post about multi-agent "
        "AI systems. First "
        "research the topic, "
        "then write the post."
    ),
    options=ClaudeAgentOptions(
        system_prompt=(
            "You are a pipeline "
            "manager. Follow this "
            "exact order:\n"
            "1. Call researcher to "
            "gather facts\n"
            "2. Call writer to "
            "create a blog post "
            "from the research\n"
            "Return the final post."
        ),
        allowed_tools=["Agent"],
        agents=agents,
        max_turns=10,
    ),
):
    if hasattr(msg, "result"):
        print(msg.result)
Siwol
Oh cool! So the system prompt we learned about in Episode 6 becomes each agent’s “role” here?
Claudie
Exactly! The prompt in AgentDefinition defines that agent’s specialty. And with tools, you can give different tools to different agents.

2. Parallel Pattern

This one handles independent tasks simultaneously. When you have tasks like SEO analysis and image planning that don’t depend on each other, you can save a ton of time.

agents = {
    "seo-researcher": AgentDefinition(
        description=(
            "Analyzes SEO keywords "
            "and search trends."
        ),
        prompt=(
            "You are an SEO "
            "specialist. Analyze "
            "search trends for "
            "the given topic. "
            "Return: top 5 "
            "keywords, search "
            "volume hints, and "
            "a suggested title."
        ),
        tools=["WebSearch"],
    ),
    "image-director": AgentDefinition(
        description=(
            "Plans visual content "
            "for blog posts."
        ),
        prompt=(
            "You are an art "
            "director. Plan the "
            "visual content for "
            "a blog post: featured"
            " image concept, 2 "
            "diagram ideas, and "
            "color palette."
        ),
        tools=[],
    ),
}

async for msg in query(
    prompt=(
        "For a blog post about "
        "'multi-agent systems': "
        "1) Research SEO keywords"
        " 2) Plan the images. "
        "These tasks are "
        "independent."
    ),
    options=ClaudeAgentOptions(
        system_prompt=(
            "You manage parallel "
            "tasks. Call BOTH "
            "seo-researcher AND "
            "image-director — "
            "they don't depend "
            "on each other, so "
            "dispatch them "
            "together. Combine "
            "results into a "
            "unified brief."
        ),
        allowed_tools=["Agent"],
        agents=agents,
        max_turns=10,
    ),
):
    if hasattr(msg, "result"):
        print(msg.result)
Key to the parallel pattern: You need to explicitly tell the system prompt to “call them simultaneously.” Otherwise, the LLM might call them sequentially.

3. Orchestrator Pattern

Now for the most powerful — and most complex — pattern. Like a conductor leading an orchestra, a manager agent coordinates the entire team. The manager doesn’t do the work itself; it decides who gets which task and synthesizes the results. The beauty of this pattern is that it can flexibly combine sequential and parallel flows.

Claudie
Think of it like a blog team: the editor-in-chief says “First, have the researcher investigate. Then the writer drafts from those findings. Finally, the reviewer does quality control.” They manage the whole flow.
agents = {
    "researcher": AgentDefinition(
        description=(
            "Researches topics "
            "using web search."
        ),
        prompt=(
            "You are a tech "
            "researcher. Search "
            "for recent info on "
            "the given topic. "
            "Return a structured "
            "briefing with:\n"
            "- Key facts (3-5)\n"
            "- Recent trends\n"
            "- One concrete example"
        ),
        tools=[
            "WebSearch",
            "WebFetch",
        ],
    ),
    "writer": AgentDefinition(
        description=(
            "Writes blog posts "
            "from research."
        ),
        prompt=(
            "You are a blog "
            "writer. Write an "
            "engaging post using "
            "the research. Use "
            "clear sections, "
            "simple language, "
            "and a friendly tone."
            " Target: 300-500 "
            "words."
        ),
        tools=[],
    ),
    "reviewer": AgentDefinition(
        description=(
            "Reviews drafts for "
            "quality and accuracy."
        ),
        prompt=(
            "You are a blog "
            "editor. Review the "
            "draft for:\n"
            "- Factual accuracy\n"
            "- Clarity and flow\n"
            "- Engagement level\n"
            "Provide specific, "
            "actionable feedback. "
            "Then rewrite the "
            "improved version."
        ),
        tools=[],
    ),
}

async for msg in query(
    prompt=(
        "Create a blog post "
        "about 'How AI agents "
        "work together as a "
        "team'. Research it, "
        "write it, then review."
    ),
    options=ClaudeAgentOptions(
        system_prompt=(
            "You are an editor-"
            "in-chief managing a "
            "blog team. Workflow:"
            "\n1. Call researcher "
            "to gather facts\n"
            "2. Call writer to "
            "draft using research"
            "\n3. Call reviewer to"
            " improve the draft\n"
            "Return the final "
            "polished blog post."
        ),
        allowed_tools=[
            "Agent",
        ],
        agents=agents,
        max_turns=15,
    ),
):
    if hasattr(msg, "result"):
        print(msg.result)
Siwol
Oh, this is just like a real company! The editor-in-chief assigns tasks to the researcher, writer, and reviewer in order.

Multi-agent team comic — agents in chaos without an orchestrator

🔗 Agent Handoff — The Secret of Passing the Baton

In a multi-agent system, when one agent passes work to another, it’s called a handoff. It’s the process where one agent’s output becomes the next agent’s input.

Claudie
In the SDK, handoffs happen automatically. When the orchestrator calls a sub-agent using the Agent tool, that agent runs its own Agent Loop and returns the result.
Siwol
So do the agents know about each other?
Claudie
Nope, they don’t! Only the orchestrator sees the big picture. Each sub-agent only sees the input it’s given and works on that. That’s what keeps the separation of roles so clean.

🏗️ Real World: The Blog Pipeline Structure

The post you’re reading right now was actually made by a multi-agent system! Let me give you a peek at our actual blog-agent pipeline structure.

Blog agent pipeline — sequential + parallel flow of 10 agents

Ten agents work together using a combination of sequential and parallel patterns:

  • Sequential phase: Topic Planner → Researcher → Writer → Reviewer (tasks that need to follow a specific order)
  • Parallel phase: SEO Analyzer + Image Director + Translator (independent tasks processed simultaneously)
  • Final sequential step: Publisher gathers all results and publishes to WordPress
Siwol
Wow, 10 agents! Does that mean the API cost is 10x too?!
Claudie
Great question! Since one agent = one (or more) API calls, yes, costs do go up. But since each agent handles only a small role, individual costs are low, and the quality improves significantly. It’s a tradeoff.

⚖️ When Should You Use Multi-Agent?

Multi-agent systems aren’t always the answer. Let me break down when to use them and when not to.

When you need multi-agent When a single agent is enough
Complex tasks with clearly separable roles Simple Q&A or straightforward conversion
When different agents need different tools Tasks solvable with 1-2 tools
When quality matters and review steps are needed When speed matters more than quality
When parallel processing can save time When tasks only flow in sequence
Watch the costs! Every agent you add means more API calls. A 3-agent system needs at least 3 LLM calls, and with the orchestrator on top, that’s 4 or more. Only split as much as you actually need.
Siwol
So if I create 3 agents… that’s 3x+ the API cost? And with a manager on top, 4x?!
Claudie
Right, so it’s not about splitting everything — you should always ask “Will splitting this actually improve quality?” first. Using multi-agent for simple tasks just adds cost without any real benefit.
Pro tip: Start with a single agent. When the output quality falls short or you’re cramming too many roles into one prompt, that’s when you split into multi-agent. Scaling gradually saves money and makes debugging easier.

🎯 Key Takeaways

Episode 9 wrap-up — Claudie summarizing the key points of multi-agent systems

Let’s wrap up what we learned about multi-agent systems today:

  1. Role separation is everything — When one agent tries to do it all, things get messy. Split into a team of specialists, and each one can focus on what they do best.
  2. Pick the right pattern for your situation — Sequential (when order matters), Parallel (for simultaneous independent tasks), Orchestrator (when complex coordination is needed).
  3. Remember the cost-quality tradeoff — One agent = one or more API calls. Only split as much as needed, and don’t break apart tasks that a single agent handles just fine.
Claudie
Next up is the grand finale! We’ll combine everything we’ve learned — Agent Loop, System Prompt, MCP, SDK, Multi-Agent — to build your very own AI agent project. A complete recap from Ep1 to Ep9!
Siwol
Oh, the final episode! We finally put it all together and build something?
Claudie
You bet! We’ll bring every concept from all 9 episodes into one complete project. Stay tuned!

References

◀ Previous: Ep8 — Assembling Agents with Claude Agent SDK
▶ Next: Ep10 — Build Your Own AI Agent Project — Hands-on Capstone (coming soon)
📚 View all episodes


Discover more from AI-Girls Lab

Subscribe to get our latest posts delivered to your inbox.


Discover more from AI-Girls Lab

Subscribe now to keep reading and get access to the full archive.

Continue reading