使用GPT-4o Mini将用户请求路由至专业代理
高级
这是一个Support, AI, Marketing领域的自动化工作流,包含 16 个节点。主要使用 Switch, Webhook, Agent, ExecuteWorkflow, RespondToWebhook 等节点,结合人工智能技术实现智能自动化。 使用GPT-4o Mini将用户请求路由至专业代理
前置要求
- •HTTP Webhook 端点(n8n 会自动生成)
- •PostgreSQL 数据库连接信息
使用的节点 (16)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "761a3dddae2bb21eb8973ffca0ba97d5b4f499405873760164a536f547546882",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "54183edb-119c-4365-b47c-ac79f4ee2775",
"name": "自动修复输出解析器",
"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": "结构化输出解析器",
"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": "提醒代理",
"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": "代理路由",
"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": "输出解析模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
720,
1220
],
"parameters": {
"options": {}
},
"credentials": {
"openRouterApi": {
"id": "ykjF5geNxohYAYJ9",
"name": "OpenRouter account - sentiimenta.ai"
}
},
"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": {
"id": "ykjF5geNxohYAYJ9",
"name": "OpenRouter account - sentiimenta.ai"
}
},
"typeVersion": 1
},
{
"id": "c8d1de1c-2ffa-4ff8-a4d6-5ee6e23e9dda",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"position": [
240,
800
],
"webhookId": "3576c6b9-11a2-4375-b7cb-f58e36557a7b",
"parameters": {
"path": "3576c6b9-11a2-4375-b7cb-f58e36557a7b",
"options": {
"allowedOrigins": "*"
},
"httpMethod": "POST",
"responseMode": "responseNode"
},
"typeVersion": 2
},
{
"id": "a0c65c65-8262-43f9-9b32-f24912a2809c",
"name": "提醒代理响应",
"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": "邮件代理响应",
"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": "邮件代理",
"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 聊天记忆",
"type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
"position": [
580,
1020
],
"parameters": {
"sessionKey": "={{ $('Webhook').item.json.body.message }}",
"sessionIdType": "customKey"
},
"credentials": {
"postgres": {
"id": "m8rQmzG1n7ZIsxNo",
"name": "Postgres Chat Memory"
}
},
"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🎯 Available Sub-Workflows:\n\n📅 Reminder Agent:\nUse this when the user's intent is to set a time-based notification, reminder, or scheduled task.\nExamples:\n\n“Remind me to go for a walk at 6 PM.”\n\n“Set a reminder for April 21 to make a wish.”\n\n“Remind me tomorrow to follow up with a client.”\n\n✅ 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📩 Email Agent:\nUse this when the main goal is to send an email, or when the user explicitly says:\n\n“Send this to my email.”\n\n“Email me this note.”\n\n“Forward this to example@gmail.com.”\n\n⚠️ Do not select this just because an email address is present — only use this if the user's intent is sending an email.\n\n📄 Document Agent\nUse this when the user wants to generate, summarize, or edit a document.\nExamples:\n\n“Create a report for last week's performance.”\n\n“Make a summary of this meeting.”\n\n“Draft a proposal.”\n\n“Write this content into a Google Doc.”\n\n✅ Ideal for document generation, formatting, summarizing, or editing via Google Docs.\n\n🧠 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📆 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✅ 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": "会议代理",
"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": "会议代理响应",
"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": "文档代理",
"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": "文档代理2",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
1520,
1100
],
"parameters": {
"options": {
"responseCode": 200
},
"respondWith": "text",
"responseBody": "={{ $json.output }}"
},
"typeVersion": 1.1
}
],
"pinData": {},
"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
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 客户支持, 人工智能, 营销
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
AI邮件分诊与GPT-4警报系统及Telegram通知
AI邮件分诊与GPT-4警报系统及Telegram通知
If
Set
Gmail
+22
104 节点Peter Joslyn
客户支持
[模板] AI宠物店 v8
🐶 AI宠物店助手 - 集成GPT-4o、Google日历和WhatsApp/Instagram/Facebook
If
N8n
Set
+38
244 节点Amanda Benks
销售
LinkedIn自动消息路由与响应器(含请求检测)
LinkedIn自动消息路由与响应器,具备请求检测功能
If
Set
Slack
+12
52 节点Angel Menendez
客户支持
代理
使用WhatsApp、Telegram和Google Calendar的多代理AI诊所管理
Set
Switch
Webhook
+15
38 节点Luciano Gutierrez
客户支持
使用GPT-4情感分析在Notion中分析与标记用户反馈
使用GPT-4情感分析在Notion中分析与标记用户反馈
Set
Code
Merge
+10
31 节点Agent Studio
销售
销售:Android Webhooks
Android 到 N8N 自动化 | 使用 Readeck、Openrouter、SerpAPI 保存链接
If
Webhook
Http Request
+8
14 节点Udit Rawat
其他
工作流信息
难度等级
高级
节点数量16
分类3
节点类型9
作者
Dhrumil Patel
@itechdp🚀 Automation Enthusiast | n8n Creator | SaaS & AI Innovator. I'm Dhrumil Patel, founder of SentIIMenta AI. I build smart solutions using n8n to automate workflows, connect data, and boost efficiency. Passionate about AI, SaaS, and no-code tools. Let’s simplify work and create impact together! 🌐 https://sentiimenta-ai.com | 📩 founder@sentiimenta-ai.com
外部链接
在 n8n.io 查看 →
分享此工作流