知识库 · AI 智能体
2、n8n 高频节点总览
n8n 高频核心节点总览,按触发、控制流、数据加工、网络、文件、存储、消息七大类梳理,配工业数字工厂类比,帮助新手快速理解每个节点用途、关键参数及常见坑位。
2、n8n 高频节点总览
2025年9月28日修改
把 n8n 当“数字工厂”:触发器是门铃、控制流是传送带切换、数据加工是工位、HTTP 是机械臂、消息节点是喇叭、存储是仓库。 目标:在专业完整的前提下,加一点点“类比幽默”,让每个新同学都能一眼懂、马上用。
1、触发类:Manual Trigger、Schedule Trigger、Interval Trigger、Webhook/Respond to Webhook、Error Trigger、Form Trigger、父工作流触发、聊天信息
类比:门铃 / 闹钟 / 值班电话
2、控制流:IF、Switch、Merge、Split In Batches(Loop Over Items)、Wait、NoOp(占位)
类比:红绿灯 / 立交桥 / 汇合口 / 分餐出锅 / 等待区 / 标识牌
3、数据加工:Set、Code(Run once/Per item)、Item Lists、Move Binary Data、Rename Keys/Keep Keys(等同类操作)
类比:白板便签 / 瑞士军刀 / 去重器 / 变形术
4、网络与 API:HTTP Request、Webhook(入站)、Respond to Webhook(出站响应)
类比:机械臂对外抓取与投递
5、文件与二进制:Read Binary File、Write Binary File、Move Binary Data
类比:原料入库 / 成品出库 / 形态转换
6、存储/知识库:Notion、Airtable、Google Sheets、MySQL/Postgres、S3(或本地持久化)
类比:货架与冷库(短存/长存)
7、消息与通知:Feishu/Lark(HTTP Webhook)、企业微信(HTTP Webhook)、Slack、Telegram
类比:广播喇叭 & 送达回执
1)触发类节点
1.Manual Trigger
1)用途:开发调试时手动启动。
2)关键参数:无。
3)示例:
2.Schedule Trigger
1)用途:按固定时间/频率运行(例:每天 09:00 拉取热点)。
2)关键参数:重复频率(分钟/小时/天/周)、具体时间点、时区(默认跟随 n8n 设置)。
3)示例:每天 09:00 运行;每 10 分钟运行一次。
4)常见坑:
忘记时区,结果在服务器时区触发;
方法 1:改 n8n 全局时区(推荐)
如果是 Docker 部署,启动时加环境变量:
代码块
-e GENERIC_TIMEZONE="Asia/Shanghai"如果是本地安装,可以在 .n8n/config 或系统环境变量里加同样的设置。
方法 2:Cron 时间换算
保留默认 UTC 时区,但手动把触发时间换算成 UTC,比如要每天北京时间 9:00,就设成 UTC 1:00(冬令时)或 UTC 1:00(夏令时同)。
与第三方 API 速率限制冲突(建议配合 Split In Batches + Wait)。
假设目标 API 限制 每秒最多 5 次请求:
用 Split In Batches → 每批 5 条数据(对应 5 个请求)
每批之间加一个 Wait 节点 → 延迟 1 秒
n8n 流程就会变成:5 条 → 等 1 秒 → 5 条 → 等 1 秒
这样就稳定在 每秒 5 次请求,永远不会超。
小贴士:长任务加“执行锁”避免重叠(启动先查锁→无锁创建→结束必删)。
3.Webhook / Respond to Webhook
1)用途:被动接收外部请求(如 Coze 回调、Http请求),并返回即时响应。
2)关键参数:HTTP 方法(GET/POST)、路径、响应模式(立即返回 / 等最后节点)、安全(凭证/白名单)。
3)表达式示例:直接输入网址,或者从进入的 JSON 取字段 {{$json.text}}(或 {{$json.body?.text?.content}} 视来源而定)。
4)常见坑:
测试 URL 与生产 URL 不同;发布后未切到 Production; (工作流要是active模式)
未勾选“Response Data”或 Respond to Webhook 配置不当,客户端超时。
实战建议:IM 场景用 On Received,立刻接一个 Respond to Webhook 回复“收到,处理中…”,后台继续跑主流程。
4.Error Trigger(错误工作流)
1)用途:任一工作流报错时触发,集中告警、记录。
2)关键参数:无。
3)常见坑:忘启用 → 出错没人知道;建议推送到 Slack/飞书并附简要上下文。
5. MCP Trigger(把 n8n 变成可被 Agent 发现与调用的“工具服务器”)
1)用途
让 n8n 暴露一组“工具(tools)”,供外部 MCP 客户端(如 Claude Desktop 等)发现 → 列表 → 调用。
它不是普通触发器的直线输出,而是只连接 Tool 类节点(如 Custom Code Tool、Call n8n Workflow Tool、MCP Client Tool)来对外提供功能目录。
2)关键参数/概念
URLs:节点会给出 Test URL(测试时生效)与 Production URL(工作流激活后生效)。MCP 客户端要连其中一个。
Authentication:支持 Bearer/自定义 Header,强烈建议开启;客户端请求需携带同样的认证。
Tools:必须在触发器下方连接至少一个 Tool 节点,否则客户端只能看到空目录。常见:
Custom Code Tool:自定义 JS 逻辑对外暴露;
Call n8n Workflow Tool:把现有工作流封装为工具;
MCP Client Tool:从 n8n 内部再去调用外部 MCP Server 的工具(级联)。
3)常见坑
连了非 Tool 节点:MCP 端看不到工具(必须是“Tool”类型的子节点)。
没认证或认证不匹配:客户端 401;确认 Bearer/自定义头一致。
反向代理/多副本把连接切走:MCP 使用 SSE/HTTP Streamable,长连接要关掉 proxy buffering,并把 MCP 请求固定路由到同一副本。
只点了保存没“激活”或没“Execute/Test”:Test URL 需在测试时“开始监听”,生产 URL 需激活工作流后才可用。
在这里设置好后可以通过cherrystudio等工具外部调用MCP服务,拥有该能力
5.Form表单触发器
1)用途
在 n8n 内置一个可访问的表单页面(有 Test/Production 两个 URL),用户在浏览器里填写并提交;
表单提交后把字段作为 items 输出到工作流,后续可入库、发通知、走审批等。
适合:训练营报名/收集线索/内部工具表单/反馈收集。
2)关键参数(常见)
Path:表单访问路径(自动生成 Test/Prod 两个 URL);
Form Title / Description:页面标题与说明;
Fields:字段列表(name、label、type、required、options 等);
Require Auth(如果有):可选的访问保护(有的部署会接 SSO/Basic);
Success 文案/重定向(不同版本选项略有区别):提交后显示成功提示或跳转到指定 URL。
提交成功后,表单节点本身会给用户一个成功页/提示;工作流里你继续做落库、推送等“后台处理”,不需要再用 Respond to Webhook。
3)常见坑
用错 URL:编辑器里有 Test URL 和 Production URL,发布上线必须用 Production URL;
字段名/类型不统一:后续节点引用用 {{$json.<name>}},建议先用 Set(Keep Only Set) 做一层标准化;
必填校验只在前端:后端仍要防御性判断(IF 判空),避免空值写入 DB;
文件上传:Form Trigger 是轻量表单,不等同于复杂上传控件(需要文件时,考虑 Webhook + 自建前端或使用外部表单服务对接)。
2)控制流节点
1、If(红绿灯)
1)用途
按条件把数据路由到 true / false 两条分支;常用于前置校验、API 成功/失败分流、阈值过滤(如“得分 > 0.8 才入库”)。
2)关键参数
Conditions:支持 string/number/boolean/date 等比较;可写表达式。
Combine Conditions:AND(且)/OR(或)。
3)表达式示例
4)常见坑
undefined 参与比较 → 用 ?? '' 或 ?? 0 兜底。
字符串/数字混用 → 先统一类型:{{ +$json.count }} 或 {{ String($json.id) }}。
5)实践建议
HTTP Request 勾选 Continue On Fail + If 判断 statusCode === 200 → 失败走告警/重试支路,不会炸整条链路。
2、Switch(立交桥)
1)用途
按某字段的不同取值,路由到多个互斥分支;适合多渠道分流、事件类型分发、LLM 工具选择。
2)关键参数
Rules:每个取值一条规则;支持 equals/contains/regex;Default 兜底。
3)示例
{{ $json.channel }} → feishu / wechat / telegram(Default:未知渠道)
4)常见坑
大小写/空白不统一 → 先用 Set 清洗:{{ ($json.channel ?? '').trim().toLowerCase() || 'unknown' }} 或者勾选忽略大小写
忘配 Default → 未命中值直接丢失。
3、Merge(汇合点)
1)用途
把来自不同分支的结果合流到一条数据流上,便于后续统一处理(例如:A 路抓“用户档案”,B 路抓“订单/评分”,在此处汇总为同一条记录)。注意:两侧分支都可用时才会输出(除“Choose Branch”外)。
2)关键参数(模式)
Append(追加)
含义:把两侧输入的 items 直接拼接成一个数组,不做对齐与合并。
场景:把两路相同结构的数据合并为一个更大的列表(如多页爬取结果合并为一个列表)。
易错点:后续节点如果期待“一条记录包含 A+B 两侧字段”,用 Append 会得两条分开的记录,无法在一条里取到两侧字段。
Combine(组合)
含义:把 A、B 两侧输入的对应记录合并为同一条 item。常见子策略(名称可能因版本翻译略有差异):
位置:根据项的顺序合并
匹配字段:合并具有相同字段值的项。按指定键字段(如 trace_id/userId)进行对键合并;键值相同的项会被并到一条记录里。
场景:
并行工具聚合:A 路拿“用户档案”,B 路拿“订单统计” → 以 userId 匹配字段 合并,得到一条完整用户记录。
API 双源补全:A 路是主数据,B 路是补充字段(如地理位置/风控结果)→ 用 匹配字段 以 id/trace_id 合并。
分页并行同序:同一列表被拆成两路并行获取,返回顺序稳定 → 用 位置 直接对齐合并。
易错点:
顺序未对齐就用“位置”:会把错的人/错的订单合在一起 → 先 Sort 或改用匹配字段。
键类型不一致:'123'(字符串)与 123(数字)无法匹配 → 先在 Set 统一:{{ String($json.key) }}。
同名字段被覆盖:两侧都有同名 key(如 status),合并时一侧会覆盖另一侧 → 上游先 Rename Keys 或在 Set 重命名为 status_a/status_b。
两侧数量不等:未匹配的项如何处理在不同版本/配置下行为可能不同(只输出匹配对、或保留一侧字段)→ 最稳妥是补齐/裁剪或用 SQL Query 明确写出期望的联结方式(LEFT/INNER 等)。
嵌套/数组字段:结构差异会导致合并结果难用 → 上游先扁平化/标准化字段(Set(Keep Only Set))。
小贴士:能用匹配字段就尽量不用“位置”;选择一个稳定、全局唯一的 join key(trace_id / userId / messageId)几乎可以消灭 80% 的合并问题。
SQL Query(SQL 合并/筛选)
含义:把两侧输入临时映射成两张“表”,通过SQL 语句进行 JOIN / WHERE / SELECT 等操作,得到结果集后输出为 items。
场景:需要复杂联结/过滤/投影时(例如:左连接取主表全量,再筛掉近 30 天无订单的用户)。
常见写法(示意):
典型左连接:
代码块
SELECT a.userId, a.name, COALESCE(b.total, 0) AS total
FROM input_a AS a
LEFT JOIN input_b AS b
ON a.userId = b.userId
WHERE a.status = 'active'注:不同版本中临时表别名可能为 input_a/input_b 或 UI 指定名称,请以节点提示为准;字段以扁平 JSON 字段为列访问。
易错点:
大数据量在内存中做 SQL 可能耗时/占内存,必要时先用 Item Lists/Set 做字段裁剪;
键类型不一致会 JOIN 失败;
字段名含点/嵌套结构时需先规范化字段(上游 Set(Keep Only Set))。
Choose Branch(择一路透传)
含义:从 A 或 B 选择一侧数据直接透传,不做合并;常用于主备/回退策略:主路失败则选备路。
选择规则(依版本可配置):
固定选 1 / 固定选 2;
优先有数据的一侧(另一侧为空就用这一侧);
结合上游 If:把“成功的一侧”接到 A,“失败结果”接到 B,在此处统一只透传 A。
场景:主 API 超时/报错 → 走备 API;在 Merge 处只保留“可用”的那一路。
易错点:误以为能“合并字段”,实际上只是单路选择;若要字段合并请用 Combine/SQL。
3)选型建议(怎么选最稳)
需要把两侧字段“拼成一条记录”:优先 Combine → 匹配字段(键如 trace_id/userId/messageId)。
需要做条件/聚合/复杂联结:用 SQL Query,写清 JOIN 与过滤;结果字段尽量精简。
只是把两侧列表合成一个更大列表:用 Append。
主备/回退,只保留一侧:用 Choose Branch。
4)调试与排错小抄
合并前打印关键字段:在上游 Set 输出 trace_id/userId,保证类型一致再合并。
合并后检查样例:用 NoOp + Pin Data 或 Respond to Webhook 回显,看是否达成“一条记录含两侧字段”。
复杂规则先小样本验证:在 SQL 模式里 LIMIT 10 观察结构,确认 OK 再放大数据量。
4、Split In Batches(Loop Over Items,分批处理器)
1)用途
把输入按 Batch Size 切成小批循环处理;常用于限流、分页、逐条入库。
2)关键参数
Batch Size(每批条数)。
尾部用 If 判断“是否还有剩余”并回跳到 Split,形成 while 循环。
3)常用模式
“列表去重→入库”:每批 10 → 入库 → Wait 1s → 回跳 Split。
“API 分页”:保存 nextCursor;存在则回跳继续拉取。
4)常见坑
忘记回跳 Split → 只跑第一批;
批内外部 API 未限速 → 触发 429;配合 Wait 或减小批量。
5、Wait(等灯器)
1)用途
延时(Delay)、等待到指定时间(Wait Until)、或收到 Webhook 回调、表单提交后再继续。
2)关键参数
等待时长/目标时间,等待单元;
3)常见坑
长时间等待占用执行资源 → 拆成上下两段流程;上半段回执并记录状态,下半段由 Cron/Webhook 重新触发。
6、Stop and Error(急刹车)
1)用途
在流程中主动抛错并终止执行;用于强校验、保护性中断、显式失败。
2)关键参数
Error Message(可引用变量);
3)实践建议
调试时在复杂分支末端放一个 Stop and Error,快速定位异常路径。
7、Execute Sub-workflow(子流程调用)
1)用途
在当前工作流中调用另一个工作流,实现模块化/微服务化(把通用逻辑抽成子流程)。
2)关键参数
目标工作流 ID/名称;
传参方式(JSON/表达式);
是否等待子流程完成并返回结果。
3)常见坑
子流程未允许外部调用或入参名不一致;
输出结构与上游假设不匹配 → 先用 Set(Keep Only Set) 统一字段。
8、Compare Datasets(比较器)
1)用途
对比两个输入数据集的变化,输出新增/删除/更新项;适合“增量推送”。
2)关键参数
主键字段(唯一标识);
对比方式(仅存在性变化 / 值变化)。
3)应用场景
新闻/商品/库存的“只推新增”;
同步前后差异对账。
9、Filter(筛选器)
1)用途
按条件移除/保留特定 items(轻量过滤器);与 If 的双路分支不同,Filter 更像“只输出想要的”。
2)关键参数
条件(字段/表达式);
组合方式:AND/OR。
3)示例
仅保留有标题的
4)常见坑
误把 Filter 当 If 用(需要两路分流请用 If);
条件写在错误字段路径 → 先用 Set 统一字段名后再过滤。
3)数据转换节点
1、Set(白板便签:短期记忆)
1)用途:新增/覆盖字段、重命名、类型转换;勾 “Keep Only Set” 做字段瘦身。
2)表达式示例:
标准化标题:titleStd = {{$json.title.trim()}}
生成唯一键:uid = {{ $json.source + '-' + $json.id }}
3)常见坑:
勾选“Include Other Input Fields”,脏字段混入下游;
表达式返回 undefined(用 ?? '' 兜底)。
多轮对话缓存(放在值里用表达式):
代码块
{{ ($json.conversation_history || []).concat([
{ "role": "user", "content": $json.user_text },
{ "role": "assistant", "content": $json.ai_reply }
]) }}2、Code(瑞士军刀:必要时出鞘)
1)用途:复杂逻辑/批量变换/一次性聚合。
2)关键参数:执行模式(Per item / Run once for all items)。
3)常用片段:
按标题去重
代码块
// Run once for all items
const incoming = $input.all();
const existedTitles = new Set($json.existedTitles || []); // 上游注入
const result = [];
for (const item of incoming) {
const t = (item.json.title || '').trim();
if (!t || existedTitles.has(t)) continue;
existedTitles.add(t);
result.push(item);
}
return result;为 Notion/DB 生成批量插入 payload
代码块
return $input.all().map(i => ({
json: {
title: i.json.title,
url: i.json.url,
hash: require('crypto').createHash('md5').update(i.json.url).digest('hex'),
}
}));4)常见坑:
Run once for All Items(一次性为所有项目运行) 与Run Once for Each Item(为每个项目运行一次) 混淆(聚合/去重用 Run once);
Docker 环境不能直接写宿主机:写入挂载卷(如 /data/files)。
3、Move Binary Data(变形术:JSON ↔ Binary)
1)用途:JSON/Base64 与二进制互转(图像/视频/音频)。
2)典型用法:
Base64 → Binary:Property Name: image;Data Property: data[0].b64_json(直接填路径,不是表达式)。
Binary → JSON:反向设置,便于下游 API 传文本。
3)常见坑:
路径误用表达式;
Binary 名与下游 HTTP 的 Send Binary Data 字段不一致(两边都叫 image)。
4)网络与 API 节点
1、HTTP Request(机械臂)
1)用途:万能对接器(Firecrawl、Notion API、检索、推送、鉴权)。
2)关键参数:Method、URL、Authentication(API Key/Bearer/OAuth2)、Query、Body(JSON/Form-Data)、Response(只 Body/完整响应)、Send Binary Data(上传文件),Options(Retry、Timeout、Batching)。
3)常用模式:
上传文件:勾 Send Binary Data,Binary Property 指向 image;
重试与限流:Options → Retry On Fail、Max Attempts、Retry Delay。
4)示例:Firecrawl 搜索
Method: GET
Query: q={{$json.keyword}}、limit=10
Headers: Authorization: Bearer xxx
5)示例:Notion 创建页面
Method: POST
Headers: Authorization: Bearer {{ $json.notionToken }}
Body(JSON):
代码块
{
"parent": {"database_id": "{{ $json.dbId }}"},
"properties": {
"Name": { "title": [{ "text": { "content": "{{$json.title}}" } }] },
"URL": { "url": "{{$json.url}}" }
}
}6)常见坑:
Notion 标题属性必须是 title 类型且属性名精确匹配(常叫 Name);
忘勾 Continue On Fail 导致整条链路中断。
容错三件套:Continue On Fail ✔ → IF 判 statusCode==200 → 错误分支:重试/报警/降级。
2、Webhook / Respond to Webhook
见“触发类”章节(入站/出站搭配)。
5)文件与二进制
1、Read Binary File / Write Binary File
1)用途:从挂载卷读写文件(Docker 推荐挂载 /data/files)。
2)关键参数:文件路径(容器内路径,非宿主机路径)。
3)示例:写入 /data/files/news.mp4 供下游上传。
4)常见坑:
Windows 宿主机路径 E:\n8n\n8n 需用 -v "E:/n8n/n8n:/data/files" 映射到容器;节点里统一用 /data/files/...(如 "/data/files/news.mp4")。
2、Move Binary Data
上文已详解。
6)存储/知识库连接
1、Notion
1)用途:结果归档、知识库沉淀。
2)关键参数:Integration Token、Database ID、属性映射。
3)常见坑:
不能按标题直接“更新”,需先搜索 Page ID 再 Update;
Rich text / title / select / multi-select 类型混用错误。
该Notion数据库没有添加n8n的集成,导致连接失败
2、Google Sheets / Airtable
1)用途:数据看板与轻量数据库。
2)坑:API 配额/速率限制 → Split In Batches + Wait。
3、MySQL/Postgres
1)用途:结构化数据持久化(去重高效)。
2)建议:建唯一索引(如 url_hash)从 DB 层防重复。
向量数据库线上平台推荐使用 pinecone:https://www.pinecone.io/
4、Google Storage/S3/本地持久化
1)用途:大文件归档、视频/图片存储。
2)建议:返回在云上,用可公开访问的 URL 供前端/消息使用。(要开对应的云存储相关功能)
5、Feishu(存储 / 知识库|与 n8n 的数据转换与落地)
1)用途
把 n8n 工作流产出的结构化数据与二进制文件可靠落地到飞书的多维表格(Bitable)、Docs/Drive、Wiki,形成团队可检索、可协作的知识库;并把上传返回的 file_key / image_key / file_token 等标识回写到数据表中,供后续复用(消息、卡片、审批等)。
2)关键参数
鉴权与凭证:飞书自建应用的 App ID / App Secret(n8n 里配置 Credential,用于换取 tenant_access_token 调用服务端 API)。
接口与权限(Scopes):
体积与格式限制:
3)实际案例(n8n 可落地的三条标准流水线)
A|热点资讯 → Bitable(结构化沉淀)
规范化字段(Set/Code)。
HTTP Request 调 Bitable “批量新增记录”:POST /open-apis/bitable/v1/apps/{app_token}/tables/{table_id}/records/batch_create,单次最多 1000 条。(Lark Office)
把返回的 record_id 存回 n8n 流里,便于后续更新/去重。
‘’B|PDF 报告 → Drive(文件存储) → 回写 Bitable 链接
把报告转为 Binary(Move Binary Data / Read Binary File)。
在 Bitable 记录里新增“文件/链接”字段,回写 file_token 对应的可访问 URL 或文档引用。
C|图片(如封面图) → im/v1/images(拿 image_key) → 记入表格
JSON→Binary:binary.image。
把 image_key 存入 Bitable 的“封面图 key”字段;后续在消息卡片/审批里直接复用,无需重复上传。
备注:上述三条流水线可混搭——例如把 B 的 file_token 和 C 的 image_key 一起写入 A 中新增的记录,实现“结构化元数据 + 物料引用”的统一存档。
4)常见坑
Binary 名称不一致:上游二进制属性叫 image,HTTP/节点里却填了 file → 上传报“找不到文件”;确保 Binary Property 与字段名一致。
Wiki/Docs 与文件混用:把文件直接当“消息文件”上传后,去 Docs/Wiki 侧引用时发现不通用;知识库/文档场景优先走 Drive(file_token),消息侧素材优先走 image_key/file_key,按场景选接口。(Feishu)
小结:把“数据进 Bitable + 文件进 Drive(或 IM) + 把 key/token 回写到表”作为统一落地范式,既满足知识库的可检索与权限,又保证二进制资源在飞书生态内可复用、可追溯。
7)消息与通知
1、Feishu/Lark(HTTP Webhook 机器人)
1)POST 到群机器人的 Webhook。
2)Body 示例(文本):
代码块
{
"msg_type": "text",
"content": { "text": "【通知】新热点:{{$json.title}}\n链接:{{$json.url}}" }
}
3)Body 示例(卡片):使用 interactive card JSON。
代码块
{
"msg_type": "interactive",
"card": {
"schema": "2.0",
"config": {
"update_multi": true,
"style": {
"text_size": {
"normal_v2": {
"default": "normal",
"pc": "normal",
"mobile": "heading"
}
}
}
},
"body": {
"direction": "vertical",
"padding": "12px 12px 12px 12px",
"elements": [
{
"tag": "markdown",
"content": "{{ $json.output ? JSON.stringify($json.output).slice(1, -1) : '' }}",
"text_align": "left",
"text_size": "normal_v2",
"margin": "0px 0px 0px 0px"
}
]
},
"header": {
"title": {
"tag": "plain_text",
"content": "AI News"
},
"subtitle": {
"tag": "plain_text",
"content": ""
},
"template": "blue",
"padding": "12px 12px 12px 12px"
}
}
}
4)常见坑:需把机器人拉群;部分租户需启用白名单。
2、企业微信(HTTP Webhook)
1)Body 示例:
代码块
{
"touser" : "UserID1|UserID2|UserID3",
"toparty" : "PartyID1|PartyID2",
"totag" : "TagID1 | TagID2",
"msgtype" : "text",
"agentid" : 1,
"text" : {
"content" : "你的快递已到,请携带工卡前往邮件中心领取。\n出发前可查看<a href=\"https://work.weixin.qq.com\">邮件中心视频实况</a>,聪明避开排队。"
},
"safe":0,
"enable_id_trans": 0,
"enable_duplicate_check": 0,
"duplicate_check_interval": 1800
}2)提示:部分场景需自建应用 + 获取 access_token。
3、Slack / Telegram
1)直接用官方节点或 Webhook;Telegram 需 Bot Token + Chat ID。
8)错误处理与监控(强烈建议默认配置)
1)节点级重试:HTTP → Options → Retry On Fail(指数退避:1s → 2s → 4s …)。
2)工作流级 Try/Catch:
关键节点勾 Continue On Fail → IF 判断 {{$json.error}} 分支到告警。
3)Error Trigger 告警工作流:
Slack/飞书推送错误摘要(workflow 名、节点名、报错文本、输入片段)。
4)审计与观测:
关键节点记录 traceId、耗时、批量数量(写 DB 或日志)。
5)常见线上事故速定位:
API 限流:看 429/403,增加等待与批处理;
字段变更:下游 Notion/DB 属性名改动;
二进制失败:Binary 名与表单字段不一致;
挂载路径错误:容器内外路径未对齐(统一 /data/files)。
9)可复用标准片段
1、标题去重 + 批量入库(Notion 版)
流程:Notion Search 拉 DB 近 N 条标题 → Code(Run once)去重 → Notion Create Page。
DB:加唯一字段(如 url_hash),写入冲突走失败分支,不中断整体。
代码块
{
"name": "My workflow 6",
"nodes": [
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
-224,
8
],
"id": "04f4bfa2-b204-447a-afdf-bcf91ab1e981",
"name": "Manual Trigger"
},
{
"parameters": {
"jsCode": "const items = [ { json: { title: \"示例A\", url: \"https://example.com/a\" }}, \n { json: { title: \"示例B\", url: \"https://example.com/b\" }}];\nreturn items;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
0,
8
],
"id": "ee09cdb5-32ce-427d-92ce-13cf7b5292bf",
"name": "Code|生成待入库项"
},
{
"parameters": {
"resource": "databasePage",
"operation": "getAll",
"databaseId": "YOUR_NOTION_DATABASE_ID",
"options": {}
},
"type": "n8n-nodes-base.notion",
"typeVersion": 2,
"position": [
208,
-192
],
"id": "04538836-db02-447a-ba57-62a74e9af730",
"name": "Notion|Query 最近100条",
"credentials": {
"notionApi": {
"id": "qlqMpY4lIuX0Wu2u",
"name": "Notion account"
}
}
},
{
"parameters": {
"jsCode": "const incoming = $items(\"Code|生成待入库项\");\nconst existed = $items(\"Notion|Query 最近100条\");\nconst existedTitles = new Set();\nfor (const it of existed) { \n // 请把 'Name' 替换为你的 title 属性名称\n const blocks = (((it.json || {}).properties || {}).Name || {}).title || [];\n const t = (blocks[0]?.plain_text || \"\").trim(); \n if (t) existedTitles.add(t);\n}\nconst result = [];\nfor (const it of incoming) { \n const t = (it.json.title || '').trim();\n if (!t || existedTitles.has(t)) continue;\n result.push({ json: it.json });\n}\nreturn result;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
448,
8
],
"id": "8a5c4e09-421c-4c4a-b1d6-0dd97bbe97df",
"name": "Code|交叉去重"
},
{
"parameters": {
"resource": "databasePage",
"databaseId": "YOUR_NOTION_DATABASE_ID",
"propertiesUi": {
"propertyValues": [
{
"key": "Name",
"type": "title",
"title": [
{
"text": {
"content": "={{ $json.title }}"
}
}
]
},
{
"key": "URL",
"type": "url"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.notion",
"typeVersion": 2,
"position": [
672,
8
],
"id": "c7242b23-211a-4bf5-bbda-a92d2b9934ec",
"name": "Notion|Create Page",
"credentials": {
"notionApi": {
"id": "qlqMpY4lIuX0Wu2u",
"name": "Notion account"
}
}
}
],
"pinData": {},
"connections": {
"Manual Trigger": {
"main": [
[
{
"node": "Code|生成待入库项",
"type": "main",
"index": 0
}
]
]
},
"Code|生成待入库项": {
"main": [
[
{
"node": "Notion|Query 最近100条",
"type": "main",
"index": 0
},
{
"node": "Code|交叉去重",
"type": "main",
"index": 0
}
]
]
},
"Notion|Query 最近100条": {
"main": [
[
{
"node": "Code|交叉去重",
"type": "main",
"index": 0
}
]
]
},
"Code|交叉去重": {
"main": [
[
{
"node": "Notion|Create Page",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "be33e7a4c93bf3fbad46ee9dd2261c1867b920251d4e05c1a2fedf55455fa8e4"
},
"tags": []
}2、限速发消息(飞书)
流程:Split In Batches = 20 → 循环尾部 Wait 1000ms → 发 20 条再等 1 秒,避免风控。
代码块
{
"name": "My workflow 6",
"nodes": [
{
"parameters": {
"jsCode": "const msgs = [];\nfor (let i=1;i<=55;i++) \n msgs.push({ json: { text: `第 ${i} 条测试消息` }});\nreturn msgs;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1696,
704
],
"id": "c7a11a11-0aee-46f3-9410-6c6d982c0732",
"name": "Code|生成消息列表"
},
{
"parameters": {
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3,
"position": [
1920,
704
],
"id": "e6a62887-610c-4fc8-9f68-904ed32d9b23",
"name": "Set|Webhook"
},
{
"parameters": {
"batchSize": 20,
"options": {}
},
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 2,
"position": [
2144,
704
],
"id": "a0997f00-b7b6-4c08-abc8-52432e5b1ae1",
"name": "Split In Batches|20"
},
{
"parameters": {
"amount": 1000,
"unit": "milliseconds"
},
"type": "n8n-nodes-base.wait",
"typeVersion": 1,
"position": [
2592,
776
],
"id": "c0e2cf7c-ac43-4249-abb8-bae6fd78b442",
"name": "Wait|1s",
"webhookId": "bff92fb1-8003-481f-b72f-9885468963c2"
},
{
"parameters": {},
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
2368,
512
],
"id": "1324dedf-81f4-4cc6-bd53-2bbde2c99106",
"name": "NoOp|完成"
},
{
"parameters": {
"method": "POST",
"url": "https://open.feishu.cn/open-apis/bot/v2/hook/",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"msg_type\": \"interactive\",\n \"card\": {\n \"schema\": \"2.0\",\n \"config\": {\n \"update_multi\": true,\n \"style\": {\n \"text_size\": {\n \"normal_v2\": {\n \"default\": \"normal\",\n \"pc\": \"normal\",\n \"mobile\": \"heading\"\n }\n }\n }\n },\n \"body\": {\n \"direction\": \"vertical\",\n \"padding\": \"12px 12px 12px 12px\",\n \"elements\": [\n {\n \"tag\": \"markdown\",\n \"content\": \"{{ $json.output ? JSON.stringify($json.output).slice(1, -1) : '' }}\",\n \"text_align\": \"left\",\n \"text_size\": \"normal_v2\",\n \"margin\": \"0px 0px 0px 0px\"\n }\n ]\n },\n \"header\": {\n \"title\": {\n \"tag\": \"plain_text\",\n \"content\": \"AI News\"\n },\n \"subtitle\": {\n \"tag\": \"plain_text\",\n \"content\": \"\"\n },\n \"template\": \"blue\",\n \"padding\": \"12px 12px 12px 12px\"\n }\n }\n}\n",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
2368,
704
],
"id": "cd2c6f48-ecaf-4399-a0e5-4fb6a93bbf4d",
"name": "HTTP 飞书机器人"
}
],
"pinData": {},
"connections": {
"Code|生成消息列表": {
"main": [
[
{
"node": "Set|Webhook",
"type": "main",
"index": 0
}
]
]
},
"Set|Webhook": {
"main": [
[
{
"node": "Split In Batches|20",
"type": "main",
"index": 0
}
]
]
},
"Split In Batches|20": {
"main": [
[
{
"node": "HTTP 飞书机器人",
"type": "main",
"index": 0
}
],
[
{
"node": "NoOp|完成",
"type": "main",
"index": 0
}
]
]
},
"Wait|1s": {
"main": [
[
{
"node": "Split In Batches|20",
"type": "main",
"index": 0
}
]
]
},
"HTTP 飞书机器人": {
"main": [
[
{
"node": "Wait|1s",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "be33e7a4c93bf3fbad46ee9dd2261c1867b920251d4e05c1a2fedf55455fa8e4"
},
"tags": []
}3、Base64 图片落地并上云
流程:Move Binary Data(JSON→Binary) → Write Binary File(/data/files/{{ $json.id }}.png) → HTTP 上传 S3/OSS → 可选 Code 删除本地临时文件(指向挂载卷)。
代码块
10)表达式速查(最常用 10 条)
1、当前项字段:{{$json.title}}
2、上游节点字段:{{$node["节点名"].json.url}}
3、三目/合并空值:{{ $json.title ?? '无标题' }}
4、时间:{{ $now }} / {{ $today }} / {{ $fromNow(3600) }}
5、拼接:{{ $json.a + '-' + $json.b }}
6、数组长度:{{ $json.list.length }}
7、取数组第一个:{{ $json.list[0] }}
8、当前批次索引:{{ $itemIndex }}
9、跨节点取所有 items:{{ $items("节点名").map(i => i.json.id) }}
10、环境变量:{{ $env["MY_TOKEN"] }}
11)节点选型清单
1、要按时运行:Cron / Schedule Trigger
2、要被动接收:Webhook + Respond to Webhook
3、要限速/分页:Split In Batches + Wait
4、要清洗字段:Set(Keep Only Set)
5、要复杂加工/去重/聚合:Code(Run once for all items)
6、要接 API:HTTP Request(Retry/Download/Send Binary)
7、要落知识库:Notion / Sheets / DB(优先 DB 做唯一索引)
8、要发通知:飞书/企业微信 Webhook(HTTP)
9、要存文件:Write Binary File(容器路径 /data/files)
10、要兜底告警:Error Trigger + 消息通知
(附)把这些节点拼成“可思考”的骨架
Webhook/Cron(感知) → Context Loader(读上下文:DB/向量库) → LLM-Planner(输出 tool_name/params,JSON Mode) → Switch(路由工具) → Tools(HTTP/Code/DB) → Merge(按 trace_id 汇总) → LLM-Reflector(自检/纠错建议) → IF(通过则出、失败重试/降级) → Respond/消息发送(输出)
记住这条“乐高骨架”,你的工作流就不再是脚本,而是有节律、有记忆、会反思的小智能体。
12)补充 新节点
为了保证准确性,以下内容均对照了 n8n 官方文档与近期更新:AI Agent Tool、Model Selector、评估指标(Evaluation 节点与 Evaluations 面板)、以及“转换为子工作流”。文末每段给出对应出处,便于你继续深挖与上手。
1、AI Agent Tool 节点(多代理编排的“分工台”)
1)用途
把另一个 AI Agent 当作“工具”挂到主 Agent 下,实现单画布内的多代理编排(主代理统筹、下游代理各司其职)。适合“主管 → 多个专家”的组织式拆解;也支持多层级代理(代理调用代理)。
Prompt(User message):给该工具代理的任务指令;
System message(可选):设定角色/边界;
Require specific output format:强制关联一个Output Parser,保证结构化输出;
Enable fallback model:主模型异常时可切到备用模型;
Max iterations:该工具在一次调用中的最大推理/行动轮次;
Return intermediate steps:输出中包含中间思考/调用步骤;
Automatically passthrough binary images:自动将上游二进制图片透传给代理;
Batch processing:批大小与批间延时(当工具需对多 item 处理)。
注:子节点表达式解析在 AI 系列“sub-nodes”里与普通节点不同——表达式默认解析第一个 item。多项输入时要留意(例如 {{$json.name}} 不会逐项展开)。
3)使用建议(模式)
主代理(AI Agent)+多个 AI Agent Tool:主代理先规划再委派;必要时打开 Return intermediate steps 做可观测性。
严格输出:工具侧勾选 Require specific output format 并挂 Structured Output Parser,工具→Switch→后续工具/HTTP 更稳定。 (n8n Docs)
4)常见坑
在批处理场景忘记设置 Batch processing,导致速率异常;
工具链路使用了多个子节点表达式,因“只解析首项”导致取值错位(用上游聚合/Set 统一后再传入)。
2、内置 AI 评估(Evaluation 节点 + Evaluations 视图)
1)用途
给 AI 工作流打分与回归测试:把每次输出写回数据集(Google Sheets),并记录指标(正确性、帮助性、字符串相似度、分类是否命中、是否使用了工具等)。适合模型对比、改 Prompt 前后评估和长期监控。(n8n Docs)
2)关键参数/操作
Evaluation 节点 · Operations
Set Outputs:把评估输出写回 Google Sheets 数据集(需 Google Sheets 凭证);
Set Metrics:记录评分指标到工作流的 Evaluations 标签页;
Check If Evaluating:判断当前执行是不是“评估运行”,用于在评估时才计算昂贵指标。
可用指标(Set Metrics 内置)
Correctness(AI):1–5;
Helpfulness(AI):1–5;
String Similarity:0–1;
Categorization:0/1;
Tools Used:0–1;
Custom Metrics:自定义名称/数值(数字)。
3)使用建议(模式)
在产出节点后串一个 Check If Evaluating →(Yes 分支)计算指标 → Set Metrics,避免生产执行时做多余计算与花费。
4)常见坑
忘配 Google Sheets 凭证与数据集映射,Set Outputs 不生效;
指标值必须是数字,字符串会被拒。
3、Model Selector 节点(模型选择器)
1)用途
2)关键参数(官方定义)
Number of Inputs:可接入的模型输入数量;
Rules:按顺序评估,命中即止,选择对应输入的模型。多个规则若都匹配,仅使用第一个匹配。
提醒:作为 sub-node,其表达式解析同样受“只解析首项”规则影响。
3)使用建议(模式)
性能/成本路由:优先 cheap&fast,若 latency 或 quality 不达标,再选更强模型;
4)常见坑
规则顺序写反,导致更昂贵模型被优先命中;
以为能“多模型并发”——该节点是“二选一”路由,不是并行器。
4、Convert to sub-workflow(转换为子工作流)
1)用途
2)操作步骤
框选要抽取的连续节点(不能含触发器,且最多只允许一个对外输入点和一个对外输出点);
右键画布 → Convert to sub-workflow;
n8n 会在新标签页生成子工作流,并在原工作流放入调用节点与参数映射。
3)注意事项
类型约束需要你在子工作流的 Execute Sub-workflow Trigger 与 Edit Fields (Set)(Return)里手动设定;
AI 子节点限制:涉及 AI 工具(sub-nodes)时,请一并选上,可能需要复制和专用化共享节点;
新子工作流默认采用 v1 执行顺序;
first() / last() / all() 这类访问器在转换后可能被改写为带后缀(_firstItem/_allItems),需回归测试。
4)常见坑
选择区间跨越了 IF/Merge 的多分支入/出条件(不满足“单入单出”规则);
5、与多代理/MCP/子工作流的组合思路
1)单画布多代理
主 AI Agent(Tools Agent) + 多个 AI Agent Tool(信息检索 / 表格操作 / 知识库问答 / 写作润色),通过描述+Prompt清晰划分边界,必要时为关键子代理启用 Fallback Model。(n8n Docs)
2)跨工作流团队化
把每个“专家代理”转换为子工作流(或用 Call n8n Workflow Tool 暴露为工具),主代理只负责调度与审核;评估时在末尾插入 Evaluation: Set Metrics,跑回归集观察长期质量。(n8n Docs)
3)模型与指标联动
前置 Model Selector 路由到不同模型;末尾 Evaluation 上报 Correctness/Helpfulness/String Similarity,在 Evaluations 页签里把不同模型跑分拉通比较,指导“成本 ↔ 质量”的取舍。(n8n Docs)
6、微型示例(片段型,便于你粘贴改造)
仅示意关键参数映射;导入前请先在你的实例里创建对应凭证与节点名称
1)Model Selector 规则片段
规则 1:当 {{$json.latency_ms > 3000}} → 走 Fast-Model
规则 2:当 {{$json.need_coding === true}} → 走 Code-Capable-Model
2)Evaluation 指标上报片段
Set Metrics:
Name=helpfulness,Value={{$json.scores.helpfulness}}
Name=correctness,Value={{$json.scores.correctness}}
代码块
{
"id": "OvYZQiWH2KlJsFbK",
"meta": {
"instanceId": "da13b80f35ed9d16adbf337111fadd798f3c80e989940f27089cab3947e57699",
"templateCredsSetupCompleted": true
},
"name": "Multi-Agent Evaluation (eval nodes)",
"tags": [
{
"id": "iNuMk76zLx33FnPf",
"name": "multi-agent",
"createdAt": "2025-06-18T23:08:04.545Z",
"updatedAt": "2025-06-18T23:08:04.545Z"
},
{
"id": "shqG88dQ5QVQIPJI",
"name": "evaluation",
"createdAt": "2025-06-16T20:21:56.654Z",
"updatedAt": "2025-06-16T20:21:56.654Z"
}
],
"nodes": [
{
"id": "8e4721bf-8c21-4de3-ae92-97c627919e1b",
"name": "Calculator",
"type": "@n8n/n8n-nodes-langchain.toolCalculator",
"position": [
-420,
160
],
"parameters": {},
"typeVersion": 1
},
{
"id": "4778f802-0d49-4e47-b153-6a721bec2214",
"name": "Check if tool called",
"type": "n8n-nodes-base.set",
"position": [
540,
-160
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "f31d1137-3262-4d46-979a-e9fc3c24f670",
"name": "tool_called",
"type": "boolean",
"value": "={{ \n $('When fetching a dataset row').item.json.tools_to_call\n .split(',').map(t => t.trim())\n .every(tool => $json.intermediateSteps.some(step => step.action.tool.toLowerCase() === tool)) \n}}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "fdc479f2-b056-464d-842e-da7cc432cbf7",
"name": "When chat message received",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
-760,
40
],
"webhookId": "6fde470e-c42b-4a89-974d-c3d21ab0133b",
"parameters": {
"options": {}
},
"typeVersion": 1.1
},
{
"id": "26ef423b-591f-4a0b-8abc-fdb308c75d3e",
"name": "Match chat format",
"type": "n8n-nodes-base.set",
"position": [
-760,
-160
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "3dec27ca-35df-47a7-9a53-d9b2d0b6c072",
"name": "chatInput",
"type": "string",
"value": "={{ $json.question }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "1d0fbac1-fb62-4b10-82c7-98d9b2a473c9",
"name": "Return chat response",
"type": "n8n-nodes-base.noOp",
"position": [
536,
40
],
"parameters": {},
"typeVersion": 1
},
{
"id": "758baf05-8830-4693-9f3a-a370d9fd4dc8",
"name": "When fetching a dataset row",
"type": "n8n-nodes-base.evaluationTrigger",
"position": [
-980,
-160
],
"parameters": {
"sheetName": {
"__rl": true,
"mode": "list",
"value": 969651976,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/18F1WIEq1ykZKBO1bWYhC0YxRb2ngTurfsZ7jO6sGhLY/edit#gid=969651976",
"cachedResultName": "Tool calling"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "18F1WIEq1ykZKBO1bWYhC0YxRb2ngTurfsZ7jO6sGhLY",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/18F1WIEq1ykZKBO1bWYhC0YxRb2ngTurfsZ7jO6sGhLY/edit?usp=drivesdk",
"cachedResultName": "n8n dataset for evaluation"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "jdlVpers9Sa8nBwV",
"name": "Google Sheets account 4"
}
},
"typeVersion": 4.6
},
{
"id": "33900d54-32e0-4883-9ce8-6565db389473",
"name": "Evaluation",
"type": "n8n-nodes-base.evaluation",
"position": [
980,
-160
],
"parameters": {
"metrics": {
"assignments": [
{
"id": "5855df91-5a74-44f9-b25b-23a111dbd7a1",
"name": "tool_called",
"type": "number",
"value": "={{ $json.tool_called.toNumber() }}"
}
]
},
"operation": "setMetrics"
},
"typeVersion": 4.6
},
{
"id": "636b9b56-3ce3-4bc5-9dbd-42b77f2ce3a2",
"name": "Evaluating?",
"type": "n8n-nodes-base.evaluation",
"position": [
320,
-60
],
"parameters": {
"operation": "checkIfEvaluating"
},
"typeVersion": 4.6
},
{
"id": "174de2c6-787a-4d87-9d0f-a72bc7accc3a",
"name": "Set Outputs",
"type": "n8n-nodes-base.evaluation",
"position": [
760,
-160
],
"parameters": {
"outputs": {
"values": [
{
"outputName": "actual_tools_called",
"outputValue": "={{ $('Evaluating?').item.json.intermediateSteps.map(step => step.action.tool.toLowerCase()).join(', ') }}\n"
}
]
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 969651976,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/18F1WIEq1ykZKBO1bWYhC0YxRb2ngTurfsZ7jO6sGhLY/edit#gid=969651976",
"cachedResultName": "Tool calling"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "18F1WIEq1ykZKBO1bWYhC0YxRb2ngTurfsZ7jO6sGhLY",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/18F1WIEq1ykZKBO1bWYhC0YxRb2ngTurfsZ7jO6sGhLY/edit?usp=drivesdk",
"cachedResultName": "n8n dataset for evaluation"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "jdlVpers9Sa8nBwV",
"name": "Google Sheets account 4"
}
},
"typeVersion": 4.6
},
{
"id": "38559de2-b143-4806-bd14-15015cf1e947",
"name": "Search Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-380,
-60
],
"parameters": {
"options": {
"systemMessage": "=You are a helpful assistant who will have access to a few tools to help with responding to user queries. I am providing some instructions below on how to use the tools. Please follow the instructions carefully.\n\nFirst, check the search_db tool to check whether the query exists. The tool expects a query string. If you use this tool and find relevant information, don't use the websearch tool.\n\nUse the web search tool to search the web for relevant information if you need to. You can ONLY call this tool once. \n\nUse the calculator for math operations or tasks. \n\nUse the summarizer tool to summarize the output. It's required to use this once you have gathered all the information you need.",
"returnIntermediateSteps": true
}
},
"typeVersion": 1.9
},
{
"id": "c2800f49-b091-4327-96c6-2c45782c670e",
"name": "Summarizer",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
-300,
160
],
"parameters": {
"workflowId": {
"__rl": true,
"mode": "list",
"value": "fehTbkLtPtlVwDYq",
"cachedResultName": "Summarizer Agent"
},
"description": "Call this tool to summarize the outputs. ",
"workflowInputs": {
"value": {
"query": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('query', ``, 'string') }}"
},
"schema": [
{
"id": "query",
"type": "string",
"display": true,
"required": false,
"displayName": "query",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"query"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"typeVersion": 2.2
},
{
"id": "fb37524f-9c88-4684-9f46-f558025d5e80",
"name": "Web search",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
-180,
160
],
"parameters": {
"url": "https://api.firecrawl.dev/v1/search",
"method": "POST",
"options": {},
"sendBody": true,
"sendHeaders": true,
"authentication": "genericCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "query",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', ``, 'string') }}"
},
{
"name": "limit",
"value": "={{ \"3\".toNumber() }}"
}
]
},
"genericAuthType": "httpBearerAuth",
"headerParameters": {
"parameters": [
{
"name": "content-type",
"value": "application/json"
}
]
}
},
"credentials": {
"httpBearerAuth": {
"id": "07GVEMqGJn2cdczi",
"name": "Firecrawl Search"
}
},
"typeVersion": 4.2
},
{
"id": "e15e9d58-dd8c-4288-b8fb-d8ef17df44a5",
"name": "OpenRouter Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
-540,
160
],
"parameters": {
"model": "openai/o3",
"options": {}
},
"credentials": {
"openRouterApi": {
"id": "m9IRh1pT1eHIdKoX",
"name": "OpenRouter account 2"
}
},
"typeVersion": 1
},
{
"id": "68b1c2fa-49f9-41d2-8d57-dc89c972d43a",
"name": "Embeddings OpenAI",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
28,
360
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"id": "B67YxZwYEqGQkjNE",
"name": "OpenAi account 2"
}
},
"typeVersion": 1.2
},
{
"id": "090521fb-17f7-466f-8ae4-8f0d351f588a",
"name": "Search_db",
"type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
"position": [
-60,
160
],
"parameters": {
"mode": "retrieve-as-tool",
"options": {},
"toolDescription": "Retrievel relevant results",
"qdrantCollection": {
"__rl": true,
"mode": "list",
"value": "search_queries",
"cachedResultName": "search_queries"
}
},
"credentials": {
"qdrantApi": {
"id": "6pyKp1GM03XYT1IV",
"name": "QdrantApi account"
}
},
"typeVersion": 1.3
}
],
"active": false,
"pinData": {
"When chat message received": [
{
"json": {
"chatInput": "What’s the most recent funding round for Anthropic?"
}
},
{
"json": {
"chatInput": "How much did OpenAI paid to acquire Windsurf? Take the results and multiply it by 1000."
}
}
]
},
"settings": {
"executionOrder": "v1"
},
"versionId": "4929985d-2b28-493e-901b-0a1c4a87fc12",
"connections": {
"Search_db": {
"ai_tool": [
[
{
"node": "Search Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Calculator": {
"ai_tool": [
[
{
"node": "Search Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Summarizer": {
"ai_tool": [
[
{
"node": "Search Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Web search": {
"ai_tool": [
[
{
"node": "Search Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Evaluating?": {
"main": [
[
{
"node": "Check if tool called",
"type": "main",
"index": 0
}
],
[
{
"node": "Return chat response",
"type": "main",
"index": 0
}
]
]
},
"Set Outputs": {
"main": [
[
{
"node": "Evaluation",
"type": "main",
"index": 0
}
]
]
},
"Search Agent": {
"main": [
[
{
"node": "Evaluating?",
"type": "main",
"index": 0
}
]
]
},
"Embeddings OpenAI": {
"ai_embedding": [
[
{
"node": "Search_db",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Match chat format": {
"main": [
[
{
"node": "Search Agent",
"type": "main",
"index": 0
}
]
]
},
"Check if tool called": {
"main": [
[
{
"node": "Set Outputs",
"type": "main",
"index": 0
}
]
]
},
"OpenRouter Chat Model": {
"ai_languageModel": [
[
{
"node": "Search Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "Search Agent",
"type": "main",
"index": 0
}
]
]
},
"When fetching a dataset row": {
"main": [
[
{
"node": "Match chat format",
"type": "main",
"index": 0
}
]
]
}
}
}3)AI Agent Tool 最小配置
Description:负责从内部索引检索与问题相关的三段证据,并返回 JSON {evidences:[...]}
Prompt:指令 + 输出 JSON 模式(必要时接 Structured Output Parser)
参考与延伸
有了这四块“新砖”,你的 Coze × n8n 智能体就能更像“真实团队”:主管会分工(Model Selector + 主 Agent)、专家能接活(AI Agent Tool / 子工作流工具)、结果可量化(Evaluation),而且一切尽量留在同一画布,开发/排障/复用都更顺手。
13)作业
自己按照sop部署n8n 搭建个人名片n8n工作流,最终发到打卡处。