AutomationFlowsAI & RAG › Optimize Speed-critical Workflows Using Parallel Processing (fan-out/fan-in)

Optimize Speed-critical Workflows Using Parallel Processing (fan-out/fan-in)

Original n8n title: 🎓 Optimize Speed-critical Workflows Using Parallel Processing (fan-out/fan-in)

ByLucas Peyrin @lucaspeyrin on n8n.io

This template is a hands-on tutorial for one of the most advanced and powerful patterns in n8n: asynchronous parallel processing, also known as the Fan-Out/Fan-In model.

Event trigger★★★★★ complexityAI-powered34 nodesExecute Workflow TriggerGoogle Gemini ChatAgentHTTP Request
AI & RAG Trigger: Event Nodes: 34 Complexity: ★★★★★ AI nodes: yes Added:

This workflow corresponds to n8n.io template #6247 — we link there as the canonical source.

This workflow follows the Agent → Execute Workflow Trigger recipe pattern — see all workflows that pair these two integrations.

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
{
  "nodes": [
    {
      "id": "4874de87-f4b3-4dcb-be6a-ec0ea173556e",
      "name": "Start Project",
      "type": "n8n-nodes-base.manualTrigger",
      "notes": "\u00a9 2025 Lucas Peyrin",
      "position": [
        -32,
        336
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "ead45d6b-0a3a-403a-b296-c79919b2d0e6",
      "name": "The Dispatcher",
      "type": "n8n-nodes-base.switch",
      "notes": "\u00a9 2025 Lucas Peyrin",
      "position": [
        768,
        1136
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "write_description",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "9ba4d141-2f64-4b74-8e72-a3da836e3f8f",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.process }}",
                    "rightValue": "write_description"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "write_ad_copy",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "88b909d3-9bc2-4ae8-841d-58b88df591ef",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.process }}",
                    "rightValue": "write_ad_copy"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "write_email",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "664df8e3-81f2-43e6-b852-c02693fa6ef2",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.process }}",
                    "rightValue": "write_email"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "5d94fef2-21a8-43a2-bacc-68bc91b3abfa",
      "name": "Split Out Tasks",
      "type": "n8n-nodes-base.splitOut",
      "notes": "\u00a9 2025 Lucas Peyrin",
      "position": [
        528,
        336
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "tasks"
      },
      "typeVersion": 1
    },
    {
      "id": "7d3bd8e3-f08d-4b36-8ff6-91c87ec038cf",
      "name": "The Project Brief",
      "type": "n8n-nodes-base.set",
      "notes": "\u00a9 2025 Lucas Peyrin",
      "position": [
        304,
        336
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "550d27f1-bb91-4290-ab17-f055d08920be",
              "name": "tasks",
              "type": "array",
              "value": "=[{\"process\":\"write_description\",\"data\":{\"product\":\"Super Widget\"}},{\"process\":\"write_ad_copy\",\"data\":{\"product\":\"Super Widget\",\"tone\":\"Excited\"}},{\"process\":\"write_email\",\"data\":{\"product\":\"Super Widget\",\"audience\":\"Tech CEOs\"}}]"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "60c585a9-e57d-44e0-af5b-44462258cfd5",
      "name": "Wait for All Teams to Finish",
      "type": "n8n-nodes-base.wait",
      "notes": "\u00a9 2025 Lucas Peyrin",
      "position": [
        1344,
        336
      ],
      "parameters": {
        "resume": "webhook",
        "options": {},
        "httpMethod": "POST"
      },
      "executeOnce": true,
      "typeVersion": 1.1
    },
    {
      "id": "50394806-0236-4496-87ff-1837e3962a52",
      "name": "Assign Tasks to Teams",
      "type": "n8n-nodes-base.executeWorkflow",
      "notes": "\u00a9 2025 Lucas Peyrin",
      "position": [
        880,
        336
      ],
      "parameters": {
        "options": {
          "waitForSubWorkflow": false
        },
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $workflow.id }}"
        },
        "workflowInputs": {
          "value": {
            "data": "={{ $json.data }}",
            "status": "initialise",
            "process": "={{ $json.process }}",
            "resume_url": "={{ $execution.resumeUrl }}",
            "main_execution_id": "={{ $execution.id }}"
          },
          "schema": [
            {
              "id": "main_execution_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "main_execution_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "process",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "process",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "data",
              "type": "object",
              "display": true,
              "required": false,
              "displayName": "data",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "status",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "resume_url",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "resume_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        }
      },
      "typeVersion": 1.2,
      "alwaysOutputData": true
    },
    {
      "id": "054e1859-19d7-4a19-aa2f-1fc90d0f3645",
      "name": "Receive Work Order",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "notes": "\u00a9 2025 Lucas Peyrin",
      "position": [
        320,
        1344
      ],
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "main_execution_id"
            },
            {
              "name": "process"
            },
            {
              "name": "data",
              "type": "object"
            },
            {
              "name": "status"
            },
            {
              "name": "resume_url"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "7e67a781-3112-47b7-b86d-f1400c51578e",
      "name": "The AI Specialist",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "notes": "\u00a9 2025 Lucas Peyrin",
      "position": [
        1168,
        1520
      ],
      "parameters": {
        "options": {
          "temperature": 0
        },
        "modelName": "models/gemini-flash-lite-latest"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f1d64426-b1d7-47b7-91ae-e9e69a15b468",
      "name": "Description Team",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "notes": "\u00a9 2025 Lucas Peyrin",
      "position": [
        1072,
        960
      ],
      "parameters": {
        "text": "=Write a product description for: {{$json.data.product}}",
        "options": {
          "systemMessage": "No preamble. Just what you're asked for."
        },
        "promptType": "define"
      },
      "typeVersion": 2.1
    },
    {
      "id": "037ec2b0-0375-46da-b2b1-d24be3255909",
      "name": "Ad Copy Team",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "notes": "\u00a9 2025 Lucas Peyrin",
      "position": [
        1072,
        1152
      ],
      "parameters": {
        "text": "=Write ad copy for: {{$json.data.product}}. The tone should be: {{$json.data.tone}}",
        "options": {
          "systemMessage": "No preamble. Just what you're asked for."
        },
        "promptType": "define"
      },
      "typeVersion": 2.1
    },
    {
      "id": "a1e5689a-92c6-41eb-9bf6-ac660bb51155",
      "name": "Email Team",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "notes": "\u00a9 2025 Lucas Peyrin",
      "position": [
        1072,
        1344
      ],
      "parameters": {
        "text": "=Write a cold email about {{$json.data.product}} for the following audience: {{$json.data.audience}}",
        "options": {
          "systemMessage": "No preamble. Just what you're asked for."
        },
        "promptType": "define"
      },
      "typeVersion": 2.1
    },
    {
      "id": "a2c93cb6-a9cd-4757-b07c-8b9f7dfcd762",
      "name": "Report Back to Manager",
      "type": "n8n-nodes-base.executeWorkflow",
      "notes": "\u00a9 2025 Lucas Peyrin",
      "position": [
        1536,
        1152
      ],
      "parameters": {
        "mode": "each",
        "options": {
          "waitForSubWorkflow": false
        },
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $workflow.id }}"
        },
        "workflowInputs": {
          "value": {
            "data": "={{ $json }}",
            "status": "completed",
            "process": "={{ $('Receive Work Order').last().json.process }}",
            "main_execution_id": "={{ $('Receive Work Order').last().json.main_execution_id }}"
          },
          "schema": [
            {
              "id": "main_execution_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "main_execution_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "process",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "process",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "data",
              "type": "object",
              "display": true,
              "required": false,
              "displayName": "data",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "status",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "resume_url",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "resume_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "253832f6-85b3-40c5-96fc-0c31aacd884d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        208,
        0
      ],
      "parameters": {
        "color": 7,
        "width": 1904,
        "height": 544,
        "content": "## The Main Workflow (The Project Manager)\n\nThis top flow is the **Project Manager**. Its only job is to start the project, assign the tasks, and wait for all the teams to report back that their work is complete."
      },
      "typeVersion": 1
    },
    {
      "id": "d36d7175-3f68-4c29-857a-1cfebb38905c",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        208,
        576
      ],
      "parameters": {
        "color": 7,
        "width": 1600,
        "height": 1680,
        "content": "## The Sub-Workflow (The Specialist Teams)\n\nThis bottom flow represents the **Specialist Teams**. It receives a single work order, does the job, and reports its status back to the Project Dashboard."
      },
      "typeVersion": 1
    },
    {
      "id": "d253701b-c094-419b-995f-fc6db53082dd",
      "name": "The Project Dashboard (Code)",
      "type": "n8n-nodes-base.code",
      "notes": "\u00a9 2025 Lucas Peyrin",
      "position": [
        768,
        1872
      ],
      "parameters": {
        "jsCode": "// This node is the brain of the whole operation.\n// It uses Static Data, which is like a shared whiteboard for the workflow.\n\n// Get the shared whiteboard data.\nconst staticData = $getWorkflowStaticData('global');\nif (!staticData.projects) {\n  staticData.projects = {};\n}\n\n// Get the status from the incoming item.\nconst status = $json.status;\n\n// --- CASE 1: A new project is starting --- //\nif (status === 'initialise') {\n  const mainId = $json.main_execution_id;\n  const resumeUrl = $json.resume_url;\n  const tasksToRun = $input.all();\n\n  // Create a new section on our dashboard for this project.\n  staticData.projects[mainId] = {\n    resumeUrl: resumeUrl,\n    tasks: {}\n  };\n\n  // Add each task to the dashboard with a 'pending' status and start time.\n  for (const task of tasksToRun) {\n    const processName = task.json.process;\n    staticData.projects[mainId].tasks[processName] = {\n      status: 'pending',\n      startTime: new Date().toISOString()\n    };\n  }\n  console.log(`Project ${mainId} initialized with ${tasksToRun.length} tasks.`);\n\n  // Send the tasks out to the specialist teams.\n  return tasksToRun;\n}\n\n// --- CASE 2: A specialist team has finished a task --- //\nif (status === 'completed') {\n  const mainId = $json.main_execution_id;\n  const completedProcess = $json.process;\n  const resultData = $json.data;\n  const projectDashboard = staticData.projects[mainId];\n\n  if (!projectDashboard) {\n    console.log(`No dashboard found for mainId: ${mainId}.`);\n    return []; // Stop if the project doesn't exist.\n  }\n\n  // Update the task on the dashboard.\n  const task = projectDashboard.tasks[completedProcess];\n  task.status = 'completed';\n  task.endTime = new Date().toISOString();\n  task.result = resultData;\n  // Calculate duration in seconds\n  const durationMs = new Date(task.endTime) - new Date(task.startTime);\n  task.duration_seconds = parseFloat((durationMs / 1000).toFixed(2));\n\n  console.log(`Task ${completedProcess} for project ${mainId} marked as completed in ${task.duration_seconds}s.`);\n\n  // Check if ALL tasks on the dashboard are now 'completed'.\n  const allDone = Object.values(projectDashboard.tasks).every(t => t.status === 'completed');\n\n  if (allDone) {\n    console.log(`All tasks for project ${mainId} are done. Resuming main workflow.`);\n    const resumeUrl = projectDashboard.resumeUrl;\n    const finalResponse = projectDashboard.tasks;\n\n    // Clean up the dashboard for this project.\n    delete staticData.projects[mainId];\n\n    // Return a special item that will trigger the 'Resume Parent Workflow' node.\n    return [{\n      json: {\n        end_process: true,\n        resume_url: resumeUrl,\n        response: finalResponse\n      }\n    }];\n  }\n\n  // If not all tasks are done, we do nothing and wait for the next team to report back.\n  return [];\n}\n\n// By default, if the status is not 'initialise' or 'completed', do nothing.\nreturn [];"
      },
      "typeVersion": 2
    },
    {
      "id": "07e02a44-b6fb-4ef4-8e6b-8824d52a644f",
      "name": "Start Process",
      "type": "n8n-nodes-base.executeWorkflow",
      "notes": "\u00a9 2025 Lucas Peyrin",
      "position": [
        1568,
        2048
      ],
      "parameters": {
        "mode": "each",
        "options": {
          "waitForSubWorkflow": false
        },
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $workflow.id }}"
        },
        "workflowInputs": {
          "value": {
            "data": "={{ $json.data }}",
            "status": "pending",
            "process": "={{ $json.process }}",
            "main_execution_id": "={{ $json.main_execution_id }}"
          },
          "schema": [
            {
              "id": "main_execution_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "main_execution_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "process",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "process",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "data",
              "type": "object",
              "display": true,
              "required": false,
              "displayName": "data",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "status",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "835d363e-ea52-4ecd-9117-b0f43b1efade",
      "name": "Check Work Order Status",
      "type": "n8n-nodes-base.if",
      "notes": "\u00a9 2025 Lucas Peyrin",
      "position": [
        544,
        1344
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "bed89853-0399-4038-8650-5d578d34e5fb",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "pending"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "04ce6cc3-614c-4f96-96a6-785de4e6dd48",
      "name": "Is Project Complete?",
      "type": "n8n-nodes-base.if",
      "notes": "\u00a9 2025 Lucas Peyrin",
      "position": [
        1168,
        1872
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "aab184da-7adb-4008-9ccd-99152b55e837",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.end_process }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "ff3cdc85-021a-45df-9648-96d504990abd",
      "name": "Resume Parent Workflow",
      "type": "n8n-nodes-base.httpRequest",
      "notes": "\u00a9 2025 Lucas Peyrin",
      "position": [
        1568,
        1664
      ],
      "parameters": {
        "url": "={{ $json.resume_url }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ $json.response }}",
        "sendBody": true,
        "specifyBody": "json"
      },
      "typeVersion": 4.2
    },
    {
      "id": "5969807b-cf5b-46bd-8b43-25f819f4b844",
      "name": "Project Complete!",
      "type": "n8n-nodes-base.set",
      "notes": "\u00a9 2025 Lucas Peyrin",
      "position": [
        1808,
        336
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "c8f45ef6-748c-42e0-937b-48766f039259",
              "name": "email",
              "type": "string",
              "value": "={{ $json.body.write_email.result.output }}"
            },
            {
              "id": "c3db0b0f-86c6-4de3-980d-f3d8570b132b",
              "name": "ad_copy",
              "type": "string",
              "value": "={{ $json.body.write_ad_copy.result.output }}"
            },
            {
              "id": "d6894be9-9835-41dd-8cec-e40044b84d2e",
              "name": "description",
              "type": "string",
              "value": "={{ $json.body.write_description.result.output }}"
            },
            {
              "id": "e7f8a9b0-c1d2-e3f4-a5b6-c7d8e9f0a1b2",
              "name": "seconds_saved",
              "type": "number",
              "value": "={{ $json.body.values().map(item => item.duration_seconds).sum() - $json.body.values().map(item => item.duration_seconds).max() }}"
            },
            {
              "id": "5477e4af-b915-4129-b573-5c35ea15aa08",
              "name": "task_duration_seconds",
              "type": "number",
              "value": "={{ $json.body.values().map(item => item.duration_seconds).max() }}"
            },
            {
              "id": "bb5305a7-1d69-4d68-8610-500e19a947e4",
              "name": "task_duration_without_parallelisation",
              "type": "number",
              "value": "={{ $json.body.values().map(item => item.duration_seconds).sum() }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "26a55dde-97c5-4015-83f7-052f1367349a",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        112
      ],
      "parameters": {
        "color": 7,
        "width": 448,
        "height": 400,
        "content": "### The Project Brief\n\nThis node defines all the independent tasks we need to accomplish for this project. Each task has a `process` name and the `data` it needs."
      },
      "typeVersion": 1
    },
    {
      "id": "2e491b78-18ca-48df-adde-a95ae396a580",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        704,
        112
      ],
      "parameters": {
        "color": 7,
        "width": 448,
        "height": 400,
        "content": "### Assign Tasks (Fan-Out)\n\nThis is the **Fan-Out** moment. This node calls our sub-workflow for each task.\n\n**Crucial Setting:** `Wait for Sub-Workflow` is **OFF**. This means the main workflow doesn't wait. It fires off all the tasks and immediately moves to the `Wait` node."
      },
      "typeVersion": 1
    },
    {
      "id": "aa86ef59-70f4-46be-8a04-689cff0dbf15",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1168,
        112
      ],
      "parameters": {
        "color": 7,
        "width": 448,
        "height": 400,
        "content": "### Wait for Completion (Pause)\n\nThis node **pauses** the main workflow indefinitely. It's the Project Manager waiting in their office.\n\nIt will only resume when another node (in our case, the `Resume Parent Workflow` node) makes a `POST` request to its unique `resume_url`."
      },
      "typeVersion": 1
    },
    {
      "id": "8a7ca4a6-c96a-4dbb-93fd-ee880b2fb69c",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1632,
        112
      ],
      "parameters": {
        "color": 7,
        "width": 448,
        "height": 400,
        "content": "### Project Complete! (Fan-In)\n\nThis is the **Fan-In** moment. This node only runs *after* the `Wait` node has been resumed.\n\nIt receives the final, aggregated data from all the parallel tasks and can now continue with the rest of the workflow."
      },
      "typeVersion": 1
    },
    {
      "id": "d0300f28-73e8-4cae-a330-6f3c7bf99012",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        1184
      ],
      "parameters": {
        "color": 7,
        "height": 336,
        "content": "### Receive Work Order\n\nThis is the entry point for the Specialist Teams. It receives a single task from the main workflow."
      },
      "typeVersion": 1
    },
    {
      "id": "b81022c1-7aa2-4f85-b179-ec4d042eab70",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        672,
        992
      ],
      "parameters": {
        "color": 4,
        "width": 288,
        "height": 336,
        "content": "### The Dispatcher\n\nThis Switch node acts as a dispatcher, sending the work order to the correct Specialist Team based on the `process` name."
      },
      "typeVersion": 1
    },
    {
      "id": "389ca11b-3bd4-4ec2-aa2d-3e6be5862697",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1008,
        800
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 848,
        "content": "### The Specialist Teams\n\nThese three Agent nodes represent the different teams doing the actual work. In a real-world scenario, these could be complex sub-workflows themselves."
      },
      "typeVersion": 1
    },
    {
      "id": "26073c89-a928-4a4e-a132-24fa0972255a",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1440,
        944
      ],
      "parameters": {
        "color": 7,
        "width": 288,
        "height": 384,
        "content": "### Report Back to Manager\n\nThis node doesn't talk to the main workflow directly. Instead, it calls the sub-workflow *again*, but this time with a `status` of `completed`. This is the signal for the Project Dashboard to update."
      },
      "typeVersion": 1
    },
    {
      "id": "b115e3a8-d0b5-496d-ba05-738796debf06",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        1552
      ],
      "parameters": {
        "color": 6,
        "width": 480,
        "height": 512,
        "content": "### The Project Dashboard (Code)\n\nThis is the most important node. It acts as the central brain and state manager for the entire operation, using **Static Data** as a shared whiteboard.\n\nIt handles two cases:\n1.  **`status: 'initialise'`:** When a new project starts, it creates a new entry on the dashboard and lists all tasks as 'pending'.\n2.  **`status: 'completed'`:** When a team reports back, it updates that task's status on the dashboard. It then checks if *all* tasks are complete. If they are, it triggers the `Resume Parent Workflow` node."
      },
      "typeVersion": 1
    },
    {
      "id": "fdaa6663-f551-444d-9c87-d6bc0ac1e518",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1456,
        1456
      ],
      "parameters": {
        "color": 7,
        "width": 320,
        "height": 368,
        "content": "### Resume Parent Workflow\n\nThis node is only triggered when the Project Dashboard confirms all tasks are complete. It makes a `POST` request to the `Wait` node's unique URL, sending the final results and waking up the main workflow."
      },
      "typeVersion": 1
    },
    {
      "id": "7b904616-c328-4381-9d9a-17708af4f1cd",
      "name": "Sticky Note16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        704
      ],
      "parameters": {
        "color": 4,
        "width": 496,
        "height": 816,
        "content": "### Alternative Architecture\n\nFor even more complex projects, you could replace this Switch node with a more modular design:\n\n- Each \"Team\" (Description, Ad Copy, etc.) could be its own separate, dedicated workflow.\n- The main workflow would call the correct workflow based on the `process` name (that could be a workflow id).\n- A single, separate \"Status Handler\" workflow would manage the Project Dashboard logic, called by each team when they finish."
      },
      "typeVersion": 1
    },
    {
      "id": "530e4eb9-af73-46f1-af63-7332d1442b94",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1456,
        1840
      ],
      "parameters": {
        "color": 7,
        "width": 320,
        "height": 384,
        "content": "### Start Specialit Teams\n\nThis node doesn't talk to the main workflow directly. Instead, it calls the sub-workflow *again*, but this time with a `status` of `pending`. This is the signal for the Teams to start. This could be replaced with calling specific sub workflows for each task."
      },
      "typeVersion": 1
    },
    {
      "id": "c5b7742a-f636-484c-ac43-2d878a7cd21d",
      "name": "Sticky Note17",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -496,
        -256
      ],
      "parameters": {
        "width": 576,
        "height": 728,
        "content": "## \u26a1\ufe0f Optimize Speed-Critical Workflows Using Parallel Processing (Fan-Out/Fan-In)\n\nStop letting sequential bottlenecks slow you down. This advanced template implements the architectural \"Fan-Out/Fan-In\" pattern to execute multiple complex operations simultaneously, ensuring your automations scale effortlessly while drastically reducing total execution time.\n\n**How it works:**\n*   **The Dispatcher:** A central \"Project Dashboard\" (Code node) initializes the job and splits the workload into independent tasks (Fan-Out).\n*   **Parallel Execution:** Specialized AI agents (Description, Ad Copy, Email) process their specific tasks at the exact same time, rather than one after another.\n*   **Smart Aggregation:** As each branch finishes, it reports back to the manager; the workflow waits until *all* parallel tasks are complete before aggregating the results (Fan-In) and resuming the main process.\n\n---\n\n### Automate your operations today\nYour time is valuable. Let us automate the boring stuff for you.\n\n**\ud83d\udc47 CHOOSE YOUR PATH:**\n\n[ **\u26a1\ufe0f I WANT A FREE AUDIT (2 min)** ](https://workflows.ac/audit?utm_source=n8n_template&utm_medium=workflow_note&utm_campaign=optimize_speed_critical_workflows_using_parallel_processing_fan_out_fan_in&utm_content=6247)\n> *We've put our heart into this business evaluation machine.*\n\n[ **\ud83d\udca1 I HAVE A SPECIFIC REQUEST** ](https://workflows.ac/form?utm_source=n8n_template&utm_medium=workflow_note&utm_campaign=optimize_speed_critical_workflows_using_parallel_processing_fan_out_fan_in&utm_content=6247)\n\n\n---\n\n*Happy Automating!*\n\nLucas Peyrin | [Workflows Accelerator](https://workflows.ac?utm_source=n8n_template&utm_medium=workflow_note&utm_campaign=optimize_speed_critical_workflows_using_parallel_processing_fan_out_fan_in&utm_content=6247)"
      },
      "typeVersion": 1
    },
    {
      "id": "fa065582-9815-4895-8d8e-f53bb8e708bb",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1840,
        1216
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 1040,
        "content": "## Was this helpful? Let me know!\n[![clic](https://supastudio.ia2s.app/storage/v1/object/public/assets/n8n/clic_down_lucas.gif)](https://workflows.ac/form)\n\nI really hope this template helped you. Your feedback is what helps me create better resources for the n8n community.\n\n### **Have Feedback, a Question, or a Project Idea?**\n\n\n#### \u27a1\ufe0f **[Click here to go to the Contact Form](https://workflows.ac/form?utm_source=n8n_template&utm_medium=workflow_note&utm_campaign=optimize_speed_critical_workflows_using_parallel_processing_fan_out_fan_in&utm_content=6247)**\n\nUse this single link for anything you need:\n\n*   **Give Feedback:** Share your thoughts on this template, whether you found a typo, encountered an unexpected error, have a suggestion, or just want to say thanks!\n\n*   **Automation Coaching:** Get personalized, one-on-one guidance to master n8n. We can work together to help you reach an expert level.\n\n*   **Automation Consulting:** Have a complex business challenge or need custom workflows built from scratch? We offer a plug and play automation department for 8 to 88 people teams with unlimited automation requests.\n\n---\n\nHappy Automating!\nLucas Peyrin | [Workflows Accelerator](https://workflows.ac?utm_source=n8n_template&utm_medium=workflow_note&utm_campaign=optimize_speed_critical_workflows_using_parallel_processing_fan_out_fan_in&utm_content=6247)"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Email Team": {
      "main": [
        [
          {
            "node": "Report Back to Manager",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ad Copy Team": {
      "main": [
        [
          {
            "node": "Report Back to Manager",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start Project": {
      "main": [
        [
          {
            "node": "The Project Brief",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "The Dispatcher": {
      "main": [
        [
          {
            "node": "Description Team",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Ad Copy Team",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Email Team",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Tasks": {
      "main": [
        [
          {
            "node": "Assign Tasks to Teams",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Description Team": {
      "main": [
        [
          {
            "node": "Report Back to Manager",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "The AI Specialist": {
      "ai_languageModel": [
        [
          {
            "node": "Description Team",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Ad Copy Team",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Email Team",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "The Project Brief": {
      "main": [
        [
          {
            "node": "Split Out Tasks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Receive Work Order": {
      "main": [
        [
          {
            "node": "Check Work Order Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Project Complete?": {
      "main": [
        [
          {
            "node": "Resume Parent Workflow",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Start Process",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Assign Tasks to Teams": {
      "main": [
        [
          {
            "node": "Wait for All Teams to Finish",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Work Order Status": {
      "main": [
        [
          {
            "node": "The Dispatcher",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "The Project Dashboard (Code)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "The Project Dashboard (Code)": {
      "main": [
        [
          {
            "node": "Is Project Complete?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for All Teams to Finish": {
      "main": [
        [
          {
            "node": "Project Complete!",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

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

About this workflow

This template is a hands-on tutorial for one of the most advanced and powerful patterns in n8n: asynchronous parallel processing, also known as the Fan-Out/Fan-In model.

Source: https://n8n.io/workflows/6247/ — 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

How it Works

Memory Buffer Window, Agent, Output Parser Structured +9
AI & RAG

This workflow is designed for marketers, content creators, agencies, and solo founders who want to publish long‑form posts with visuals on autopilot using n8n and AI agents. ​

Tool Http Request, Agent, HTTP Request +27
AI & RAG

Main. Uses httpRequest, agent, lmChatGoogleGemini, outputParserStructured. Event-driven trigger; 57 nodes.

HTTP Request, Agent, Google Gemini Chat +4
AI & RAG

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

Output Parser Structured, Telegram, N8N Nodes Tesseractjs +14
AI & RAG

This workflow is a fully automated YouTube Shorts production pipeline. It takes the structured output from a video digestion workflow (transcript, key moments, metadata) and produces finished, rendere

HTTP Request, Google Drive, Execute Workflow Trigger +5