This workflow corresponds to n8n.io template #15952 — we link there as the canonical source.
This workflow follows the Agent → Execute Workflow 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 →
{
"id": "zZjdwqm8PwzrLjeZ",
"name": "Template 2: Content Pipeline - Writer Agent",
"tags": [],
"nodes": [
{
"id": "623914e2-8553-4307-92c9-b182a6d3e81f",
"name": "When Executed by Parent",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"position": [
208,
304
],
"parameters": {
"inputSource": "passthrough"
},
"typeVersion": 1.1
},
{
"id": "8a7f9744-f4c2-4e95-9412-45a1b3b5b646",
"name": "Writer Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
448,
304
],
"parameters": {
"text": "=Brief:\n{{ $json.brief }}\n\nResearch notes (JSON):\n{{ JSON.stringify($json.research) }}\n\n{{ $json.feedbackNotes ? ('Previous draft:\\n' + ($json.previousDraft || '') + '\\n\\nReviewer feedback to address in this revision:\\n' + $json.feedbackNotes) : 'This is a fresh draft (no prior version).' }}",
"options": {
"systemMessage": "You are a technical writer for a content pipeline. Given research notes and a brief, produce a clear, direct article. If reviewer feedback is provided along with a previous draft, revise the draft to address the feedback while keeping what was already working. Otherwise, write a fresh draft from scratch.\n\nGuidelines:\n- Match the brief's tone and audience.\n- Lead with the strongest point.\n- Use research facts accurately. Do not invent sources.\n- No filler sentences, no hedging openers, no summary restatements of the brief.\n- Aim for 300 to 600 words unless the brief specifies otherwise.\n\nReturn ONLY valid JSON in this exact shape:\n{\n \"draft\": \"the full article text as a single string with paragraph breaks as \\\\n\\\\n\",\n \"wordCount\": 0,\n \"revisionOf\": null or \"previous\"\n}"
},
"promptType": "define"
},
"typeVersion": 1.7
},
{
"id": "f2c51dcd-81bc-41b6-9387-0e68a1d53e61",
"name": "OpenRouter - Writer",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
352,
528
],
"parameters": {
"options": {}
},
"credentials": {
"openRouterApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "d38c6150-2527-492e-866d-c8f96d7c3ec3",
"name": "Parse Writer Output",
"type": "n8n-nodes-base.code",
"position": [
720,
304
],
"parameters": {
"jsCode": "// Parse writer output, merge with trigger input, overwrite currentDraft\nconst raw = $input.first().json;\nconst triggerIn = $('When Executed by Parent').first().json;\nlet draftFields;\ntry {\n const text = typeof raw.output === 'string' ? raw.output : JSON.stringify(raw.output);\n const m = text.match(/\\{[\\s\\S]*\\}/);\n const agentOut = JSON.parse(m ? m[0] : text);\n if (!agentOut.draft) throw new Error('Missing draft');\n draftFields = {\n currentDraft: agentOut.draft,\n draftWordCount: agentOut.wordCount || agentOut.draft.trim().split(/\\s+/).length,\n revisionOf: agentOut.revisionOf || (triggerIn.feedbackNotes ? 'previous' : null)\n };\n} catch(e) {\n draftFields = {\n currentDraft: '',\n draftWordCount: 0,\n revisionOf: null,\n writerParseError: e.message\n };\n}\n\nreturn {\n json: {\n ...triggerIn,\n ...draftFields\n }\n};"
},
"typeVersion": 2
},
{
"id": "033b4ea2-4652-441a-a8c1-c9698f57478e",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-448,
0
],
"parameters": {
"width": 620,
"height": 820,
"content": "## Writer Subworkflow (for Content Pipeline)\n\n### How it works\nStandalone subworkflow called by the Content Pipeline parent. Drafts or revises an article:\n1. **Execute Workflow Trigger** (Passthrough): Receives the full pipeline state (brief, research, previous draft, reviewer feedback, revisionCount).\n2. **Writer Agent** (AI): Produces a ~400-word draft. On revisions, uses the Reviewer's feedback to revise the previous draft rather than starting from scratch.\n3. **Parse + Merge**: Extracts the draft and word count, then returns `{...triggerInput, currentDraft, wordCount}` so state flows through.\n\n### Setup\n- Must be saved before the parent can reference it\n- Attach your **LLM credentials** to the Chat Model sub-node\n- Called by the parent on the first draft and every revision iteration\n\n### Customization\n- Use a stronger model here since this is the highest-leverage step in the pipeline\n- Adjust target word count in the system prompt\n- Add brand voice or style guidelines to the prompt\n\nThis template is a learning companion to the Production AI Playbook, a series that explores strategies, shares best practices, and provides practical examples for building reliable AI systems in n8n."
},
"typeVersion": 1
}
],
"active": true,
"settings": {
"binaryMode": "separate",
"executionOrder": "v1"
},
"versionId": "806575c7-a1b4-4e8e-a679-fb73676c6b8a",
"connections": {
"Writer Agent": {
"main": [
[
{
"node": "Parse Writer Output",
"type": "main",
"index": 0
}
]
]
},
"OpenRouter - Writer": {
"ai_languageModel": [
[
{
"node": "Writer Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"When Executed by Parent": {
"main": [
[
{
"node": "Writer Agent",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
openRouterApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This subworkflow is triggered by a parent content pipeline, uses OpenRouter (via an AI Writer Agent) to draft or revise a technical article from a brief, research notes, and optional reviewer feedback, and returns the updated pipeline state with the current draft and word count.…
Source: https://n8n.io/workflows/15952/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
The AI-Powered Shopify SEO Content Automation is an enterprise-grade workflow that transforms product content creation for e-commerce stores. This sophisticated multi-agent system integrates GPT-4o, C
Deep Research new (fr). Uses outputParserStructured, formTrigger, chainLlm, form. Event-driven trigger; 82 nodes.
Who is this for? Agencies, consultants, and service providers who conduct discovery calls and need to quickly turn conversations into professional proposals.
This workflow is designed for marketers, content creators, agencies, and solo founders who want to publish long‑form posts with visuals on autopilot using n8n and AI agents.
This workflow helps to automatically discover undocumented API endpoints by analysing JavaScript files from the website's HTML code.