This workflow corresponds to n8n.io template #4046 — 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 →
{
"id": "wgzgvKA5E4uNohoU",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "\ud83d\udece\ufe0f Taxi Service",
"tags": [
{
"id": "xofc8T2YGf1CKDRt",
"name": "Service",
"createdAt": "2025-04-29T08:57:58.323Z",
"updatedAt": "2025-04-29T08:57:58.323Z"
},
{
"id": "no8Mb078mvRgw7PS",
"name": "DEMO",
"createdAt": "2025-04-30T05:34:10.330Z",
"updatedAt": "2025-04-30T05:34:10.330Z"
}
],
"nodes": [
{
"id": "49e474fa-d9a3-4a0f-b320-11969c3d4dae",
"name": "Flow Trigger",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"position": [
-160,
120
],
"parameters": {},
"typeVersion": 1.1
},
{
"id": "66464934-d148-4039-8646-662e0ebda1d4",
"name": "Input",
"type": "n8n-nodes-base.set",
"notes": "channel_no: taxi, service_no: test",
"position": [
60,
120
],
"parameters": {},
"notesInFlow": true,
"typeVersion": 3.4
},
{
"id": "daf3f0fc-c17c-4e93-ba6a-c43c0d8c6687",
"name": "Test Trigger",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
-160,
320
],
"parameters": {},
"typeVersion": 1.1
},
{
"id": "32364c53-2e89-4327-a895-967afdfb5436",
"name": "Test Fields",
"type": "n8n-nodes-base.set",
"position": [
60,
320
],
"parameters": {},
"typeVersion": 3.4
},
{
"id": "2d158e21-339f-46b3-b52f-4e42dd5f6496",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"onError": "continueErrorOutput",
"position": [
1980,
100
],
"parameters": {},
"typeVersion": 1.9
},
{
"id": "e775814b-0650-462f-9781-310d02b75d13",
"name": "Postgres Chat Memory",
"type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
"notes": "n8n_chat_memory\n{session_id}:{timestamp}:{channel_no}\n20 CHAT, EXPIRY 60m",
"position": [
1980,
360
],
"parameters": {},
"notesInFlow": true,
"typeVersion": 1.3
},
{
"id": "f5537e4a-2ae3-45dd-9a19-bc27eb4cb9d7",
"name": "Output",
"type": "n8n-nodes-base.set",
"position": [
2840,
140
],
"parameters": {},
"typeVersion": 3.4
},
{
"id": "056c0101-aaa7-4533-9301-d1049d065e35",
"name": "Update User Session",
"type": "n8n-nodes-base.redisTool",
"notes": "TTL 5m {session_id}:session",
"position": [
2420,
360
],
"parameters": {},
"notesInFlow": true,
"typeVersion": 1
},
{
"id": "058d0923-412f-4e9b-91e5-09eda956f07d",
"name": "xAI @grok-2-1212",
"type": "@n8n/n8n-nodes-langchain.lmChatXAiGrok",
"position": [
1820,
360
],
"parameters": {},
"typeVersion": 1
},
{
"id": "7af82c88-2d4e-48b7-b8ff-52f62afaead4",
"name": "Load User Memory",
"type": "n8n-nodes-base.postgresTool",
"notes": "n8n_user_memory",
"position": [
1860,
680
],
"parameters": {},
"notesInFlow": true,
"typeVersion": 2.6
},
{
"id": "d4a06f5b-8a06-4847-92f7-1ee87f60e5ac",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
320,
0
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "df348a93-5751-47bc-b684-c3e88a020b87",
"name": "If Service Cache",
"type": "n8n-nodes-base.if",
"position": [
760,
120
],
"parameters": {},
"typeVersion": 2.2
},
{
"id": "9c3aa803-8ac2-48cf-8f87-7804a76af490",
"name": "Service Cache",
"type": "n8n-nodes-base.redis",
"notes": "TTL 15m service:{channel_no}:{service_no}:data",
"onError": "continueRegularOutput",
"position": [
540,
120
],
"parameters": {},
"notesInFlow": true,
"typeVersion": 1
},
{
"id": "8af1b728-98ca-408c-9001-f0454c0a3c51",
"name": "Load Service Data",
"type": "n8n-nodes-base.postgres",
"onError": "continueRegularOutput",
"position": [
980,
300
],
"parameters": {},
"executeOnce": true,
"typeVersion": 2.6,
"alwaysOutputData": true
},
{
"id": "b5ab2ba7-e64f-4b12-b13e-a34cf6c8ea92",
"name": "Save Service Cache",
"type": "n8n-nodes-base.redis",
"notes": "TTL 15m",
"onError": "continueRegularOutput",
"position": [
1220,
520
],
"parameters": {},
"notesInFlow": true,
"typeVersion": 1
},
{
"id": "7b599293-b2e2-4379-8a1b-636be24af175",
"name": "If Active",
"type": "n8n-nodes-base.if",
"position": [
980,
540
],
"parameters": {},
"typeVersion": 2.2
},
{
"id": "a92b6285-7a99-4839-8212-22e7dba36453",
"name": "Inactive Output",
"type": "n8n-nodes-base.set",
"notes": "Service not available.",
"position": [
980,
980
],
"parameters": {},
"notesInFlow": true,
"typeVersion": 3.4
},
{
"id": "b9f413e3-1f28-4275-a23e-14b72e085ed0",
"name": "Service",
"type": "n8n-nodes-base.set",
"position": [
1220,
100
],
"parameters": {},
"typeVersion": 3.4
},
{
"id": "48693914-6738-41cb-a0bb-214212b9f5b3",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-480,
60
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "1a562856-24ba-423c-9908-b054e570ae27",
"name": "Error Output",
"type": "n8n-nodes-base.set",
"notes": "Please retry.",
"position": [
1680,
980
],
"parameters": {},
"notesInFlow": true,
"typeVersion": 3.4
},
{
"id": "647b9d7b-a09f-403c-8273-9eae98ee5070",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
860,
880
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "08dc57ee-b1b3-4d4a-8f83-a6a125ea444f",
"name": "Save User Memory",
"type": "n8n-nodes-base.postgresTool",
"position": [
2020,
680
],
"parameters": {},
"typeVersion": 2.6
},
{
"id": "35d17795-0e79-41a5-b9aa-fdc17f42d399",
"name": "Create Route Data",
"type": "n8n-nodes-base.redisTool",
"notes": "TTL 5m {session_id}:{channel_id}:route",
"position": [
2480,
680
],
"parameters": {},
"notesInFlow": true,
"typeVersion": 1
},
{
"id": "0013383d-ae83-4dc6-a807-18c7a6a21efa",
"name": "Delete Route Data",
"type": "n8n-nodes-base.redis",
"notes": "{session_id}:{channel_no}:route",
"onError": "continueRegularOutput",
"position": [
1740,
100
],
"parameters": {},
"notesInFlow": true,
"typeVersion": 1
},
{
"id": "d6bbac8f-d959-4e2a-8f69-e652b5796060",
"name": "Route Data",
"type": "n8n-nodes-base.redis",
"notes": "TTL 5m {session_id}:{channel_id}:route",
"onError": "continueRegularOutput",
"position": [
2400,
80
],
"parameters": {},
"notesInFlow": true,
"typeVersion": 1
},
{
"id": "4bfe2d36-52fa-4d68-ad2d-dd40cf7b48b5",
"name": "If Route Data",
"type": "n8n-nodes-base.if",
"position": [
2600,
80
],
"parameters": {},
"typeVersion": 2.2
},
{
"id": "3271172c-3e41-4bd7-8296-385e33e16916",
"name": "Parse Route",
"type": "n8n-nodes-base.code",
"position": [
3040,
60
],
"parameters": {},
"typeVersion": 2
},
{
"id": "73903a6a-6a2e-4f69-81fa-4e6183d8e8d0",
"name": "Parse Service",
"type": "n8n-nodes-base.code",
"position": [
980,
100
],
"parameters": {},
"typeVersion": 2
},
{
"id": "8188696f-150a-4354-bdbc-58ed6c8fad19",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
3200,
280
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "35291999-36c5-408d-83d1-7c974cc5e46b",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
2200,
580
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "56352d75-f317-4689-9bef-a78f5aa653e9",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
1680,
580
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "5a8b070b-3d3f-4326-8b17-ac43776aba10",
"name": "Find Route Distance",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
2320,
680
],
"parameters": {},
"typeVersion": 4.2
},
{
"id": "634aca25-fa0d-470a-b618-c2795d77853d",
"name": "Reset Session",
"type": "n8n-nodes-base.redis",
"notes": "TTL 5m {session_id}:session",
"onError": "continueRegularOutput",
"position": [
1520,
100
],
"parameters": {},
"notesInFlow": true,
"typeVersion": 1,
"alwaysOutputData": false
},
{
"id": "b1419db7-a6f4-427a-bbc1-bbd1d7e20dc9",
"name": "Switch",
"type": "n8n-nodes-base.switch",
"position": [
3420,
-100
],
"parameters": {},
"typeVersion": 3.2
},
{
"id": "01503d68-8207-4f7e-a0b7-76c07d1fa6c7",
"name": "English",
"type": "n8n-nodes-base.set",
"notes": "Enter 0 to cancel",
"position": [
3660,
80
],
"parameters": {},
"notesInFlow": true,
"typeVersion": 3.4
},
{
"id": "ba2866e0-ec75-4930-ab32-d8834fbe9f94",
"name": "Chinese",
"type": "n8n-nodes-base.set",
"notes": "\u5982\u9808\u53d6\u6d88\uff0c\u8f38\u51650",
"position": [
3660,
-300
],
"parameters": {},
"notesInFlow": true,
"typeVersion": 3.4
},
{
"id": "1f2383a9-1063-41e0-a93f-57892a0fb86c",
"name": "Japanese",
"type": "n8n-nodes-base.set",
"notes": "\u30ad\u30e3\u30f3\u30bb\u30eb\u3059\u308b\u5834\u5408\u306f0\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044",
"position": [
3660,
-100
],
"parameters": {},
"notesInFlow": true,
"typeVersion": 3.4
},
{
"id": "f3b11076-6ced-49d2-ad9f-8de13f7c5986",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
3300,
-340
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "c08bb122-dc7a-4a4d-ad0b-075e5ac5cc50",
"name": "Call Back",
"type": "n8n-nodes-base.executeWorkflow",
"notes": "Demo Call Back",
"position": [
2840,
980
],
"parameters": {},
"notesInFlow": true,
"typeVersion": 1.2
},
{
"id": "c074e29a-d4a2-4111-9a2a-1ca31ceb6bf4",
"name": "Taxi Service Provider",
"type": "n8n-nodes-base.executeWorkflow",
"notes": "Taxi Service Provider NO WAIT",
"onError": "continueRegularOutput",
"position": [
3320,
440
],
"parameters": {},
"notesInFlow": true,
"typeVersion": 1.2
}
],
"active": false,
"settings": {
"timezone": "Etc/UTC",
"callerPolicy": "workflowsFromSameOwner",
"errorWorkflow": "vuso7W8t402BPcT2",
"executionOrder": "v1"
},
"versionId": "62b3d769-578e-421a-867a-4ed9d50e1220",
"connections": {
"Input": {
"main": [
[
{
"node": "Service Cache",
"type": "main",
"index": 0
}
]
]
},
"Output": {
"main": [
[
{
"node": "Call Back",
"type": "main",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "Chinese",
"type": "main",
"index": 0
}
],
[
{
"node": "Chinese",
"type": "main",
"index": 0
}
],
[
{
"node": "Chinese",
"type": "main",
"index": 0
}
],
[
{
"node": "Japanese",
"type": "main",
"index": 0
}
],
[
{
"node": "English",
"type": "main",
"index": 0
}
]
]
},
"Chinese": {
"main": [
[
{
"node": "Call Back",
"type": "main",
"index": 0
}
]
]
},
"English": {
"main": [
[
{
"node": "Call Back",
"type": "main",
"index": 0
}
]
]
},
"Service": {
"main": [
[
{
"node": "Reset Session",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Route Data",
"type": "main",
"index": 0
}
],
[
{
"node": "Error Output",
"type": "main",
"index": 0
}
]
]
},
"Japanese": {
"main": [
[
{
"node": "Call Back",
"type": "main",
"index": 0
}
]
]
},
"If Active": {
"main": [
[
{
"node": "Save Service Cache",
"type": "main",
"index": 0
}
],
[
{
"node": "Inactive Output",
"type": "main",
"index": 0
}
]
]
},
"Route Data": {
"main": [
[
{
"node": "If Route Data",
"type": "main",
"index": 0
}
]
]
},
"Parse Route": {
"main": [
[
{
"node": "Taxi Service Provider",
"type": "main",
"index": 0
},
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Test Fields": {
"main": [
[
{
"node": "Input",
"type": "main",
"index": 0
}
]
]
},
"Error Output": {
"main": [
[
{
"node": "Call Back",
"type": "main",
"index": 0
}
]
]
},
"Flow Trigger": {
"main": [
[
{
"node": "Input",
"type": "main",
"index": 0
}
]
]
},
"Test Trigger": {
"main": [
[
{
"node": "Test Fields",
"type": "main",
"index": 0
}
]
]
},
"If Route Data": {
"main": [
[
{
"node": "Parse Route",
"type": "main",
"index": 0
}
],
[
{
"node": "Output",
"type": "main",
"index": 0
}
]
]
},
"Parse Service": {
"main": [
[
{
"node": "Service",
"type": "main",
"index": 0
}
]
]
},
"Reset Session": {
"main": [
[
{
"node": "Delete Route Data",
"type": "main",
"index": 0
}
]
]
},
"Service Cache": {
"main": [
[
{
"node": "If Service Cache",
"type": "main",
"index": 0
}
]
]
},
"Inactive Output": {
"main": [
[
{
"node": "Call Back",
"type": "main",
"index": 0
}
]
]
},
"If Service Cache": {
"main": [
[
{
"node": "Parse Service",
"type": "main",
"index": 0
}
],
[
{
"node": "Load Service Data",
"type": "main",
"index": 0
}
]
]
},
"Load User Memory": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Save User Memory": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"xAI @grok-2-1212": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Create Route Data": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Delete Route Data": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Load Service Data": {
"main": [
[
{
"node": "If Active",
"type": "main",
"index": 0
}
]
]
},
"Save Service Cache": {
"main": [
[
{
"node": "Service",
"type": "main",
"index": 0
}
]
]
},
"Find Route Distance": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Update User Session": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Postgres Chat Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
}
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Template was created in n8n v1.90.2 Execute Sub-workflow Trigger node Chat Trigger node Redis node Postgres node AI Agent node If node, Switch node, Code node, Edit Fields (Set) Execute Sub-workflow Trigger: Taxi Service Workflow (or your own node) Sub-workflow: Taxi Service…
Source: https://n8n.io/workflows/4046/ — 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.
Template was created in n8n v1.90.2 Execute Sub-workflow Trigger node Chat Trigger node Redis node Postgres node AI Agent node Calculator node If node, Switch node, Code node, Edit Fields (Set) Execut
Template was created in n8n v1.90.2 Execute Sub-workflow Trigger node Chat Trigger node Redis node Postgres node AI Agent node If node, Switch node, Code node, Edit Fields (Set) Execute Sub-workflow T
Ask your PostgreSQL database complex questions and receive clear summaries, charts, and even update or insert data — all through one smart agent powered by n8n’s Model Context Protocol (MCP).
Enable AI-driven conversations with your PostgreSQL database using a secure and visual-free agent powered by n8n’s Model Context Protocol (MCP). This template allows users to ask multiple KPIs in a si
Agent Nodes. Uses lmChatOpenAi, slack, stopAndError, errorTrigger. Event-driven trigger; 72 nodes.