跳到正文
Skillpedia
智能体23k · #10125

n8n-agents

它能做什么

这项技能指导 AI 智能体在 n8n 中搭建 AI Agent 和语言模型步骤。n8n 是一款工作流自动化工具。适合在 n8n 工作流中构建 AI 助手的人。

适用场景

  • ✓当你在 n8n 中构建需要使用工具或记住之前消息的 AI 智能体时。
  • ✓当分类文本这类简单的 AI 步骤比完整的智能体更合适时。
  • ✓当你需要一个基于已存文档回答问题的 n8n 聊天助手时。

技能链接

https://github.com/czlonkowski/n8n-mcp/blob/main/data/skills/n8n-agents/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/czlonkowski/n8n-mcp/blob/main/data/skills/n8n-agents/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我构建一个 n8n AI 智能体,使用我们的帮助文档来回答客户问题。”

每周 5 个新技能,1 分钟读完。

工作原理

技能会先帮你选择合适的 n8n AI 节点,然后设置模型、工具、记忆和输出格式,使智能体的行为可预测。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

n8n Agents

The n8n AI Agent node (@n8n/n8n-nodes-langchain.agent) is a multi-turn LLM driver with sub-nodes for the model, memory, tools, and an optional output parser. This skill is the deep guide to designing agents and the LangChain family around them. For the high-level "where an agent fits in a workflow" picture, see n8n-workflow-patterns ai_agent_workflow.md — this skill goes one level down into how to build it well.

For node-type formats: in workflow JSON the LangChain nodes use the long @n8n/n8n-nodes-langchain.* form (.agent, .lmChatOpenAi, .memoryBufferWindow, .outputParserStructured, .toolWorkflow, .toolHttpRequest, .toolCode). When you call get_node / validate_node, use the short form (nodes-langchain.agent). See n8n-mcp-tools-expert for the format rules.


Pick the right node first

Reaching for an Agent when the task is one-shot classification or extraction is the most common over-build. Decide before you wire anything:

You need to… Use Why
Call tools, reason over multiple turns, or hold memory AI Agent (.agent) The full loop: model + tools + memory + optional parser. Also a fine default when you'd rather standardize.
One-shot text in → text out, no tools Basic LLM Chain (.chainLlm) No agent loop, easier to debug. Still accepts an outputParserStructured sub-node.
Route a natural-language input to one of N branches Text Classifier (.textClassifier) ONE node, N output handles, downstream wires directly into each. Not Agent + Switch.
Pull structured fields out of free text Information Extractor (.informationExtractor) Purpose-built field extraction with a schema.
3-way positive/neutral/negative split Sentiment Analysis (.sentimentAnalysis) Built-in branch outputs.
Condense a long document Summarization Chain (.chainSummarization) Map-reduce summarization built in.
Generate an image / audio / video The provider's native single-call node (OpenAI, Gemini, ElevenLabs…) NEVER wrap media generation in an Agent — see "Binary and the agent boundary".

Text Classifier detail (the Agent + Switch anti-pattern): every category needs both a name AND a description. The model routes against the description, not the name — a category with no description gets picked by coin-flip. Set options.enableAutoFixing: true for robustness on edge inputs. One node, N branches, done. Reaching for an Agent that "decides" then a Switch that "routes" is two nodes plus prompt boilerplate for what Text Classifier does natively.

Chat-model nodes (.lmChatOpenAi, .lmChatAnthropic, .lmChatOpenRouter, …) are sub-nodes — they don't run standalone. They wire into a chain, agent, classifier, or extractor via the ai_languageModel connection.


The sub-node pattern

The Agent has a main input (the prompt / user message) and up to four sub-node slots, each wired by its own ai_* connection type:

Slot Connection type Required? Node example
model ai_languageModel Yes .lmChatOpenAi, .lmChatAnthropic, .lmChatOpenRouter
memory ai_memory Optional .memoryBufferWindow, .memoryPostgresChat
tools ai_tool Optional (but the point of an agent) slackTool, .toolWorkflow, .toolHttpRequest, .toolCode
outputParser ai_outputParser Optional .outputParserStructured

A sub-node connects FROM itself TO the agent. In workflow JSON the connection lives on the sub-node, keyed by the ai_* type:

"Main LLM": {
  "ai_languageModel": [[{ "node": "AI Agent", "type": "ai_languageModel", "index": 0 }]]
},
"Simple Memory": {
  "ai_memory": [[{ "node": "AI Agent", "type": "ai_memory", "index": 0 }]]
},
"Search customer DB": {
  "ai_tool": [[{ "node": "AI Agent", "type": "ai_tool", "index": 0 }]]
}

Multiple tools all connect into the same ai_tool index 0 — they stack, they don't fan into separate indices. With n8n_update_partial_workflow you wire each with an addConnection op using sourceOutput: "ai_tool". The agent puts its final answer in $json.output (not .text, not .response) — downstream nodes read {{ $json.output }}.

See EXAMPLES.md for a complete stateless agent-core node-object snippet.


Two non-negotiables

  1. Tool names and descriptions ARE part of the prompt. The model picks a tool by reading
常见问题

什么时候不应在 n8n 中使用 AI Agent?

对于分类或提取这类一次性的简单任务,技能建议使用更轻量的节点,因为完整的智能体往往超出所需。

它涵盖记忆功能吗?

涵盖。它包括智能体记忆和会话 ID。

它能帮助处理结构化输出吗?

能。它涵盖输出解析器,以及结构化或 JSON 输出。

详情

作者的原始描述

Design n8n AI agents the right way. Use when building or editing any @n8n/n8n-nodes-langchain.* AI node — an AI Agent, LLM chain, Text Classifier, or Information Extractor — and whenever the user mentions AI agents, LLM with tools, tool calling, $fromAI, system prompts, agent memory, sessionId, structured/JSON output, output parser, RAG, vector store, a chat assistant/bot, or human-in-the-loop review. Covers Agent-vs-chain-vs-classifier choice, the model/memory/tools/outputParser slots, tool names/descriptions as prompt, structured output with autoFix, memory, RAG, human review, and chat topol

repo: czlonkowski/n8n-mcp

热度

GitHub 星标
23k
排名
#10125
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能