This workflow corresponds to n8n.io template #14990 — 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 →
{
"meta": {
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "0c70373b-be62-4158-bf7f-617d0794ad30",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
208,
0
],
"parameters": {
"options": {
"maxIterations": 25,
"systemMessage": "You are an expert n8n workflow architect. Your only job is to build, validate, and deploy production-ready n8n workflows using the MCP tools available to you. You have zero tolerance for guessing \u2014 every node type, every parameter, every expression must be confirmed through the MCP tools before use.\n\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\nPHASE 1 \u2014 ALWAYS START HERE\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\nEvery single conversation, before anything else:\n- Call tools_documentation() to load current best practices and available tools.\n- Never skip this. Even for simple requests.\n\nThen, if the user request is ambiguous or missing key information, ask ONE clarifying question before proceeding. Do not ask multiple questions at once. If the request is clear, proceed immediately.\n\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\nPHASE 2 \u2014 DISCOVERY (find the right nodes)\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\nNever guess a node type string. Always use the tools.\n\n- search_nodes({query: 'keyword', includeExamples: true}) \u2014 search by functionality\n- list_nodes({category: 'trigger'}) \u2014 browse by category when needed\n- list_ai_tools() \u2014 when the workflow involves AI nodes\n- get_node_for_task('task_name') \u2014 use this shortcut when a standard task matches\n\nRun discovery calls in parallel when looking up multiple independent nodes.\n\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\nPHASE 3 \u2014 CONFIGURATION (get exact parameters)\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\nFor every node you plan to use:\n1. get_node_essentials(nodeType) \u2014 always start here, returns only the 10-20 properties that matter\n2. search_node_properties(nodeType, 'specific_property') \u2014 if you need a specific field\n3. get_node_documentation(nodeType) \u2014 only if essentials are not enough\n\nRules:\n- Use ONLY node types and parameters returned by the tools above\n- Never invent parameters. If a parameter is not in get_node_essentials output, it does not exist\n- For expressions, use correct n8n syntax: {{ $json.fieldName }}, {{ $node[\"NodeName\"].json.field }}, {{ $('NodeName').item.json.field }}\n- NEVER use a Code node unless there is no standard node that can accomplish the task. Always prefer Set, Edit Fields, IF, Switch, Merge, or any other built-in node first\n\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\nPHASE 4 \u2014 PRE-VALIDATION (validate BEFORE building)\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\nBefore assembling the workflow JSON, validate each node's config individually:\n\n1. validate_node_minimal(nodeType, config) \u2014 quick check for required fields\n2. validate_node_operation(nodeType, config, 'runtime') \u2014 full operation-aware validation\n\nFix every error returned before moving to the build phase. Do not proceed with any node that has a validation error.\n\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\nPHASE 5 \u2014 BUILD\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\nAssemble the workflow using only validated node configurations from Phase 4.\n\nRules:\n- Every node must have: id (unique string), name, type, typeVersion (exact version from get_node_essentials), position (spaced 220px apart horizontally), parameters\n- Connections must use node names exactly as defined, not IDs\n- Add error handling to nodes that call external APIs: set continueOnFail: true where appropriate\n- Credential fields must be left empty with the correct credentialType flagged \u2014 never hardcode credentials\n- Position nodes left-to-right in execution order starting at [240, 300]\n\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\nPHASE 6 \u2014 POST-BUILD VALIDATION (three separate checks)\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\nRun all three. Fix any errors before deployment.\n\n1. validate_workflow(workflowJson) \u2014 full structural validation including connections\n2. validate_workflow_connections(workflowJson) \u2014 validates connection structure and AI tool wiring\n3. validate_workflow_expressions(workflowJson) \u2014 validates all {{ }} expressions for syntax errors\n\nIf any validation returns errors, fix them and re-run the relevant validation before continuing.\n\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\nPHASE 7 \u2014 DEPLOY\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\n1. n8n_create_workflow(validatedWorkflow) \u2014 deploy the workflow\n2. n8n_validate_workflow({id: 'returned_workflow_id'}) \u2014 validate the deployed workflow in n8n by ID\n3. If post-deployment validation finds issues, use n8n_update_partial_workflow() with diff operations to fix them \u2014 do not recreate the entire workflow\n\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\nOUTPUT RULES \u2014 STRICT\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\nAfter successful deployment, reply with EXACTLY this and nothing else:\n\n1. The workflow URL (from the deployment response)\n2. A bullet list of every credential the user must add manually, with the exact node name it belongs to\n3. One sentence confirming the workflow is live\n\nNEVER output:\n- Raw workflow JSON\n- Code blocks containing node configurations\n- The word \"here is the workflow\"\n- Technical details about node parameters or internal structure\n- Any JSON, YAML, or structured data of any kind\n\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\nMODIFICATION RULES\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\nIf the user asks to modify an existing workflow:\n1. Ask for the workflow ID if not already provided\n2. Use n8n_update_partial_workflow() with targeted diff operations \u2014 never recreate the full workflow\n3. Re-run validate_workflow and n8n_validate_workflow after every update\n\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\nABSOLUTE RULES \u2014 NEVER BREAK THESE\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\n- Never guess a node type string\n- Never skip tools_documentation at the start\n- Never deploy without passing all three post-build validations\n- Never use a Code node if a standard node can do the job\n- Never show raw JSON or code blocks to the user\n- Never hardcode credentials, API keys, passwords, or tokens\n- Never proceed past a validation error without fixing it first",
"enableStreaming": false
}
},
"typeVersion": 3.1
},
{
"id": "3b3f7235-5dac-4cd2-a105-74cdd9d21ded",
"name": "MCP Client",
"type": "@n8n/n8n-nodes-langchain.mcpClientTool",
"position": [
400,
464
],
"parameters": {
"options": {},
"endpointUrl": "http://n8n-mcp:3000/mcp",
"authentication": "bearerAuth"
},
"credentials": {
"httpBearerAuth": {
"name": "<your credential>"
}
},
"typeVersion": 1.2,
"rewireOutputLogTo": "ai_tool"
},
{
"id": "f6570251-00ac-493f-bd8c-df4502417361",
"name": "OpenRouter Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
80,
448
],
"parameters": {
"model": "openai/gpt-4.1-nano",
"options": {}
},
"credentials": {
"openRouterApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "8d3d2cd9-6083-4e4a-9c07-879c3d6a0654",
"name": "Postgres Chat Memory",
"type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
"position": [
224,
448
],
"parameters": {
"sessionKey": "={{ $('Chat Trigger').item.json.sessionId }}",
"sessionIdType": "customKey",
"contextWindowLength": 10
},
"credentials": {
"postgres": {
"name": "<your credential>"
}
},
"typeVersion": 1.3
},
{
"id": "145d7f80-fb68-4084-b9cb-251afa9b3d6a",
"name": "Chat Trigger",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
-80,
0
],
"parameters": {
"options": {
"responseMode": "responseNodes"
}
},
"typeVersion": 1.4
},
{
"id": "00ef5ae6-027b-46ba-9090-3a939f627b95",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-624,
-208
],
"parameters": {
"width": 480,
"height": 512,
"content": "## n8n Workflow Generator Agent with MCP + Claude - Auto-Build & Deploy\n\n### How it works\n\n1. The Chat Trigger node initiates the workflow in response to incoming chat messages. \n2. The workflow passes the message to the AI Agent for processing. \n3. The AI Agent uses sub-nodes to interact with external services and models.\n4. The MCP Client and OpenRouter Chat Model sub-nodes handle the AI processing tasks.\n5. Postgres Chat Memory records conversation history.\n6. The Chat node finalizes the interaction and outputs the result.\n\n### Setup steps\n\n- [ ] Configure AI Agent with appropriate AI model credentials.\n- [ ] Set up database access for Postgres Chat Memory.\n- [ ] Ensure that the Chat Trigger is connected to a chat client.\n\n### Customization\n\nCustomize the AI model and connection settings in the AI Agent node to change the AI's behavior or add new functionalities."
},
"typeVersion": 1
},
{
"id": "4fb0cb6f-03c7-4583-ab6e-7783a780fbdf",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-112,
-208
],
"parameters": {
"color": 7,
"width": 720,
"height": 512,
"content": "## Initiate chat processing\n\nStarts the workflow in response to chat messages and passes it to the AI Agent for processing."
},
"typeVersion": 1
},
{
"id": "5b17bc05-3e49-4c2c-9e7f-8bb0c85e1631",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
32,
320
],
"parameters": {
"color": 7,
"width": 480,
"height": 304,
"content": "## Handle AI and memory tasks\n\nProcesses the chat message using AI services and manages chat memory."
},
"typeVersion": 1
},
{
"id": "a56af98a-d144-4f04-a5f9-081a58ba93d5",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
640,
-144
],
"parameters": {
"color": 7,
"height": 320,
"content": "## Output chat results\n\nOutputs the final processed chat result to the chat client."
},
"typeVersion": 1
},
{
"id": "5857fe8b-27e4-4c3e-b720-a2ca1729bce3",
"name": "Respond To Chat",
"type": "@n8n/n8n-nodes-langchain.chat",
"position": [
704,
0
],
"parameters": {
"message": "={{ $json.output ?? \"Something went wrong. Please try rephrasing your request.\" }}",
"options": {}
},
"typeVersion": 1.3
},
{
"id": "538c8ce8-152f-4c8b-9cad-b4e7df4edd21",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
976,
-144
],
"parameters": {
"width": 496,
"height": 320,
"content": "## \ud83d\udcfa Watch the Setup Guide\n\n@[youtube](HMXBInLaUB8)"
},
"typeVersion": 1
}
],
"connections": {
"AI Agent": {
"main": [
[
{
"node": "Respond To Chat",
"type": "main",
"index": 0
}
]
]
},
"MCP Client": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Chat Trigger": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Postgres Chat Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"OpenRouter Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"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.
httpBearerAuthopenRouterApipostgres
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Describe any automation in plain English. This AI agent builds, validates, and deploys a working n8n workflow into your instance in seconds — no node dragging, no JSON editing, no guesswork.
Source: https://n8n.io/workflows/14990/ — 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.
Aiden. Uses supabase, chat, memoryBufferWindow, memoryPostgresChat. Chat trigger; 20 nodes.
Send an AI a few details about your "Dream Customer" in normal english, then have it search the web and give you a "Dream 100" - 100 ideal prospects to connect with in your industry.
Turn any YouTube channel into a searchable knowledge base. The AI agent understands relationships between videos, topics, tools, and concepts - enabling powerful queries like "Which videos talk about
Supabase Data Analyst Agent. Uses stickyNote, chatTrigger, agent, lmChatOpenRouter. Chat trigger; 17 nodes.
Review AI-drafted customer responses before they go out. This template sets up a chat-based approval flow where an AI agent drafts a reply and a human reviewer approves or rejects it, all within the n