{
  "name": "Scalable multi-agent chat using @mentions",
  "nodes": [
    {
      "id": "218308e2-dc68-43ee-ae84-d931ad7a4ac5",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -1880,
        -3280
      ]
    },
    {
      "id": "a519fe1e-8739-46e0-9770-deb256ab96cf",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -340,
        -3280
      ]
    },
    {
      "id": "2e00f0ff-e7af-45d5-99bc-23031b5d7892",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -1000,
        -3280
      ]
    },
    {
      "id": "1c979a20-46a5-4591-92da-82c1c96277c6",
      "name": "Extract mentions",
      "type": "n8n-nodes-base.code",
      "position": [
        -1220,
        -3280
      ]
    },
    {
      "id": "45f635ca-f4fa-4f6c-a32a-9722906255fd",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -192,
        -3060
      ]
    },
    {
      "id": "5c903044-bce2-4aa8-b168-a460a4999c54",
      "name": "Set last Assistant message as input",
      "type": "n8n-nodes-base.set",
      "position": [
        -560,
        -3180
      ]
    },
    {
      "id": "7b389b9f-1751-4bc1-9c6f-bf6a04a1e09f",
      "name": "Set user message as input",
      "type": "n8n-nodes-base.set",
      "position": [
        -560,
        -3380
      ]
    },
    {
      "id": "a238817f-0d10-4cd4-9760-53f69bb179f7",
      "name": "First loop?",
      "type": "n8n-nodes-base.if",
      "position": [
        -780,
        -3280
      ]
    },
    {
      "id": "415927d7-b1a4-42b2-9607-c6ff707a528b",
      "name": "Set lastAssistantMessage",
      "type": "n8n-nodes-base.set",
      "position": [
        36,
        -3155
      ]
    },
    {
      "id": "77861e4b-a1d2-4c35-bf50-15914602a8b5",
      "name": "Combine and format responses",
      "type": "n8n-nodes-base.code",
      "position": [
        -780,
        -3480
      ]
    },
    {
      "id": "4da2f95d-bce4-4844-a23c-63ca777efbfd",
      "name": "Define Global Settings",
      "type": "n8n-nodes-base.code",
      "position": [
        -1660,
        -3280
      ]
    },
    {
      "id": "6639a554-9e5f-40ac-b68e-b8eaa777252d",
      "name": "Define Agent Settings",
      "type": "n8n-nodes-base.code",
      "position": [
        -1440,
        -3280
      ]
    },
    {
      "id": "d55a7e02-3574-4d78-a141-db8d3657857b",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1750,
        -3620
      ],
      "parameters": {
        "width": 500,
        "height": 500,
        "content": "## Step 1: Configure Settings Nodes\n\nEdit the JSON in these nodes to:\n\n- Configure details about you (the user)\n- Define content that will appear in all system messages\n- Define Agents.\n\nFor Agents, y"
      }
    },
    {
      "id": "d3eb2797-4008-4bdb-a588-b2412ed5ffa7",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        -3620
      ],
      "parameters": {
        "width": 360,
        "height": 720,
        "content": "## Step 2: Connect Agent to OpenRouter\n\nSet your OpenRouter credentials, and all other parameters including system messages and model selection are dynamically populated."
      }
    },
    {
      "id": "a6085a55-db36-42d8-8c57-c9123490581f",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1940,
        -3900
      ],
      "parameters": {
        "width": 2180,
        "height": 1100,
        "content": "# Scalable Multi-Agent Conversations\n\n"
      }
    },
    {
      "id": "d2ee6317-3a9c-4df8-8fce-87daa3530233",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1200,
        -3860
      ],
      "parameters": {
        "width": 380,
        "height": 360,
        "content": "## About this workflow\n\n**What does this workflow do?**\nEnables you to initiate a conversation with multiple AI agents at once. Each agent can be configured with a unique name, system instructions, a "
      }
    },
    {
      "id": "a190a268-7f90-4c4e-aceb-482545d0b72b",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -820,
        -3860
      ],
      "parameters": {
        "width": 380,
        "height": 360,
        "content": "**How does it work?**\nSettings are configured in the first two nodes after the chat trigger. Then @mentions in your message are extracted and fed into a loop. With each loop, the agent's system messag"
      }
    },
    {
      "id": "30d8c207-9a7a-46c5-be89-0deafc6c183f",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        -312,
        -3060
      ]
    }
  ],
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Set lastAssistantMessage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "First loop?": {
      "main": [
        [
          {
            "node": "Set user message as input",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set last Assistant message as input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Combine and format responses",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "First loop?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract mentions": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Define Agent Settings": {
      "main": [
        [
          {
            "node": "Extract mentions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Define Global Settings": {
      "main": [
        [
          {
            "node": "Define Agent Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set lastAssistantMessage": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set user message as input": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "Define Global Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Combine and format responses": {
      "main": [
        []
      ]
    },
    "Set last Assistant message as input": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}