This workflow corresponds to n8n.io template #4150 — we link there as the canonical source.
This workflow follows the Agent → OpenRouter Chat 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": "54183edb-119c-4365-b47c-ac79f4ee2775",
"name": "Auto-fixing Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserAutofixing",
"position": [
700,
1040
],
"parameters": {
"options": {
"prompt": "Instructions:\n--------------\n{instructions}\n--------------\nCompletion:\n--------------\n{completion}\n--------------\n\nAbove, the Completion did not satisfy the constraints given in the Instructions.\nError:\n--------------\n{error}\n--------------\n\nPlease try again. Please only respond with an answer that satisfies the constraints laid out in the Instructions:"
}
},
"typeVersion": 1
},
{
"id": "c5e21204-5f21-45a4-a0bd-5726cff56263",
"name": "Structured Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
840,
1220
],
"parameters": {
"jsonSchemaExample": "{\n\"Agent Name\": \"Agent Name\",\n \"sessionID\":\"Session ID\",\n \"user input\": \"user input\"\n}"
},
"typeVersion": 1.2
},
{
"id": "c303a2b1-ced5-4377-9ba4-8f70428adfa1",
"name": "Reminder Agent",
"type": "n8n-nodes-base.executeWorkflow",
"position": [
1280,
500
],
"parameters": {
"options": {},
"workflowId": {
"__rl": true,
"mode": "list",
"value": "fdd9O6hbUriHv64J",
"cachedResultName": "Reminder Agent"
},
"workflowInputs": {
"value": {
"Query": "={{ $json.output[\"user input\"] }}"
},
"schema": [
{
"id": "Query",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Query",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "session ID",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "session ID",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"Query"
],
"attemptToConvertTypes": false,
"convertFieldsToString": true
}
},
"typeVersion": 1.2
},
{
"id": "d35aa37d-bdd5-463e-9f0c-1e71f9184953",
"name": "Agent Route",
"type": "n8n-nodes-base.switch",
"position": [
1080,
780
],
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "0693f9df-a6f6-4387-b18d-b0d59adbb735",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.output[\"Agent Name\"] }}",
"rightValue": "Reminder Agent"
}
]
}
},
{
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "6a349d7e-dc3d-458d-b7ba-6966541ca97d",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.output[\"Agent Name\"] }}",
"rightValue": "Email Agent"
}
]
}
},
{
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "5fe92e40-3150-458a-bbd9-bc36f76eaec5",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.output[\"Agent Name\"] }}",
"rightValue": "Meeting Agent"
}
]
}
},
{
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "ef6386de-61b3-4882-805f-b12126791982",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.output[\"Agent Name\"] }}",
"rightValue": "Document Agent"
}
]
}
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "51b86d8d-df0e-4d94-91c8-66ca0a9ff342",
"name": "Output Parser Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
720,
1220
],
"parameters": {
"options": {}
},
"credentials": {
"openRouterApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "c8028cb9-968f-4c1d-b12d-e51e1f54a54b",
"name": "GPT 4o Mini",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
460,
1020
],
"parameters": {
"options": {}
},
"credentials": {
"openRouterApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "c8d1de1c-2ffa-4ff8-a4d6-5ee6e23e9dda",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"position": [
240,
800
],
"parameters": {
"path": "3576c6b9-11a2-4375-b7cb-f58e36557a7b",
"options": {
"allowedOrigins": "*"
},
"httpMethod": "POST",
"responseMode": "responseNode"
},
"typeVersion": 2
},
{
"id": "a0c65c65-8262-43f9-9b32-f24912a2809c",
"name": "Reminder Agent Response",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
1500,
500
],
"parameters": {
"options": {
"responseCode": 200
},
"respondWith": "text",
"responseBody": "={{ $json.output }}"
},
"typeVersion": 1.1
},
{
"id": "6abd2c48-0f25-4b40-922e-34670c71153e",
"name": "Email Agent Response",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
1500,
700
],
"parameters": {
"options": {
"responseCode": 200
},
"respondWith": "text",
"responseBody": "={{ $json.output }}"
},
"typeVersion": 1.1
},
{
"id": "bb4f7714-4205-468e-92c1-8edb2608ec26",
"name": "Email Agent",
"type": "n8n-nodes-base.executeWorkflow",
"position": [
1280,
700
],
"parameters": {
"options": {},
"workflowId": {
"__rl": true,
"mode": "list",
"value": "zo5FcA7Jq1Vx2FuJ",
"cachedResultName": "Email Agent"
},
"workflowInputs": {
"value": {
"User Input": "={{ $json.output[\"user input\"] }}"
},
"schema": [
{
"id": "User Input",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "User Input",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"User Input"
],
"attemptToConvertTypes": false,
"convertFieldsToString": true
}
},
"typeVersion": 1.2
},
{
"id": "221bd09f-e4cd-4cda-ae35-9522745f9e63",
"name": "Postgres Chat Memory",
"type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
"position": [
580,
1020
],
"parameters": {
"sessionKey": "={{ $('Webhook').item.json.body.message }}",
"sessionIdType": "customKey"
},
"credentials": {
"postgres": {
"name": "<your credential>"
}
},
"typeVersion": 1.3
},
{
"id": "e903e5e0-49c9-4a67-b3f3-617ea0208b27",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
500,
800
],
"parameters": {
"text": "=You are a Router Agent. Your task is to decide which sub-workflow to call using the Call n8n Workflow tool. Pass the user input exactly as received using: {{ $json.body.message }}\n\n\ud83c\udfaf Available Sub-Workflows:\n\n\ud83d\udcc5 Reminder Agent:\nUse this when the user's intent is to set a time-based notification, reminder, or scheduled task.\nExamples:\n\n\u201cRemind me to go for a walk at 6 PM.\u201d\n\n\u201cSet a reminder for April 21 to make a wish.\u201d\n\n\u201cRemind me tomorrow to follow up with a client.\u201d\n\n\u2705 Even if the user mentions email, WhatsApp, or phone number as notification methods, if the core intent is a reminder, route it here.\n\n\ud83d\udce9 Email Agent:\nUse this when the main goal is to send an email, or when the user explicitly says:\n\n\u201cSend this to my email.\u201d\n\n\u201cEmail me this note.\u201d\n\n\u201cForward this to example@gmail.com.\u201d\n\n\u26a0\ufe0f Do not select this just because an email address is present \u2014 only use this if the user's intent is sending an email.\n\n\ud83d\udcc4 Document Agent\nUse this when the user wants to generate, summarize, or edit a document.\nExamples:\n\n\u201cCreate a report for last week's performance.\u201d\n\n\u201cMake a summary of this meeting.\u201d\n\n\u201cDraft a proposal.\u201d\n\n\u201cWrite this content into a Google Doc.\u201d\n\n\u2705 Ideal for document generation, formatting, summarizing, or editing via Google Docs.\n\n\ud83e\udde0 ATS Agent:\nUse this when the task is related to recruitment, like:\n\nParsing resumes\n\nExtracting candidate details\n\nMatching profiles to job roles\n\n\ud83d\udcc6 Meeting Agent:\nUse this when the user's intent is to schedule, reschedule, or confirm a meeting using email or calendar.\n\nYou are an AI meeting assistant for SentIIMenta AI. Your job is to automate meeting scheduling using emails and Google Calendar.\n\n\u2705 Routing Rules:\nOnly call one sub-workflow per request.\n\nDo not modify the user input.\n\nDo not ask follow-up questions.\n\nThere is no Router Agent all the agent name are given above.\n\nJust pass the raw message: {{ $json.body.message }}",
"options": {},
"promptType": "define",
"hasOutputParser": true
},
"executeOnce": true,
"typeVersion": 1.8
},
{
"id": "9fe41651-229f-4e87-9ff9-5a8ebe92fb2b",
"name": "Meeting Agent",
"type": "n8n-nodes-base.executeWorkflow",
"position": [
1280,
900
],
"parameters": {
"options": {},
"workflowId": {
"__rl": true,
"mode": "list",
"value": "XcVNUudXZCDEeEJN",
"cachedResultName": "Meeting Agent"
},
"workflowInputs": {
"value": {
"User Input": "={{ $json.output[\"user input\"] }}"
},
"schema": [
{
"id": "User Input",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "User Input",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"User Input"
],
"attemptToConvertTypes": false,
"convertFieldsToString": true
}
},
"typeVersion": 1.2
},
{
"id": "38a77737-bfcb-4d47-af7e-1e57601a3665",
"name": "Meeting Agent Response",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
1500,
900
],
"parameters": {
"options": {
"responseCode": 200
},
"respondWith": "text",
"responseBody": "={{ $json.output }}"
},
"typeVersion": 1.1
},
{
"id": "327aba89-42b7-476c-81d6-6598eb050730",
"name": "Document Agent",
"type": "n8n-nodes-base.executeWorkflow",
"position": [
1280,
1100
],
"parameters": {
"options": {},
"workflowId": {
"__rl": true,
"mode": "list",
"value": "EuXN7e1O3hP0KmyI",
"cachedResultName": "Document Agent"
},
"workflowInputs": {
"value": {
"User Input": "={{ $json.output[\"user input\"] }}"
},
"schema": [
{
"id": "User Input",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "User Input",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"User Input"
],
"attemptToConvertTypes": false,
"convertFieldsToString": true
}
},
"typeVersion": 1.2
},
{
"id": "a3f07618-cb55-4c53-8bfa-3044f2b9a399",
"name": "Document Agent2",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
1520,
1100
],
"parameters": {
"options": {
"responseCode": 200
},
"respondWith": "text",
"responseBody": "={{ $json.output }}"
},
"typeVersion": 1.1
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Agent Route",
"type": "main",
"index": 0
}
]
]
},
"Agent Route": {
"main": [
[
{
"node": "Reminder Agent",
"type": "main",
"index": 0
}
],
[
{
"node": "Email Agent",
"type": "main",
"index": 0
}
],
[
{
"node": "Meeting Agent",
"type": "main",
"index": 0
}
],
[
{
"node": "Document Agent",
"type": "main",
"index": 0
}
]
]
},
"Email Agent": {
"main": [
[
{
"node": "Email Agent Response",
"type": "main",
"index": 0
}
]
]
},
"GPT 4o Mini": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Meeting Agent": {
"main": [
[
{
"node": "Meeting Agent Response",
"type": "main",
"index": 0
}
]
]
},
"Document Agent": {
"main": [
[
{
"node": "Document Agent2",
"type": "main",
"index": 0
}
]
]
},
"Reminder Agent": {
"main": [
[
{
"node": "Reminder Agent Response",
"type": "main",
"index": 0
}
]
]
},
"Output Parser Model": {
"ai_languageModel": [
[
{
"node": "Auto-fixing Output Parser",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Postgres Chat Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "Auto-fixing Output Parser",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Auto-fixing Output Parser": {
"ai_outputParser": [
[
{
"node": "AI Agent",
"type": "ai_outputParser",
"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.
openRouterApipostgres
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This n8n workflow template is designed to route user input to specialized agents (like a Reminder Agent, Email Agent, etc.) using a structured output from a language model. Here's a complete description of what it does and how each part works:
Source: https://n8n.io/workflows/4150/ — 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.
Transform your WhatsApp group conversations into actionable business intelligence through automated AI analysis and daily reporting. This workflow eliminates manual conversation monitoring by capturin
🧠 A plug-and-play n8n workflow that adds LLM-powered reasoning, planning, and action to your automations — with prompts, schemas, and full agent logic included.
This workflow is for automating and centralizing your bookmarking process using AI-powered tagging and seamless integration between your Android device and a self-hosted Read Deck platform (https://re
Agent Nodes. Uses lmChatOpenAi, slack, stopAndError, errorTrigger. Event-driven trigger; 72 nodes.
🧪 LABR - nuevo asistente (REPARADO). Uses httpRequest, postgres, postgresTool, toolCalculator. Webhook trigger; 63 nodes.