{
  "name": "Route AI tasks between OpenAI agents with confidence-based email fallback",
  "nodes": [
    {
      "id": "4110189b-d37c-4040-8c5b-12df0e049c0b",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        -944,
        400
      ]
    },
    {
      "id": "97813aa7-54cc-41ab-a1ae-76e1e5f3d11c",
      "name": "Supervisor Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -720,
        400
      ]
    },
    {
      "id": "ec13c899-9b19-4750-895e-8115b3855839",
      "name": "Routing Decision Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -576,
        624
      ]
    },
    {
      "id": "e4813bd0-c750-4197-9c0c-2b22c1eb9b9f",
      "name": "OpenAI Model - Supervisor",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -704,
        624
      ]
    },
    {
      "id": "c9aaadea-65a9-4fef-b418-2d4959289115",
      "name": "Check Confidence Score",
      "type": "n8n-nodes-base.if",
      "position": [
        -352,
        400
      ]
    },
    {
      "id": "0b8bb7f5-ddde-48de-afec-e36e300a146a",
      "name": "OpenAI Model - Simple Agent",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        32,
        416
      ]
    },
    {
      "id": "1da98644-06c5-4fad-9a9e-046bca69c79a",
      "name": "Execute Selected Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        192,
        -176
      ]
    },
    {
      "id": "f577a529-76af-48c5-a293-599f6afcc1fe",
      "name": "OpenAI Model - Executor",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        64,
        -32
      ]
    },
    {
      "id": "cc11ac92-7751-40c8-92a9-4632d0b8379d",
      "name": "Send Fallback Alert",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        208,
        768
      ]
    },
    {
      "id": "f142cee8-b073-4ae1-a547-c58b0c0229be",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -800,
        224
      ],
      "parameters": {
        "width": 384,
        "height": 528,
        "content": "## Task Classification\n\nThe Supervisor Agent analyzes the user request and determines whether the task is simple or complex."
      }
    },
    {
      "id": "8366aa47-d487-4198-ab9b-bfdc565ce017",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        64,
        592
      ],
      "parameters": {
        "width": 400,
        "height": 304,
        "content": "##  Alert\n\nIf the confidence is below the configured threshold, an email alert is sent to an administrator requesting manual review to prevent incorrect automated responses."
      }
    },
    {
      "id": "3c844f95-4189-40c8-a33c-448baf675ad3",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        -336
      ],
      "parameters": {
        "width": 576,
        "height": 416,
        "content": "## Agent Orchestration\n\nAn orchestrator AI agent decides which specialized tool to call based on the supervisor’s classification.\nThe request is  either the Simple Task Agent or the Complex Task Agent"
      }
    },
    {
      "id": "c0390db3-93f3-43d0-b41d-63361c249aa7",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        112
      ],
      "parameters": {
        "width": 720,
        "height": 432,
        "content": "## Two specialized agents handle task execution:\n\nSimple Task Agent for straightforward questions and quick responses.\n\nComplex Task Agent for multi-step reasoning, deeper analysis, and detailed expla"
      }
    },
    {
      "id": "51daaa69-4904-4d84-afe2-e7604f6f29ad",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1280,
        288
      ],
      "parameters": {
        "width": 288,
        "height": 288,
        "content": "## Workflow Start\n\n\nA WEBHOOK trigger starts the execution "
      }
    },
    {
      "id": "3c1fa43d-b198-419e-8e40-d3a7d2b7fce4",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1200,
        400
      ]
    },
    {
      "id": "82002223-7e98-411b-8cc2-3d214089376d",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -384,
        288
      ],
      "parameters": {
        "width": null,
        "height": 256,
        "content": "## Check Confidence Score"
      }
    },
    {
      "id": "038ed7d0-2abf-4d91-b4fa-23bd579a5b77",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        544,
        -176
      ]
    },
    {
      "id": "33e2c29b-21d5-43d9-9d40-2cf4d4b40764",
      "name": "OpenAI Model - Complex Agent GPT 5.3",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        368,
        416
      ]
    },
    {
      "id": "89a00fe3-2673-4c0d-b62e-d07d31041373",
      "name": "Complex Task Agent Tool (5.4)",
      "type": "@n8n/n8n-nodes-langchain.agentTool",
      "position": [
        448,
        304
      ]
    },
    {
      "id": "e00c5a1f-4c35-490c-9770-7ae1d62f2c66",
      "name": "Simple Task Agent Tool(5 MINI)",
      "type": "@n8n/n8n-nodes-langchain.agentTool",
      "position": [
        112,
        320
      ]
    },
    {
      "id": "fe5032bb-736b-4614-9b2b-b4898cfb621f",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1872,
        192
      ],
      "parameters": {
        "width": 512,
        "height": 480,
        "content": "## AI Task Routing with Supervisor Agent\n\nThis workflow intelligently analyzes incoming user requests and routes them to the most appropriate AI agent based on task complexity. When a request is recei"
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Supervisor Agent": {
      "main": [
        [
          {
            "node": "Check Confidence Score",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Confidence Score": {
      "main": [
        [
          {
            "node": "Execute Selected Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Fallback Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Selected Agent": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Supervisor Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Model - Executor": {
      "ai_languageModel": [
        [
          {
            "node": "Execute Selected Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Routing Decision Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Supervisor Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Model - Supervisor": {
      "ai_languageModel": [
        [
          {
            "node": "Supervisor Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Model - Simple Agent": {
      "ai_languageModel": [
        [
          {
            "node": "Simple Task Agent Tool(5 MINI)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Complex Task Agent Tool (5.4)": {
      "ai_tool": [
        [
          {
            "node": "Execute Selected Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Simple Task Agent Tool(5 MINI)": {
      "ai_tool": [
        [
          {
            "node": "Execute Selected Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Model - Complex Agent GPT 5.3": {
      "ai_languageModel": [
        [
          {
            "node": "Complex Task Agent Tool (5.4)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}