Multi-Agent Systems: Coordination Patterns, Topologies, and Frameworks for LLM Agents

TL;DR — Multi-agent systems: coordination for complex tasks. arXiv 2501.06322: "CAMEL: role-playing framework with cooperating AI agents. MetaGPT: multi-agent collaboration." MDPI Future Internet: "Composing multiple agents into coherent systems introduces orchestration challenges. LLM-based multi-agent orchestration survey." DecodeTheFuture: "Handoff primitive and tracing. Google ADK: A2A-native. LangGraph: supervisor topology. CrewAI: Crews." GuruSup: "6 production-grade frameworks: OpenAI Agents SDK, LangGraph, CrewAI, AutoGen/AG2, Google ADK — each fundamentally different." Adopt AI: "LangGraph, CrewAI/AutoGen, MetaGPT, Semantic Kernel, Agno — simulation to orchestration to workflow automation." Learn more with what is AI agent, build agent, tool loop, and LangChain agent.

MDPI Future Internet frames the challenge: "The proliferation of large language model (LLM) agents has enabled increasingly complex multi-step automation; however, composing multiple agents into coherent systems introduces significant orchestration challenges that remain poorly documented. This survey examines LLM-based multi-agent orchestration."

arXiv 2501.06322 describes the collaborative foundations: "CAMEL provides a role-playing framework where a task-specific agent and two cooperating AI agents (User and Assistant) work to complete tasks via role-based conversations. Similar frameworks like MetaGPT enable multi-agent collaboration."

Multi-Agent Architecture

flowchart TD subgraph User["User Request"] Input["Task Input
complex multi-step goal"] end subgraph Supervisor["Supervisor Topology"] Sup["Supervisor Agent
receives request
analyzes task
delegates subtasks
synthesizes results"] Sup --> W1 Sup --> W2 Sup --> W3 W1 --> Sup W2 --> Sup W3 --> Sup end subgraph Workers["Specialized Worker Agents"] W1["Researcher Agent
tools: web search
memory: research notes"] W2["Coder Agent
tools: code exec
memory: code history"] W3["Reviewer Agent
tools: lint, test
memory: review criteria"] end subgraph Flat["Flat Topology (Alternative)"] A1["Agent A
can call B, C"] A2["Agent B
can call A, C"] A3["Agent C
can call A, B"] A1 <--> A2 A2 <--> A3 A1 <--> A3 end subgraph Sequential["Sequential Pipeline (Alternative)"] S1["Agent 1
research"] --> S2["Agent 2
draft"] S2 --> S3["Agent 3
review"] S3 --> S4["Agent 4
publish"] end subgraph Frameworks["Frameworks"] OpenAI["OpenAI Agents SDK
handoff primitive
built-in tracing"] LangGraph["LangGraph
state graph
supervisor pattern
conditional edges"] CrewAI["CrewAI
role-based crews
sequential/hierarchical"] AutoGen["AutoGen/AG2
conversation-based
code execution"] GoogleADK["Google ADK
A2A-native
agent development kit"] MetaGPT["MetaGPT
role-playing
software engineering"] end Input --> Sup Sup --> Output["Final Answer
synthesized by supervisor"] style Sup fill:#4169E1,color:#fff style W1 fill:#39FF14,color:#000 style W2 fill:#39FF14,color:#000 style W3 fill:#39FF14,color:#000

Topology Comparison

Topology Structure Coordinator Best For Example
Hierarchical Supervisor → workers Supervisor agent Complex tasks needing orchestration LangGraph supervisor
Flat Peer-to-peer None (agents call each other) Collaborative brainstorming AutoGen group chat
Sequential Pipeline (A → B → C) Implicit (order) Linear workflows CrewAI sequential
Parallel Multiple agents simultaneously Merger agent Independent subtasks Fan-out/fan-in
Network Graph with arbitrary edges Conditional routing Complex dependencies LangGraph state graph

Framework Comparison

Framework Topology Key Feature Best For
OpenAI Agents SDK Hierarchical Handoff primitive, tracing Lightweight orchestration
LangGraph Graph-based State graph, conditional edges Complex workflows
CrewAI Sequential/Hierarchical Role-based crews Team workflows
AutoGen/AG2 Flat/Conversation Code execution, group chat Collaborative coding
Google ADK A2A-native Agent-to-agent protocol Google ecosystem
MetaGPT Role-playing Software engineering roles Code generation teams

Implementation

from dataclasses import dataclass
from typing import Optional
from enum import Enum

class Topology(Enum):
    HIERARCHICAL = "hierarchical"
    FLAT = "flat"
    SEQUENTIAL = "sequential"
    PARALLEL = "parallel"
    NETWORK = "network"

@dataclass
class MultiAgentSystemGuide:
    """Multi-agent system implementation guide."""

    def get_supervisor_pattern(self) -> str:
        """Supervisor multi-agent pattern."""
        return (
            "import json\n"
            "from openai import OpenAI\n"
            "\n"
            "client = OpenAI()\n"
            "\n"
            "# Worker agent definitions\n"
            "WORKERS = {\n"
            "    'researcher': {\n"
            "        'system': 'You are a'\n"
            "            ' research agent.'\n"
            "            ' Find information'\n"
            "            ' using search.',\n"
            "        'tools': [\n"
            "            {'type': 'function',\n"
            "             'function': {\n"
            "                'name': 'search',\n"
            "                'description':\n"
            "                    'Search web',\n"
            "                'parameters': {\n"
            "                    'type': 'object',\n"
            "                    'properties': {\n"
            "                        'query': {\n"
            "                            'type': 'string'\n"
            "                        }\n"
            "                    },\n"
            "                    'required': ['query']\n"
            "                }\n"
            "            }}\n"
            "        ]\n"
            "    },\n"
            "    'coder': {\n"
            "        'system': 'You are a'\n"
            "            ' coding agent.'\n"
            "            ' Write and run code.',\n"
            "        'tools': [\n"
            "            {'type': 'function',\n"
            "             'function': {\n"
            "                'name': 'run_code',\n"
            "                'description':\n"
            "                    'Execute code',\n"
            "                'parameters': {\n"
            "                    'type': 'object',\n"
            "                    'properties': {\n"
            "                        'code': {\n"
            "                            'type': 'string'\n"
            "                        }\n"
            "                    },\n"
            "                    'required': ['code']\n"
            "                }\n"
            "            }}\n"
            "        ]\n"
            "    },\n"
            "    'reviewer': {\n"
            "        'system': 'You are a'\n"
            "            ' review agent.'\n"
            "            ' Check code quality',\n"
            "            ' and correctness.',\n"
            "        'tools': []\n"
            "    }\n"
            "}\n"
            "\n"
            "def run_worker(\n"
            "    name: str,\n"
            "    task: str\n"
            ") -> str:\n"
            "    '''Run a worker agent.'''\n"
            "    config = WORKERS[name]\n"
            "    response = client.chat\\\n"
            "        .completions.create(\n"
            "        model='gpt-4o',\n"
            "        messages=[\n"
            "            {'role': 'system',\n"
            "             'content': config[\n"
            "                'system']},\n"
            "            {'role': 'user',\n"
            "             'content': task}\n"
            "        ],\n"
            "        tools=config['tools'])\n"
            "    return response\\\n"
            "        .choices[0].message.content\n"
            "\n"
            "def run_supervisor(\n"
            "    user_request: str,\n"
            "    max_rounds: int = 5\n"
            ") -> str:\n"
            "    '''Supervisor multi-agent.'''\n"
            "    supervisor_prompt = (\n"
            "        'You are a supervisor'\n"
            "        ' agent. Analyze the'\n"
            "        ' task and delegate to'\n"
            "        ' workers: researcher,'\n"
            "        ' coder, reviewer.'\n"
            "        ' Return FINAL ANSWER'\n"
            "        ' when done.'\n"
            "    )\n"
            "    \n"
            "    messages = [\n"
            "        {'role': 'system',\n"
            "         'content':\n"
            "            supervisor_prompt},\n"
            "        {'role': 'user',\n"
            "         'content':\n"
            "            user_request}\n"
            "    ]\n"
            "    \n"
            "    for round_num in range(\n"
            "        max_rounds):\n"
            "        response = client.chat\\\n"
            "            .completions.create(\n"
            "            model='gpt-4o',\n"
            "            messages=messages)\n"
            "        \n"
            "        content = response\\\n"
            "            .choices[0].message\\\n"
            "            .content\n"
            "        \n"
            "        if 'FINAL ANSWER:' in \\\n"
            "            content:\n"
            "            return content.split(\n"
            "                'FINAL ANSWER:')[1]\n"
            "        \n"
            "        # Parse delegation\n"
            "        if 'researcher' in \\\n"
            "            content.lower():\n"
            "            result = run_worker(\n"
            "                'researcher',\n"
            "                content)\n"
            "            messages.append({\n"
            "                'role': 'assistant',\n"
            "                'content': content\n"
            "            })\n"
            "            messages.append({\n"
            "                'role': 'user',\n"
            "                'content':\n"
            "                    f'Researcher: {result}'\n"
            "            })\n"
            "        elif 'coder' in \\\n"
            "            content.lower():\n"
            "            result = run_worker(\n"
            "                'coder',\n"
            "                content)\n"
            "            messages.append({\n"
            "                'role': 'assistant',\n"
            "                'content': content\n"
            "            })\n"
            "            messages.append({\n"
            "                'role': 'user',\n"
            "                'content':\n"
            "                    f'Coder: {result}'\n"
            "            })\n"
            "        elif 'reviewer' in \\\n"
            "            content.lower():\n"
            "            result = run_worker(\n"
            "                'reviewer',\n"
            "                content)\n"
            "            messages.append({\n"
            "                'role': 'assistant',\n"
            "                'content': content\n"
            "            })\n"
            "            messages.append({\n"
            "                'role': 'user',\n"
            "                'content':\n"
            "                    f'Reviewer: {result}'\n"
            "            })\n"
            "    \n"
            "    return 'Max rounds reached'"
        )

    def get_handoff_example(self) -> str:
        """OpenAI Agents SDK handoff."""
        return (
            "from openai import OpenAI\n"
            "\n"
            "client = OpenAI()\n"
            "\n"
            "# OpenAI Agents SDK handoff\n"
            "# Agent A hands off to B\n"
            "# with full context\n"
            "\n"
            "def agent_handoff(\n"
            "    from_agent: str,\n"
            "    to_agent: str,\n"
            "    context: str,\n"
            "    task: str\n"
            ") -> str:\n"
            "    '''Transfer control with\n"
            "    context.'''\n"
            "    handoff_msg = (\n"
            "        f'Transferring from'\n"
            "        f' {from_agent} to'\n"
            "        f' {to_agent}. Context:'\n"
            "        f' {context}. Task: {task}'\n"
            "    )\n"
            "    response = client.chat\\\n"
            "        .completions.create(\n"
            "        model='gpt-4o',\n"
            "        messages=[\n"
            "            {'role': 'system',\n"
            "             'content':\n"
            "                f'You are {to_agent}.'\n"
            "                ' Continue from where'\n"
            "                f' {from_agent} left off.'},\n"
            "            {'role': 'user',\n"
            "             'content': handoff_msg}\n"
            "        ]\n"
            "    )\n"
            "    return response\\\n"
            "        .choices[0].message\\\n"
            "        .content\n"
            "\n"
            "# Chain: researcher → coder\n"
            "# → reviewer\n"
            "research = run_worker(\n"
            "    'researcher',\n"
            "    'Research Python web'\n"
            "    ' frameworks')\n"
            "code = agent_handoff(\n"
            "    'researcher', 'coder',\n"
            "    research,\n"
            "    'Write code based on'\n"
            "    ' research')\n"
            "review = agent_handoff(\n"
            "    'coder', 'reviewer',\n"
            "    code,\n"
            "    'Review the code')"
        )

    def get_coordination_patterns(self) -> dict:
        """Coordination patterns."""
        return {
            "delegation": (
                "Supervisor delegates "
                "subtasks to specialized "
                "workers. Each worker "
                "has own tools and "
                "expertise. Results "
                "returned to supervisor."
            ),
            "handoff": (
                "Agent transfers control "
                "to another agent with "
                "context. OpenAI Agents "
                "SDK: handoff as "
                "first-class primitive "
                "with built-in tracing."
            ),
            "conversation": (
                "Agents communicate via "
                "messages in shared "
                "conversation. AutoGen: "
                "group chat where agents "
                "take turns responding."
            ),
            "pipeline": (
                "Sequential pipeline: "
                "output of one agent "
                "feeds to next. CrewAI: "
                "sequential crew with "
                "ordered tasks."
            ),
            "parallel": (
                "Multiple agents work "
                "simultaneously on "
                "independent subtasks. "
                "Results merged by "
                "supervisor or merger "
                "agent."
            ),
        }

    def get_role_specialization(self) -> dict:
        """Role specialization examples."""
        return {
            "researcher": (
                "Finds information using "
                "web search, databases, "
                "documents. Tools: "
                "search, file_read. "
                "Memory: research notes."
            ),
            "coder": (
                "Writes and executes code. "
                "Tools: code execution, "
                "file_write. Memory: "
                "code history, error "
                "patterns."
            ),
            "reviewer": (
                "Reviews work for quality "
                "and correctness. Tools: "
                "lint, test runner. "
                "Memory: review criteria, "
                "past issues."
            ),
            "planner": (
                "Decomposes complex tasks "
                "into subtasks. Assigns "
                "subtasks to other agents. "
                "No tools — pure reasoning."
            ),
            "critic": (
                "Challenges assumptions "
                "and identifies flaws. "
                "Improves quality through "
                "adversarial feedback. "
                "CAMEL: user-assistant "
                "role-playing."
            ),
        }

    def get_challenges(self) -> dict:
        """Multi-agent challenges."""
        return {
            "orchestration": (
                "Composing agents into "
                "coherent systems is "
                "poorly documented. "
                "MDPI: 'significant "
                "orchestration challenges.'"
            ),
            "communication": (
                "Agents must share context "
                "effectively. Too much = "
                "context overflow. Too "
                "little = lost information."
            ),
            "cost": (
                "Multiple agents = multiple "
                "LLM calls. Token costs "
                "multiply with agent count "
                "and rounds."
            ),
            "debugging": (
                "Hard to trace issues "
                "across agents. Need "
                "tracing (OpenAI SDK) "
                "and logging."
            ),
            "consistency": (
                "Different agents may "
                "produce conflicting "
                "outputs. Need conflict "
                "resolution or voting."
            ),
        }

Multi-Agent System Checklist

  • [ ] Multi-agent system: multiple LLM agents with specialized roles coordinated to solve complex tasks
  • [ ] CAMEL: role-playing framework with task-specific agent and cooperating AI agents (User and Assistant)
  • [ ] MetaGPT: multi-agent collaboration for software engineering
  • [ ] Composing agents into coherent systems introduces significant orchestration challenges
  • [ ] Each agent has own tools, memory, system prompt, and potentially different LLM
  • [ ] Topologies: hierarchical (supervisor-worker), flat (peer-to-peer), sequential (pipeline), parallel (fan-out), network (graph)
  • [ ] Hierarchical: supervisor agent delegates to worker agents, controls flow, synthesizes results
  • [ ] Flat: agents communicate peer-to-peer, no central coordinator, each can call others
  • [ ] Sequential: pipeline where output of one agent feeds to next (CrewAI sequential)
  • [ ] Parallel: multiple agents work simultaneously, results merged by supervisor or merger agent
  • [ ] Network: graph-based with arbitrary connections, conditional routing (LangGraph state graph)
  • [ ] Agent handoffs: transfer control from one agent to another with context
  • [ ] OpenAI Agents SDK: handoff as first-class primitive with built-in tracing
  • [ ] LangGraph: state graph with conditional edges for handoffs
  • [ ] CrewAI: tasks assigned to agents in sequence or hierarchy
  • [ ] AutoGen: conversation-based handoffs between agents in group chat
  • [ ] Coordination patterns: delegation, handoff, conversation, pipeline, parallel
  • [ ] Delegation: supervisor delegates subtasks to specialized workers
  • [ ] Handoff: agent transfers control with context to another agent
  • [ ] Conversation: agents communicate via messages in shared conversation (AutoGen group chat)
  • [ ] Pipeline: sequential — output of one feeds to next (CrewAI sequential crew)
  • [ ] Parallel: multiple agents work simultaneously on independent subtasks
  • [ ] Role specialization: researcher (search), coder (code exec), reviewer (lint/test), planner (reasoning), critic (adversarial)
  • [ ] Six production-grade frameworks: OpenAI Agents SDK, LangGraph, CrewAI, AutoGen/AG2, Google ADK, MetaGPT
  • [ ] OpenAI Agents SDK: handoff primitive, built-in tracing, lightweight orchestration
  • [ ] LangGraph: state graph, supervisor pattern, conditional edges, complex workflows
  • [ ] CrewAI: role-based crews, sequential and hierarchical, team workflows
  • [ ] AutoGen/AG2: conversation-based, code execution, group chat, collaborative coding
  • [ ] Google ADK: A2A-native, agent-to-agent protocol, Google ecosystem
  • [ ] MetaGPT: role-playing, software engineering focus, code generation teams
  • [ ] Other frameworks: Semantic Kernel, Agno, Ray — simulation to orchestration to workflow automation
  • [ ] Supervisor pattern: supervisor receives request, analyzes, delegates, workers execute, supervisor synthesizes
  • [ ] Supervisor pattern: LangGraph supervisor as graph node with conditional edges to worker nodes
  • [ ] Supervisor pattern: CrewAI manager agent with crew of specialized agents
  • [ ] Supervisor pattern: OpenAI supervisor with handoff to specialized agents
  • [ ] Challenges: orchestration (poorly documented), communication (context sharing), cost (multiple LLM calls), debugging (tracing), consistency (conflicting outputs)
  • [ ] Mitigations: tracing (OpenAI SDK), logging, context packaging for handoffs, budget limits, conflict resolution
  • [ ] Read what is AI agent for agent architecture
  • [ ] Read build agent for single agent implementation
  • [ ] Read tool loop for ReAct pattern
  • [ ] Read LangChain agent for LangGraph
  • [ ] Test: supervisor delegates to correct worker based on task
  • [ ] Test: handoff transfers context correctly between agents
  • [ ] Test: sequential pipeline produces correct output chain
  • [ ] Test: parallel agents complete independent subtasks
  • [ ] Test: max_rounds prevents infinite delegation loops
  • [ ] Test: tracing captures all agent interactions for debugging
  • [ ] Test: cost tracking monitors token usage across all agents
  • [ ] Document topology, roles, handoff mechanism, max_rounds, and framework choice

FAQ

What is a multi-agent system in LLM applications?

A multi-agent system coordinates multiple LLM agents with specialized roles to solve complex tasks through communication and collaboration. arXiv 2501.06322: "CAMEL provides a role-playing framework where a task-specific agent and two cooperating AI agents (User and Assistant) work to complete tasks via role-based conversations. Similar frameworks like MetaGPT enable multi-agent collaboration." MDPI Future Internet: "The proliferation of LLM agents has enabled complex multi-step automation; however, composing multiple agents into coherent systems introduces significant orchestration challenges that remain poorly documented. This survey examines LLM-based multi-agent orchestration." DecodeTheFuture: "Handoff primitive and built-in tracing for agent transitions. Google ADK: A2A-native multi-agent framework. LangGraph: supervisor multi-agent tutorial. CrewAI: Crews documentation." Multi-agent: (1) Multiple agents with distinct roles. (2) Structured communication between agents. (3) Coordination via orchestration layer. (4) Each agent may have own tools, memory, and LLM. (5) Collaborate to solve tasks too complex for single agent.

What are the topologies for multi-agent systems?

Common topologies include hierarchical (supervisor-worker), flat (peer-to-peer), and network (graph-based). DecodeTheFuture: "LangGraph supervisor multi-agent tutorial — reference implementation of the supervisor topology. Handoff primitive and built-in tracing for agent transitions." GuruSup: "Building a multi-agent system in 2025 means choosing between at least six production-grade frameworks, each with a fundamentally different approach: OpenAI Agents SDK, LangGraph, CrewAI, AutoGen/AG2, Google ADK." Topologies: (1) Hierarchical: supervisor agent delegates to worker agents. Supervisor controls flow, workers execute tasks. LangGraph supervisor pattern. (2) Flat: agents communicate peer-to-peer. No central coordinator. Each agent can call others. (3) Network: graph-based with arbitrary connections. Agents hand off to specific next agents. (4) Sequential: pipeline where output of one agent feeds to next. (5) Parallel: multiple agents work simultaneously, results merged.

How do agent handoffs work in multi-agent systems?

Agent handoffs transfer control from one agent to another with context. DecodeTheFuture: "Handoff primitive and built-in tracing for agent transitions. OpenAI Agents SDK provides handoff as core primitive." Adopt AI: "Leading 2025 frameworks — LangChain/LangGraph, CrewAI/AutoGen, MetaGPT, Semantic Kernel, Agno — cover diverse needs from simulation to AI orchestration and workflow automation." Handoff mechanism: (1) Agent A completes its task or determines another agent is needed. (2) Agent A packages context (task state, results, instructions). (3) Control transfers to Agent B with packaged context. (4) Agent B processes and may hand off to Agent C or return to Agent A. (5) OpenAI Agents SDK: handoff as first-class primitive with tracing. (6) LangGraph: state graph with conditional edges for handoffs. (7) CrewAI: tasks assigned to agents in sequence or hierarchy. (8) AutoGen: conversation-based handoffs between agents.

What are the best multi-agent frameworks in 2026?

Six production-grade frameworks: OpenAI Agents SDK, LangGraph, CrewAI, AutoGen/AG2, Google ADK, and MetaGPT. GuruSup: "Compare 6 leading multi-agent frameworks: OpenAI Agents SDK, LangGraph, CrewAI, AutoGen/AG2, Google ADK. Each with fundamentally different approach." Adopt AI: "Leading 2025 frameworks — LangChain/LangGraph, CrewAI/AutoGen, MetaGPT, Semantic Kernel, Agno — cover diverse needs from simulation to AI orchestration and workflow automation." DecodeTheFuture: "OpenAI Agents SDK: handoff primitive and tracing. Google ADK: A2A-native. LangGraph: supervisor topology. CrewAI: Crews." Frameworks: (1) OpenAI Agents SDK: handoff primitive, built-in tracing, lightweight. (2) LangGraph: state graph, supervisor pattern, conditional edges. (3) CrewAI: role-based crews, sequential and hierarchical. (4) AutoGen/AG2: conversation-based, code execution. (5) Google ADK: A2A-native, agent development kit. (6) MetaGPT: role-playing, software engineering focus.

How do you implement a supervisor multi-agent pattern?

Use a supervisor agent that delegates to specialized worker agents based on task requirements. DecodeTheFuture: "LangGraph supervisor multi-agent tutorial — reference implementation of the supervisor topology." MDPI Future Internet: "Composing multiple agents into coherent systems introduces orchestration challenges. LLM-based multi-agent orchestration survey." arXiv 2501.06322: "CAMEL: role-playing framework with task-specific agent and cooperating AI agents. MetaGPT: multi-agent collaboration." Supervisor pattern: (1) Supervisor agent receives user request. (2) Supervisor analyzes task and determines which worker agents to invoke. (3) Supervisor delegates subtasks to specialized workers (e.g., researcher, coder, reviewer). (4) Workers execute subtasks using their tools and expertise. (5) Workers return results to supervisor. (6) Supervisor evaluates results, may delegate more or synthesize final answer. (7) If task incomplete, supervisor iterates. (8) LangGraph: supervisor as graph node with conditional edges to worker nodes. (9) CrewAI: manager agent with crew of specialized agents. (10) OpenAI: supervisor with handoff to specialized agents.


Want a self-hosted AI company brain that does all of this out of the box?
Book a demo →