{
  "name": "Simulate debates between AI agents using Mistral to optimize answers",
  "nodes": [
    {
      "id": "f635cc89-01b3-4604-a408-69d10bb5991f",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -380,
        -440
      ],
      "parameters": {
        "width": 840,
        "height": 500,
        "content": "## AI Arena - Debate of AI Agents to Optimize Answers and Simulate Diverse Scenarios\n**Version** : 1.0\n**Creator** : Hybroht\n**Website** : hybroht.com\n\n**Description**: the workflow will create a disc"
      }
    },
    {
      "id": "dc779b72-393c-4096-829c-44c19cdf2f4c",
      "name": "Schedule",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -280,
        220
      ]
    },
    {
      "id": "efd7bcee-56ea-451e-a382-30c22bf503f3",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -380,
        80
      ],
      "parameters": {
        "width": 840,
        "height": 1400,
        "content": "## Setup and Start\n**Schedule** will start the workflow according to its configuration.\n**Configure Workflow Args** will describe the variables used by the workflow. To help with usage, a note with a "
      }
    },
    {
      "id": "831cdbef-2e59-4845-9249-01c51fa46aa7",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -360,
        760
      ],
      "parameters": {
        "width": 800,
        "height": 260,
        "content": "**Configure Workflow Args**:\n\n- input: The initial text to be changed and/or added during the rewrite. Hint: it could be given as an argument if you use this template in a sub-workflow.\n- scenario: Th"
      }
    },
    {
      "id": "c1e7430e-0d6d-44cb-b969-59f6f2bbf450",
      "name": "Configure Workflow Args",
      "type": "n8n-nodes-globals.globalConstants",
      "position": [
        0,
        340
      ]
    },
    {
      "id": "80755a3e-6b2f-4443-8f68-6983aa5ac8ce",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -280,
        380
      ]
    },
    {
      "id": "a533ff1e-540f-4fd8-82df-6b2a9813407d",
      "name": "Email Trigger (IMAP)",
      "type": "n8n-nodes-base.emailReadImap",
      "position": [
        -280,
        580
      ]
    },
    {
      "id": "c8442d57-0097-42e2-8489-6cc0b2dcfdb3",
      "name": "Mistral Cloud Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatMistralCloud",
      "position": [
        1620,
        740
      ]
    },
    {
      "id": "a50548f4-e2f9-49dc-b22e-a22f16e22035",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1820,
        580
      ]
    },
    {
      "id": "efa6b40b-babb-47db-8234-df435d161cf0",
      "name": "Prepare Input",
      "type": "n8n-nodes-base.set",
      "position": [
        300,
        340
      ]
    },
    {
      "id": "9d6fc447-de96-46d3-9a23-51f8ec0b65a6",
      "name": "Update Input",
      "type": "n8n-nodes-base.set",
      "position": [
        2900,
        740
      ]
    },
    {
      "id": "b0db51af-4858-4906-b706-0d76335d35f8",
      "name": "Split Out AI Agents",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1320,
        400
      ]
    },
    {
      "id": "9402704b-61db-4d16-9266-f42402953825",
      "name": "JSON Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1980,
        580
      ]
    },
    {
      "id": "d8b9d045-1b2f-4fc4-9821-67c8a86b3a7b",
      "name": "If No More Rounds",
      "type": "n8n-nodes-base.if",
      "position": [
        3640,
        220
      ]
    },
    {
      "id": "dae712bb-b246-4a6c-8863-90784f7b38ef",
      "name": "End of Debate",
      "type": "n8n-nodes-base.noOp",
      "position": [
        4060,
        200
      ]
    },
    {
      "id": "7724c844-5305-48fe-b819-855c707289e3",
      "name": "Debate Loop",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        2720,
        40
      ]
    },
    {
      "id": "328b1db7-5126-472f-b14b-49c6f4fda5d9",
      "name": "Round Loop",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1100,
        220
      ]
    },
    {
      "id": "0f108078-e303-4da6-9e53-d4ed20314ac0",
      "name": "Debate Actor Abstraction",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1740,
        380
      ]
    },
    {
      "id": "83f497f7-85d1-4af9-b402-8a87fd143594",
      "name": "Debate Environment",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        3220,
        -60
      ]
    },
    {
      "id": "2c309812-45ca-4c5b-b38e-bd54327601a1",
      "name": "Guarantee Input",
      "type": "n8n-nodes-base.set",
      "position": [
        780,
        340
      ]
    },
    {
      "id": "c4c6c0a7-11c6-43d0-b15c-7bd7d3ee46dc",
      "name": "Mistral Cloud Chat Model 2",
      "type": "@n8n/n8n-nodes-langchain.lmChatMistralCloud",
      "position": [
        3160,
        180
      ]
    },
    {
      "id": "870ea0fb-6d3f-457e-a684-6ab0fce5efe4",
      "name": "Aggregate",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        3000,
        40
      ]
    },
    {
      "id": "4a8ceb9d-364b-4fa5-b395-5d483ccec789",
      "name": "JSON Output Parser 2",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        3420,
        180
      ]
    },
    {
      "id": "eb7f959c-dd9d-4fba-9f27-f96874dff696",
      "name": "Simple Memory 2",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        3280,
        220
      ]
    },
    {
      "id": "5c1a427f-2cff-4614-99e6-348c96771dc3",
      "name": "Wait Before Sending Agents",
      "type": "n8n-nodes-base.wait",
      "position": [
        1520,
        500
      ]
    },
    {
      "id": "cef6c55f-e736-40bf-8d48-793c614cea81",
      "name": "Wait 1",
      "type": "n8n-nodes-base.wait",
      "position": [
        2220,
        300
      ]
    },
    {
      "id": "3e624ac2-62f2-4956-84ab-f722b7fa3bd1",
      "name": "Wait 2",
      "type": "n8n-nodes-base.wait",
      "position": [
        2480,
        180
      ]
    },
    {
      "id": "98e03085-5db5-4d54-9b8b-2b99cbb6668f",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        500,
        -440
      ],
      "parameters": {
        "width": 3400,
        "height": 1520,
        "content": "# Debate\n**Round Execution** will execute the AI agents on the current state of the input for the current round.\n**Round Results** will receive the replies/actions of each AI agent and calculate the r"
      }
    },
    {
      "id": "bd3a89bf-277b-40ef-bf8c-b1c6f4417b02",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2420,
        -320
      ],
      "parameters": {
        "width": 1440,
        "height": 840,
        "content": "## Round Results\n**Debate Loop** will be used to control the loop making the debate happen. The loop will only break if the \"If No More Rounds\" condition is satisfied.\n**Aggregate** will get the list "
      }
    },
    {
      "id": "4fdb8f1b-5942-421e-b8d4-f042a7a549b3",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        760,
        -160
      ],
      "parameters": {
        "width": 1600,
        "height": 1040,
        "content": "## Round Execution\n**Guarantee Input** will take the initial input and ensure that it is appropriately updated for each round.\n**Round Loop** will be used as a reference node by the AI agents to recei"
      }
    },
    {
      "id": "a3397dbf-a181-4117-8b53-38b914c1523b",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2420,
        540
      ],
      "parameters": {
        "width": 740,
        "height": 440,
        "content": "## Continue To Next Round\n**Update Input** will:\n- Get the results of the Debate Environment.\n- Update the appropriate args.\n- Send them to a new **Round Execution**."
      }
    },
    {
      "id": "46ac77b9-f3d9-42cb-b9c3-ae0fdcadf065",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        500,
        1120
      ],
      "parameters": {
        "width": 1200,
        "height": 1160,
        "content": "### Workflow Args Example (JSON):\n{\n  \"input\": \"My present biz decison is to pancake a company what zips 'invisible umberellas', made for guard against ghosty puddles. The whatchamacallit is sell as a"
      }
    },
    {
      "id": "049b3320-a354-4519-a3ac-dfd6a051338e",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3940,
        20
      ],
      "parameters": {
        "width": 400,
        "height": 380,
        "content": "## Debate Results\n- After all the rounds have ended, the final output will be data containing the following properties: \"round_result,\" \"round_summary,\" and \"rewritten_input.\"\n- The \"rewritten_input\" "
      }
    },
    {
      "id": "55e3c75f-d9bc-4125-9722-8f76f73d6596",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -360,
        1100
      ],
      "parameters": {
        "width": 380,
        "height": 260,
        "content": "**AI Environment Args\n(JSON Object - ai_environment)**:\n\n- context: The description of the AI Arena environment for the LLM used. It will primarily indicate what to expect from the AI agents and how t"
      }
    },
    {
      "id": "9da715b0-018a-407f-b003-f42464ebd8c8",
      "name": "Sticky Note16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        40,
        1040
      ],
      "parameters": {
        "width": 400,
        "height": 400,
        "content": "**AI Agent Args\n(JSON Object Item - ai_agents)**:\n- name: The name of the AI agent, to keep track of the source of the actions/replies.\n- description: An explanation about the AI agent, often aligning"
      }
    },
    {
      "id": "7a01ecc0-20b6-46c3-921c-fc7891712f14",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        300,
        -180
      ],
      "parameters": {
        "width": 150,
        "height": null,
        "content": "![Hybroht](https://hybroht.com/assets/favicon.png \"Hybroht Logo\")"
      }
    },
    {
      "id": "2b166bc1-0908-47ef-a405-ea57f977a4a7",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1740,
        1120
      ],
      "parameters": {
        "width": 900,
        "height": 480,
        "content": "### Input & Output Example\n**Input**: 'My present biz decison is to pancake a company what zips 'invisible umberellas', made for guard against ghosty puddles. The whatchamacallit is sell as a fantasti"
      }
    },
    {
      "id": "1ddb3887-fc5b-48ba-a3f8-e62613ff54f4",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -380,
        1500
      ],
      "parameters": {
        "width": 840,
        "height": 280,
        "content": "### Information - n8n setup\n- n8n Version\n1.100.1\n\n- n8n-nodes-globals\n1.1.0\n\n- Running n8n via:\nPodman 4.3.1\n\n- Operating system:\nLinux"
      }
    }
  ],
  "connections": {
    "Wait 1": {
      "main": [
        [
          {
            "node": "Wait 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 2": {
      "main": [
        [
          {
            "node": "Debate Loop",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule": {
      "main": [
        [
          {
            "node": "Configure Workflow Args",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "Debate Environment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Round Loop": {
      "main": [
        [],
        [
          {
            "node": "Split Out AI Agents",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Debate Loop": {
      "main": [
        [],
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Input": {
      "main": [
        [
          {
            "node": "Guarantee Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Input": {
      "main": [
        [
          {
            "node": "Guarantee Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Debate Actor Abstraction",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Guarantee Input": {
      "main": [
        [
          {
            "node": "Round Loop",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory 2": {
      "ai_memory": [
        [
          {
            "node": "Debate Environment",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "If No More Rounds": {
      "main": [
        [
          {
            "node": "End of Debate",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Debate Environment": {
      "main": [
        [
          {
            "node": "If No More Rounds",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "JSON Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Debate Actor Abstraction",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Split Out AI Agents": {
      "main": [
        [
          {
            "node": "Wait Before Sending Agents",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Trigger (IMAP)": {
      "main": [
        [
          {
            "node": "Configure Workflow Args",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "JSON Output Parser 2": {
      "ai_outputParser": [
        [
          {
            "node": "Debate Environment",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Configure Workflow Args": {
      "main": [
        [
          {
            "node": "Prepare Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Debate Actor Abstraction": {
      "main": [
        [
          {
            "node": "Wait 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mistral Cloud Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Debate Actor Abstraction",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Mistral Cloud Chat Model 2": {
      "ai_languageModel": [
        [
          {
            "node": "Debate Environment",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Wait Before Sending Agents": {
      "main": [
        [
          {
            "node": "Debate Actor Abstraction",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Configure Workflow Args",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}