AutomationFlowsAI & RAG › Complexity-002: Deep Nested Branching (5+ Levels)

Complexity-002: Deep Nested Branching (5+ Levels)

COMPLEXITY-002: Deep nested branching (5+ levels). Uses agent. Webhook trigger; 14 nodes.

Webhook trigger★★★★☆ complexityAI-powered14 nodesAgent
AI & RAG Trigger: Webhook Nodes: 14 Complexity: ★★★★☆ AI nodes: yes Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "COMPLEXITY-002: Deep nested branching (5+ levels)",
  "nodes": [
    {
      "id": "n1",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        0
      ]
    },
    {
      "id": "n2",
      "name": "IF Level 1",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        200,
        0
      ]
    },
    {
      "id": "n3",
      "name": "IF Level 2a",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        400,
        -150
      ]
    },
    {
      "id": "n4",
      "name": "IF Level 2b",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        400,
        150
      ]
    },
    {
      "id": "n5",
      "name": "IF Level 3a",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        600,
        -250
      ]
    },
    {
      "id": "n6",
      "name": "IF Level 3b",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        600,
        -50
      ]
    },
    {
      "id": "n7",
      "name": "IF Level 3c",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        600,
        50
      ]
    },
    {
      "id": "n8",
      "name": "IF Level 3d",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        600,
        250
      ]
    },
    {
      "id": "n9",
      "name": "Switch Level 4",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3,
      "position": [
        800,
        -300
      ]
    },
    {
      "id": "n10",
      "name": "IF Level 5",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        1000,
        -400
      ]
    },
    {
      "id": "n11",
      "name": "Agent A",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.6,
      "position": [
        1200,
        -450
      ]
    },
    {
      "id": "n12",
      "name": "Agent B",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.6,
      "position": [
        1200,
        -350
      ]
    },
    {
      "id": "n13",
      "name": "Code 1",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        800,
        300
      ]
    },
    {
      "id": "n14",
      "name": "Merge All",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3,
      "position": [
        1400,
        0
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "IF Level 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF Level 1": {
      "main": [
        [
          {
            "node": "IF Level 2a",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "IF Level 2b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF Level 2a": {
      "main": [
        [
          {
            "node": "IF Level 3a",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "IF Level 3b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF Level 2b": {
      "main": [
        [
          {
            "node": "IF Level 3c",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "IF Level 3d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF Level 3a": {
      "main": [
        [
          {
            "node": "Switch Level 4",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Merge All",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch Level 4": {
      "main": [
        [
          {
            "node": "IF Level 5",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Merge All",
            "type": "main",
            "index": 1
          }
        ],
        [
          {
            "node": "Merge All",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "IF Level 5": {
      "main": [
        [
          {
            "node": "Agent A",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Agent B",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Agent A": {
      "main": [
        [
          {
            "node": "Merge All",
            "type": "main",
            "index": 3
          }
        ]
      ]
    },
    "Agent B": {
      "main": [
        [
          {
            "node": "Merge All",
            "type": "main",
            "index": 4
          }
        ]
      ]
    },
    "IF Level 3d": {
      "main": [
        [
          {
            "node": "Code 1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Merge All",
            "type": "main",
            "index": 5
          }
        ]
      ]
    },
    "Code 1": {
      "main": [
        [
          {
            "node": "Merge All",
            "type": "main",
            "index": 6
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

COMPLEXITY-002: Deep nested branching (5+ levels). Uses agent. Webhook trigger; 14 nodes.

Source: https://github.com/Pisama-AI/pisama-n8n/blob/main/server/tests/fixtures/complexity/02-COMPLEXITY-deep-branching.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

VEP WAPP. Uses openAi, lmChatOpenAi, toolCalculator, agent. Webhook trigger; 100 nodes.

OpenAI, OpenAI Chat, Tool Calculator +7
AI & RAG

⏺ 🚀 How it works

Agent, Anthropic Chat, Output Parser Structured +6
AI & RAG

L&D_AgentsAI_ATIVO. Uses httpRequest, agent, googleCalendarTool, toolSerpApi. Webhook trigger; 93 nodes.

HTTP Request, Agent, Google Calendar Tool +9
AI & RAG

Are you drowning in daily operational chaos, desperately trying to juggle sales, projects, content, and client communication? Imagine an AI brain that handles it all, freeing you to lead your business

Telegram Trigger, Telegram, OpenAI +13
AI & RAG

AI Customer Service Automation - Portfolio. Uses googleSheets, httpRequest, agent, memoryBufferWindow. Webhook trigger; 91 nodes.

Google Sheets, HTTP Request, Agent +9