Lesson 1 of 6·10 min read

Multi-Agent Architecture in n8n

A single AI agent quickly reaches its limits — complex tasks require specialization. Multi-agent systems solve this problem by orchestrating multiple focused agents that collaborate. n8n, with its sub-workflows, webhooks, and flexible data processing, provides the ideal platform for this.

The Orchestrator Pattern

The most common multi-agent pattern is the Orchestrator Pattern: A central agent (the orchestrator) coordinates specialized sub-agents and aggregates their results.

                    ┌─────────────────┐
                    │   Orchestrator   │
                    │   (Main Workflow) │
                    └────────┬────────┘
                             │
              ┌──────────────┼──────────────┐
              ▼              ▼              ▼
     ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
     │  Researcher   │ │   Writer     │ │  Reviewer    │
     │  Agent        │ │   Agent      │ │  Agent       │
     │ (Sub-Workflow)│ │ (Sub-Workflow)│ │ (Sub-Workflow)│
     └──────────────┘ └──────────────┘ └──────────────┘

Why Sub-Workflows?

n8n sub-workflows are perfect for multi-agent systems:

AdvantageDescription
IsolationEach agent runs in its own context — errors stay local
ReusabilityAn agent can be used in multiple orchestrators
ScalingSub-workflows can be scaled independently
TestabilityEach agent is individually testable
VersioningAgents can be updated independently

Agent Communication via Webhooks

For asynchronous agent communication, use webhook triggers:

  • Synchronous: The orchestrator calls sub-workflows directly and waits for the result
  • Asynchronous: Agents communicate via webhook endpoints — ideal for long-running tasks
  • Event-based: Agents publish events, other agents react to them

Synchronous Call (Default)

{
  "nodes": [
    { "type": "n8n-nodes-base.executeWorkflow", "parameters": { "workflowId": "researcher-agent", "mode": "each" } },
    { "type": "n8n-nodes-base.executeWorkflow", "parameters": { "workflowId": "writer-agent", "mode": "each" } }
  ]
}

Asynchronous Call (Webhooks)

{
  "nodes": [
    { "type": "n8n-nodes-base.httpRequest", "parameters": { "url": "https://n8n.example.com/webhook/researcher", "method": "POST" } }
  ]
}

Shared State Management

Multi-agent systems need shared state. In n8n, there are three strategies:

StrategyUse CaseTool
Workflow variablesShort-lived state within an executionn8n Static Data
DatabasePersistent state across executionsPostgreSQL / Supabase
RedisFast, ephemeral state for real-time coordinationRedis Node

Practical tip: Start with the synchronous orchestrator pattern and simple PostgreSQL state. Only switch to webhooks and Redis when latency requirements demand it. Simplicity beats elegance in production.

📝

Quiz

Question 1 of 3

Welches Architektur-Pattern wird am häufigsten für Multi-Agent-Systeme in n8n verwendet?