AutomationFlowsAI & RAG › Generate Written Content with Gpt Recursive Writing & Editing Agents

Generate Written Content with Gpt Recursive Writing & Editing Agents

ByMatty Reed @mattyreed1 on n8n.io

Content creators, writers, and automation enthusiasts experimenting with recursive AI workflows for content generation and refinement. Ideal for those exploring AI agents that collaborate in cycles of writing and editing.

Chat trigger trigger★★★★☆ complexityAI-powered13 nodesChat TriggerMemory Buffer WindowOutput Parser StructuredOpenAI ChatAgent
AI & RAG Trigger: Chat trigger Nodes: 13 Complexity: ★★★★☆ AI nodes: yes Added:

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

This workflow follows the Agent → Chat 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
{
  "id": "UnFtEvTPouN6XIIH",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Recursive Multi-Agent TEMPLATE",
  "tags": [],
  "nodes": [
    {
      "id": "84b115d5-0c47-4bc9-8997-e45c16e3aa18",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        40,
        0
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "085fd153-5564-4920-b278-e5fc93f32134",
      "name": "Window Buffer Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        920,
        280
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "0220fe2a-8e8e-4d11-803e-b942f1cf16c5",
      "name": "set variables",
      "type": "n8n-nodes-base.set",
      "position": [
        1380,
        0
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "0dc0e194-4129-42e3-aedd-6fbd6b875338",
      "name": "chatInput",
      "type": "n8n-nodes-base.set",
      "position": [
        260,
        0
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "426831d6-2ddb-4ede-99a7-c0c504e6687f",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1200,
        280
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "4be8a98c-c01f-4e8c-bec7-c6ef4119c392",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        680,
        280
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "b22dd35c-5df2-4966-a7b6-4b146c5d9a09",
      "name": "handle edits",
      "type": "n8n-nodes-base.code",
      "position": [
        460,
        0
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "85524870-798a-4561-a227-06c8f0aa3c26",
      "name": "If Status Complete",
      "type": "n8n-nodes-base.if",
      "position": [
        1600,
        0
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "e28c4317-1e16-445f-8119-7d53937b651b",
      "name": "Writing Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        660,
        0
      ],
      "parameters": {},
      "typeVersion": 1.7
    },
    {
      "id": "fe9d9f32-8be3-49a7-8699-322192e16474",
      "name": "Editing Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "maxTries": 5,
      "position": [
        1020,
        0
      ],
      "parameters": {},
      "retryOnFail": false,
      "typeVersion": 1.7
    },
    {
      "id": "e77541dd-0774-4545-a846-0106aa79fbf5",
      "name": "chatOutput",
      "type": "n8n-nodes-base.set",
      "position": [
        1820,
        0
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "549707c8-55db-4e8e-aecc-68615b6034ee",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        600,
        -160
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "67c3ebb8-6d81-4add-a882-07fd0cc86f50",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        980,
        -160
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "8b9969b0-ae7b-45c0-9f41-72ea972d67cb",
  "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
          }
        ]
      ]
    }
  }
}
Pro

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

About this workflow

Content creators, writers, and automation enthusiasts experimenting with recursive AI workflows for content generation and refinement. Ideal for those exploring AI agents that collaborate in cycles of writing and editing.

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

HDW Lead Geländewagen. Uses chatTrigger, lmChatOpenAi, memoryBufferWindow, outputParserStructured. Chat trigger; 92 nodes.

Chat Trigger, OpenAI Chat, Memory Buffer Window +5
AI & RAG

by Varritech Technologies

Chat Trigger, Agent, OpenAI Chat +8
AI & RAG

Who is this workflow for? This workflow is designed for SEO analysts, content creators, marketing agencies, and developers who need to index a website and then interact with its content as if it were

Agent, OpenAI Chat, Memory Buffer Window +10
AI & RAG

This workflow enables users to interact with a PostgreSQL database using natural language. It translates text inputs into SQL queries, retrieves the corresponding data, and generates visualizations us

Memory Buffer Window, Read Write File, Chat Trigger +4
AI & RAG

This Chatbot automates the process of discovering job openings and generating tailored job application emails.

Chat Trigger, OpenAI Chat, Mcp Client Tool +12