{
  "name": "Generate written content with GPT Recursive Writing & Editing agents",
  "nodes": [
    {
      "id": "84b115d5-0c47-4bc9-8997-e45c16e3aa18",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        40,
        0
      ]
    },
    {
      "id": "085fd153-5564-4920-b278-e5fc93f32134",
      "name": "Window Buffer Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        920,
        280
      ]
    },
    {
      "id": "0220fe2a-8e8e-4d11-803e-b942f1cf16c5",
      "name": "set variables",
      "type": "n8n-nodes-base.set",
      "position": [
        1380,
        0
      ]
    },
    {
      "id": "0dc0e194-4129-42e3-aedd-6fbd6b875338",
      "name": "chatInput",
      "type": "n8n-nodes-base.set",
      "position": [
        260,
        0
      ]
    },
    {
      "id": "426831d6-2ddb-4ede-99a7-c0c504e6687f",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1200,
        280
      ]
    },
    {
      "id": "4be8a98c-c01f-4e8c-bec7-c6ef4119c392",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        680,
        280
      ]
    },
    {
      "id": "b22dd35c-5df2-4966-a7b6-4b146c5d9a09",
      "name": "handle edits",
      "type": "n8n-nodes-base.code",
      "position": [
        460,
        0
      ]
    },
    {
      "id": "85524870-798a-4561-a227-06c8f0aa3c26",
      "name": "If Status Complete",
      "type": "n8n-nodes-base.if",
      "position": [
        1600,
        0
      ]
    },
    {
      "id": "e28c4317-1e16-445f-8119-7d53937b651b",
      "name": "Writing Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        660,
        0
      ]
    },
    {
      "id": "fe9d9f32-8be3-49a7-8699-322192e16474",
      "name": "Editing Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1020,
        0
      ]
    },
    {
      "id": "e77541dd-0774-4545-a846-0106aa79fbf5",
      "name": "chatOutput",
      "type": "n8n-nodes-base.set",
      "position": [
        1820,
        0
      ]
    },
    {
      "id": "549707c8-55db-4e8e-aecc-68615b6034ee",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        600,
        -160
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "67c3ebb8-6d81-4add-a882-07fd0cc86f50",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        980,
        -160
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    }
  ],
  "connections": {
    "chatInput": {
      "main": [
        [
          {
            "node": "handle edits",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "handle edits": {
      "main": [
        [
          {
            "node": "Writing Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Editing Agent": {
      "main": [
        [
          {
            "node": "set variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Writing Agent": {
      "main": [
        [
          {
            "node": "Editing Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "set variables": {
      "main": [
        [
          {
            "node": "If Status Complete",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Writing Agent",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Editing Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "If Status Complete": {
      "main": [
        [
          {
            "node": "chatOutput",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "handle edits",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Window Buffer Memory": {
      "ai_memory": [
        [
          {
            "node": "Editing Agent",
            "type": "ai_memory",
            "index": 0
          },
          {
            "node": "Writing Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Editing Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "chatInput",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}