N8n AI Nodes Official
n8nOfficialPublished by n8n
- Skill
- Tool integration
- Automation and integrations
- Apache-2.0
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill covers the implementation of AI capabilities within n8n workflows using the official LangChain node suite. It provides guidance on choosing between the AI Agent node for multi-turn reasoning and specialized nodes like Text Classifier or Basic LLM Chain for specific, leaner tasks. The documentation emphasizes production patterns such as structured output parsing with auto-fixing, human-in-the-loop review for sensitive actions, and modular tool design to ensure agents remain robust, reusable, and safe.
What it does
- Configures AI Agent nodes for multi-turn reasoning, memory, and tool calling.
- Implements specialized nodes for text classification, summarization, and information extraction.
- Integrates RAG primitives for document retrieval and vector store management.
- Enables human-in-the-loop approval gates for tools with side effects.
- Supports structured output parsing with automated retry and fix logic.
- Facilitates media generation workflows using native provider nodes.
When to use it
- When you need to build an AI agent that performs multi-step reasoning or uses tools.
- When you need to route inputs to specific branches using natural language classification.
- When you require structured JSON output from an LLM for downstream processing.
- When you need to gate sensitive actions like payments or refunds with human approval.
- When you need to share conversation memory across chat channels or workflows.
Advantages
- Native integration with n8n's workflow engine and trigger systems.
- Modular design allows tools and system prompts to be reused across different agents.
- Built-in support for structured output and error-resilient parsing.
- Flexible memory management options ranging from stateless to persistent storage.
- Clear separation between agent reasoning and specialized task-specific nodes.
Usage examples
- “How do I set up an agent that requires human approval before sending a refund?”
- The agent explains the HITL (Human-in-the-loop) pattern, showing how to wrap a tool node with a review node (e.g., slackHitlTool) to intercept execution for approval.
- “Should I use an AI Agent or a Text Classifier for routing support tickets?”
- The agent recommends the Text Classifier node for its efficiency and direct output branching, noting it is purpose-built for routing compared to the more complex Agent node.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/n8n-io/n8n-ai-nodes-official/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip n8n-ai-nodes-official.zip -d .agents/skills
Documentation by n8n
n8n AI nodes
The AI Agent node (@n8n/n8n-nodes-langchain.agent) is a multi-turn LLM driver with sub-nodes for the model, memory, tools, and optional output parser. It lives inside a workflow, which owns its trigger, control flow, and lifecycle.
AI Agent node or first-class n8n Agent?
"Build me an agent" means a first-class n8n Agent (n8n-agents-official) by default. Use the node when the workflow owns the control flow and AI is one bounded step, or when the first-class Agent hits a limit:
<!-- TEMPORARY: revisit each limit below when n8n adds tool access to run data, sessions shared between channels and workflows, or Agents on every instance (Enterprise). -->
| Need | Why the node wins today |
|---|---|
| Trigger or upstream data mapped exactly into a tool parameter | Agent tool expressions only see the model's own arguments. Node tools can use $('Webhook').item.json... |
| One conversation shared between a chat channel and other workflows | Agent channel sessions and workflow sessions never meet |
create_agent isn't in the MCP tool list | Agents aren't enabled on this instance |
When to use the Agent node vs raw chat completion
Decision:
Need tool calls, multi-turn reasoning, or memory? Agent. Also a fine default when you don't want to think about it: standardizing on Agent across the workflow is reasonable and makes the path to upgrade simpler.
Want the lightest possible single-shot text-out call? Basic LLM Chain (
@n8n/n8n-nodes-langchain.chainLlm) with a chat-model sub-node (OpenRouter Chat Model,OpenAI Chat Model,Anthropic Chat Model, etc.). No agent loop, no tool/memory/parser slots, easier to debug. Note: chat-model nodes are sub-nodes, and they don't run standalone. They wire into a chain or agent. Agent works here too if you'd rather standardize.Routing to one of N output branches based on natural-language input (the AI's job is to pick the branch)? Use the Text Classifier node (
@n8n/n8n-nodes-langchain.textClassifier). N output handles, one per category, and downstream paths wire directly into each. Every category needs both a name AND a description (the description is what the model picks against, names alone aren't enough). Setoptions.enableAutoFixing: truefor robustness on edge inputs. Pair with a chat-model sub-node (OpenRouter Chat Model,OpenAI Chat Model, etc.). Don't reach for Agent + Switch for this. Text Classifier is one node and purpose-built.Structured output but no tools? Agent is the easier default with future expansion in mind. Basic LLM Chain also accepts an
outputParserStructuredsub-node and works fine where you want the lighter node.Image / audio / video generation? The native single-call node for that provider when calling them directly (OpenAI Image, Gemini Image, ElevenLabs, etc.). HTTP Request when routing through an aggregator (OpenRouter, Together, etc.), because no native aggregator node exists and the native nodes hardcode their provider's base URL on the media operation. Don't wrap media generation in an Agent, see "Binary and the agent boundary" below.
There are other LangChain "chain" / utility nodes for narrow tasks: Information Extractor (pull structured fields from text), Sentiment Analysis (3-way branch), Summarization Chain, Basic LLM Chain.
Agent is a reasonable default for most LLM steps. Reach for Basic LLM Chain when you specifically want the leaner node for a one-shot text call with no tools, memory, or iteration. Reach for Information Extractor / Sentiment Analysis / Summarization Chain / Text Classifier when one of those purpose-built nodes matches the task exactly.
Non-negotiables
Tool names and descriptions are part of the prompt. The model picks tools by name and description. Vague tool node names like (
doStuff) or weak descriptions ("does things with the data") cause silent failure: the model skips your tool, mis-selects it, or hallucinates parameters. Treat both like API design. Seereferences/TOOLS.md.Structured output: parse AND autoFix.
outputParserStructuredwithautoFix: trueand a coding-capable fixer model (e.g., Claude Sonnet 4.6) is the production pattern.
Strong defaults
Tool descriptions are modular prompt fragments. Anything specific to how to call this tool belongs in the tool's description, not the system prompt. Keeps the system prompt focused, and tools become reusable across agents. See
references/SYSTEM_PROMPT.md.Sub-workflow tools (
toolWorkflow) for anything multi-step. Any workflow becomes a tool with typedfromAi()inputs, and composes with branching, error handling, sub-workflows. Seereferences/SUBWORKFLOW_AS_TOOL.md.Wrap tools with user-visible side effects in human review. Sends, payments, refunds, account changes. Gate them behind a Slack / Chat / Discord / Telegram approval node so a human signs off before the tool runs. See
references/HUMAN_REVIEW.md.
The sub-node pattern
The Agent node has a main input (the prompt or user message) and sub-node inputs:
const aiAgent = node({
type: '@n8n/n8n-nodes-langchain.agent',
config: {
name: 'Customer Support Agent',
parameters: {
promptType: 'define',
text: '={{ $json.userMessage }}',
options: {
systemMessage: '...',
passthroughBinaryImages: true, // for vision / multimodal
},
},
subnodes: {
model: openRouterModel,
memory: simpleMemory,
tools: [generateImage, editImage, searchKnowledgeBase],
outputParser: structuredParser, // optional
},
},
})The four sub-node slots:
model(required): the language model. OpenAI, Anthropic, OpenRouter, etc. Use chat-model variants, not completion variants.memory(optional): conversation memory. Without it, every call is stateless. Seereferences/MEMORY.md.tools(optional, but the point of using an agent): tools the agent can call. Seereferences/TOOLS.md.outputParser(optional): forces structured JSON output. Seereferences/STRUCTURED_OUTPUT.md.
Triggers
Different triggers shape the input differently:
Chat Trigger (
@n8n/n8n-nodes-langchain.chatTrigger) withavailableInChat: true: powers the canvas chat tester so you can poke at an agent while building it. Input is{ chatInput, sessionId, files[] }.sessionIdis what memory keys on, so pass it through wherever conversation continuity is needed. Files come in viafiles[], see binary section below. Not a production surface, use Slack / Discord / Teams / Telegram / webhook for that.Webhook: arbitrary input shape, no session by default. Manage continuity by passing a session/conversation ID through the request body and forwarding it to the memory node.
External chat surface (Slack, Discord, Teams, Telegram): every chat-triggered workflow that posts replies MUST filter out the bot's own user ID, or it loops forever potentially crashing n8n. Prefer trigger-level filtering when the surface supports it (Slack's
options.userIdsis an exclusion list); otherwise filter in the first node after the trigger. Semantics differ per surface, seereferences/CHAT_SURFACE_PATTERNS.md. A first-class n8n Agent can connect to Slack, Telegram, Discord, and Linear natively with no workflow, seen8n-agents-official. Beyond the anti-loop filter, a simple bot (trigger → agent → reply) is fine in one workflow. Split into a "shell" workflow + agent-core sub-workflow once you need loading UX, sub-agents, reuse across surfaces, or robust error handling.Manual / Schedule: ad-hoc invocations. Memory rarely useful unless explicitly continuing a previous run.
Execute Workflow Trigger (sub-workflow): when an agent is itself a tool of another agent. Treat the trigger's declared inputs as the contract.
Binary and the agent boundary
The model can see uploaded files (vision) via passthroughBinaryImages: true. But tools cannot receive binary, and fromAi() parameters are JSON only. Base64 is also not accepted by tools, even through non-AI bindings.
Workaround: pre-stage uploads to storage before the agent runs, inject the storage keys into the system prompt, tools accept the key as a string parameter and re-fetch internally. Full pattern in n8n-binary-and-data-official references/AGENT_TOOL_BINARY.md.
On the output side: the Agent's output formatter is text-shaped (or structured-text when an outputParser is wired). When a model returns binary (image bytes, audio bytes, video), the Agent doesn't surface it at all. There's nothing to dig out downstream, and trying to recover it via a Code or Set node after the Agent does not work. For one-shot media generation, use the provider's native single-call node directly such as @n8n/n8n-nodes-langchain.googleGemini or @n8n/n8n-nodes-langchain.openAi.
The exception: when a media step genuinely belongs in an agent (one tool among several, picked based on conversation context, or editing a previously-generated image), the workaround is a tool sub-workflow that uploads the result to storage and returns a key or URL. Pattern in n8n-binary-and-data-official references/AGENT_TOOL_BINARY.md. Don't reach for this by default. The upload + key + re-fetch path adds nodes and a storage dependency you don't otherwise need. Only when the orchestration actually requires an agent's tool selection.
What goes in the system prompt vs the tool description
| Belongs in system prompt | Belongs in the tool's description |
|---|---|
| Persona, role, voice | What this specific tool does |
| Output format rules ("respond in markdown") | When to use this tool vs others |
| Refusal/safety behavior | What each parameter means and its expected shape |
Display protocols ("show images via ![]() markdown") | Examples of good vs bad invocations |
| Universal context (current date, user role) | Tool-specific gotchas (rate limits, edge cases) |
| Inter-tool flow ("after generating, always show via display protocol") | Tool-specific input transformations |
Benefit: tools become reusable. A well-described tool works in any agent that drops it in. The system prompt stays focused on role and shared behavior.
For deeper guidance and worked examples, see references/SYSTEM_PROMPT.md and references/TOOLS.md.
Tool selection: the four types
Pick the lightest option that covers the job:
Native n8n tool node exists? (e.g.,
slackTool,gmailTool,calculatorTool) Use it. Lowest config overhead.Native node is missing an operation or needs custom params (e.g., a Notion endpoint the node doesn't expose, a non-standard header, a different pagination shape)? HTTP Request Tool with the service's "Predefined Credential Type". Reuses the existing OAuth / API-key credential, gives full API access, no custom auth code.
Multi-step logic, or reusing a sub-workflow already in the project? Sub-workflow as tool (
toolWorkflow). Anything you can build as a workflow becomes a tool with typedfromAi()inputs. The most powerful option in n8n, so default here when in doubt. Seereferences/SUBWORKFLOW_AS_TOOL.md.Calling an external HTTP API the agent should orchestrate directly? HTTP Request Tool. Also good for slow async work via long-poll callback.
Tool already exists as a published, MCP-accessible workflow? MCP tool. Useful for cross-workflow agent capabilities. See
n8n-extending-mcp-official.
See references/TOOLS.md for deeper guidance on each option and how to wire fromAi() parameters.
Human review
Before adding or skipping human review on a tool, check with the user. Whether sign-off is needed is a product / policy call (blast radius, audit requirements, how much they trust the model) that the user is better positioned to make than you. Surface the question, recommend based on the criteria below, and let them decide.
When a tool's effects need human approval before execution (sends, payments, refunds, account changes, customer-facing actions), wrap it with a review tool node: slackHitlTool, discordHitlTool, telegramHitlTool, gmailHitlTool, etc. (n8n's node names use Hitl for the human-in-the-loop pattern, and "human review" is what it's called in the UI.) The review node sits between the wrapped tool and the agent on the ai_tool connection: the wrapped tool's ai_tool output wires into the review node, and the review node's ai_tool output wires into the Agent. The agent calls through, the review node pauses for approval, on approve, the wrapped tool runs.
Default to / recommend human review when:
The tool sends, pays, refunds, or otherwise mutates user-visible state.
The approver is different from the chatter (manager-approves-customer-action, support team approves a customer-triggered refund).
The trigger is non-interactive (order, form, schedule) but the tool's effect needs human sign-off.
Approval messages should display the actual parameters the wrapped tool will receive, not text the model paraphrases. Use $tool.parameters.<name> directly, or iterate over $tool.parameters to list every param. Don't fill the approval text via fromAi(). You'd be approving a paraphrase, not the literal call. Customize button labels with the actual values, e.g. Approve {{ $tool.parameters.amount }} refund.
Full config patterns, per-platform setup, and the multi-channel approver pattern in references/HUMAN_REVIEW.md.
Output parsing: when and how
Add an outputParser sub-node when downstream needs structured data, not free-form text.
const parser = outputParser({
type: '@n8n/n8n-nodes-langchain.outputParserStructured',
config: {
parameters: {
schemaType: 'manual',
inputSchema: JSON.stringify({
type: 'object',
properties: {
score: { type: 'integer', minimum: 1, maximum: 5 },
category: { type: 'string', enum: ['bug', 'feature', 'question'] },
reason: { type: 'string' },
tags: { type: 'array', items: { type: 'string' } },
},
required: ['score', 'category', 'reason'],
}),
autoFix: true,
customizeRetryPrompt: true,
prompt: '...retry instructions...', // generally leave as default
},
subnodes: {
languageModel: fixerModel, // coding-capable model, e.g. Claude Sonnet 4.6
},
},
})Use
schemaType: 'manual'with a real JSON schema, notjsonSchemaExample. An example can't express optional fields, enums, value ranges, or array constraints, so you outgrow it the first time the shape gets non-trivial. A schema lets you mark fields required vs optional, define enums, constrain numbers and string formats, and gives the model clearer rules to follow. Reach forschemaType: 'fromJson'with an example only for one-off shapes you're certain will never grow constraints.autoFix: trueadds retry on parse failure. Wire a coding-capable model as the fixer sub-node (e.g., Claude Sonnet 4.6 or similar). Fixing malformed JSON against a schema is a structured-output / coding task, and a weak or generic model often produces another malformed retry, defeating the point.
For the full pattern including custom retry prompts, see references/STRUCTURED_OUTPUT.md.
Memory: brief mental model
No memory: stateless. Right for one-shot tasks (classify, summarize).
memoryBufferWindow: keeps the last N messages per memory key and persists across executions via n8n's internal store. The key is whatever expression you bind tosessionKey. Chat triggers fillsessionIdautomatically, but you can key on anything (Slackthread_ts, a webhook conversation ID, a multi-tenant composite). The default for chat memory. The "window" is the sliding cap on how many messages stay in context, not a scope on persistence.memoryPostgres/memoryRedis/ similar: reach for these when you need to query or read memory outside the agent: displaying conversation history in your own UI, analytics on past chats, or sharing memory with another system. OtherwisememoryBufferWindowis enough.
Plumb a stable key from the trigger to memory consistently, or conversations get crossed. See references/MEMORY.md.
RAG (retrieval augmented generation)
n8n has the LangChain RAG primitives: document loaders, text splitters, embeddings, vector stores, retrievers, rerankers. The pieces work, but opinionated end-to-end recipes ("which vector store, which chunking, when to rerank") depend heavily on data shape and scale.
This skill keeps RAG opinions thin on purpose. See references/RAG.md for more details on RAG.
Reference files
| File | Read when |
|---|---|
references/TOOLS.md | Adding tools to an agent, choosing between the four tool types, writing tool names and descriptions |
references/SUBWORKFLOW_AS_TOOL.md | Wiring a sub-workflow as an agent tool via toolWorkflow, mapping fromAi overrides |
references/SYSTEM_PROMPT.md | Writing or refactoring a system prompt, deciding what goes in the system prompt vs tool descriptions |
references/STRUCTURED_OUTPUT.md | Forcing JSON output, configuring autoFix retries, validating downstream |
references/MEMORY.md | Choosing a memory type, persistence and sessionId handling |
references/RAG.md | Building retrieval-augmented agents, intentionally a stub |
references/HUMAN_REVIEW.md | Adding human approval to a tool, configuring approval messages, multi-channel approver patterns |
references/CHAT_SURFACE_PATTERNS.md | Building a chat bot workflow on Slack, Discord, Teams, Telegram, or any custom chat surface: shell + core + sub-agents, including a first-class Agent as the core via Message an Agent |
Anti-patterns
| Anti-pattern | What goes wrong | Fix |
|---|---|---|
Generic tool names (doStuff, runQuery) | Model can't tell which tool to pick, skips them or hallucinates parameters | Verb-first specific names: Search customer database, Generate image with Veo |
| Empty or one-line tool descriptions | Model has no clue when to invoke, bad selection | Write a real description: what it does, when to use, parameter meanings |
| Cramming everything into the system prompt | Bloated prompt, reuse impossible, per-tool guidance buried | Move tool-specific instructions to tool descriptions, keep system prompt to persona + global rules |
| Code-node tool where a sub-workflow would work | Not reusable, can't be tested independently, can't compose with branching | Use toolWorkflow with a proper sub-workflow |
| Passing binary directly to a tool | Doesn't work, binary can't cross the tool boundary | Pre-stage to storage, pass keys via fromAi, tool fetches internally. See n8n-binary-and-data-official |
outputParserStructured without autoFix | One bad model output and the workflow fails | Set autoFix: true with a cheap fixer model |
Hardcoded sessionId or no sessionId | Conversations cross or memory never matches | Pass sessionId from trigger consistently to memory and tools |
| Two near-identical tools instead of one with branching | Model gets confused, selection is non-deterministic | One tool with internal branching driven by parameters |
| Hardcoding a system prompt that's reused across workflows or iterated often | Editing requires republishing, can't share across workflows, tuning churn lives in node JSON | Store in a Data Table, load at runtime |
| Wrapping image / audio / video generation in an Agent | Binary doesn't flow through tools or out of the output formatter, Agent adds nodes for no gain | Use the provider's native single-call node directly (OpenAI Image, Gemini Image, ElevenLabs), HTTP Request only when going through an aggregator |
| Reaching for Agent + Switch to route on natural-language input | Two nodes plus prompt boilerplate where Text Classifier is one node with N built-in output branches | Use Text Classifier (@n8n/n8n-nodes-langchain.textClassifier), each category gets its own output handle, wire downstream paths directly |
| Tool that mutates user-visible state (send, pay, refund) without human review | Agent fires irreversible action on a wrong inference | Wrap with the review tool node that fits the channel (Slack/Chat/Discord/Telegram), show actual params via $tool.parameters |
Filling the review approval message via fromAi() | The model paraphrases, you approve text not values | Use $tool.parameters.<name> directly so the literal call is visible |
| Chat-triggered agent workflow that posts replies without filtering out the bot's own user ID | Bot's own messages re-trigger the workflow, infinite loop that burns runs and tokens until rate limits or n8n concurrency stops it | Prefer trigger-level filtering when available (Slack Trigger's options.userIds is an exclusion list, put the bot ID there). Otherwise filter on $json.user !== '<BOT_USER_ID>' (or the surface equivalent) as the first node after the trigger. Required for ANY chat-triggered workflow that sends a reply (Slack, Discord, Teams, Telegram), regardless of complexity. See references/CHAT_SURFACE_PATTERNS.md for per-surface semantics |
Passing the bare blocks array to the Slack node's blocksUi when the agent returns Block Kit | The Slack node accepts the input silently and posts the message with no rich content; no error, no warning | Wrap as { "blocks": [...] } with the value as a real array, not a stringified one. Expression: ={{ { "blocks": $('Agent').item.json.output.blocks } }}. See n8n-node-configuration-official references/COMMS_NODES.md "Block Kit messages" |
Files
- ATTRIBUTION.mdAdded by AutoGineer848 B
- LICENSELicence file added by AutoGineer11.0 KiB
- SKILL.md22.4 KiB
- references/CHAT_SURFACE_PATTERNS.md19.9 KiB
- references/HUMAN_REVIEW.md11.4 KiB
- references/MEMORY.md9.5 KiB
- references/RAG.md8.1 KiB
- references/STRUCTURED_OUTPUT.md6.7 KiB
- references/SUBWORKFLOW_AS_TOOL.md12.0 KiB
- references/SYSTEM_PROMPT.md7.4 KiB
- references/TOOLS.md12.0 KiB
- references/examples/agent-core.json13.1 KiB
- references/examples/notion-ideas-subagent.json7.8 KiB
- references/examples/slack-router.json12.3 KiB
references/TOOLS.md
Agent tools
The agent picks tools by reading their name and description. Both are part of the prompt. Treat tool design like API design: what it does, when to use it, what each parameter means, and proper error handling.
The four tool types
1. Native tool nodes
Pre-built tool nodes from n8n: slackTool, gmailTool, googleSheetsTool, calculatorTool, httpRequestTool, etc. Same as their non-tool counterparts, except parameters can be filled by the agent via fromAi().
Pros: minimal config, well-tested integrations, consistent and native feel. Cons: one node = one operation. Multi-step logic doesn't fit.
Use when: the capability maps cleanly to one existing n8n node and one operation.
2. Sub-workflow as tool (toolWorkflow)
The default for any tool that does more than one thing. Any n8n workflow becomes a tool, with typed inputs via Execute Workflow Trigger filled by fromAi().
Pros: full power of n8n inside the tool: branching, error handling, sub-sub-workflow calls, native nodes, custom logic. Reusable across agents. Independently testable. Cons: one extra workflow boundary, (very) slight latency.
Use when: the capability is more than one node, the logic might be reused, or you want testability.
The canonical n8n way to build agent capabilities. Covered in depth in SUBWORKFLOW_AS_TOOL.md.
3. HTTP Request Tool
A wrapper around the HTTP Request node that exposes its parameters to the agent.
Pros: any HTTP API is a tool with one node. Cons: only HTTP. Auth/retry/error handling is yours to wire.
Use when: calling a single external API the agent should orchestrate. One thing to know: HTTP Request has its own HTTP-level timeout (default 5 minutes). For slow endpoints, bump options.timeout. Agent tools themselves have no timeout, the agent will wait as long as the tool takes.
Also useful when you want to give the agent more agency over the call shape. A native Notion tool node exposes one operation with fixed parameters. Point an HTTP Request Tool at the Notion API with the Notion predefined credential, and the agent can compose the path, method, and full JSON body itself, covering operations the native node doesn't expose. Trade-off: the agent is now writing API requests, which is more error-prone than deterministic tools and needs a capable model (Sonnet-tier or better) and clear endpoint guidance in the description. The user should understand they are widening the blast radius in exchange for flexibility.
4. MCP tool
The MCP Client Tool node connects the agent to any MCP server. Two flavors:
External MCP servers: any third-party or self-hosted MCP (Linear, GitHub, Notion, Sentry, custom internal tools, etc.). The agent gets every tool that server exposes in one node.
n8n-hosted MCP: a workflow on the same n8n instance published with MCP access enabled (per
n8n-extending-mcp-official). Same client node, just pointed at an n8n MCP trigger URL.
Pros: one node exposes many tools, vendor-maintained integrations stay current without you wiring each operation, and n8n-hosted MCP lets one workflow serve many agents and external clients. Cons: tool descriptions and shapes come from the MCP server, so quality varies and you can't easily tune them. Auth and network reachability are yours to manage.
Use when: a maintained MCP server already covers the capability, or you want to expose your own n8n logic to many agents (internal and external) through one published interface.
Decision: which tool type?
Capability the agent needs?
├── One existing native node + one operation does it
│ └── Use that as a tool node
│
├── More than one node, or logic that might be reused
│ └── Sub-workflow as tool (toolWorkflow). Default to this.
│
├── A single external HTTP API call (or long-running async via webhook callback)
│ └── HTTP Request Tool
│
└── A maintained MCP server covers it, or you want one published n8n workflow to serve many agents
└── MCP Client Tool (external MCP, or n8n-hosted MCP)fromAi(): how the agent fills tool parameters
Tool parameters that the agent should determine are wrapped in fromAi():
{
sendTo: fromAi('recipient', 'Email address of the recipient'),
subject: fromAi('subject', 'Email subject line, concise and informative'),
body: fromAi('body', 'Email body in plain text, professional tone'),
}The shape:
fromAi(<paramName>, <description>, <type?>, <defaultValue?>)paramName: the name the model uses internally. snake_case or camelCase fine, but be consistent.description: tells the model what to fill in. Part of the prompt. Be specific: format, range, example.type(optional):'string'(default),'number','boolean','json'. Enforced: a wrong-typed value from the model fails the tool call.defaultValue(optional): used when the model omits the parameter.
A good description for a string parameter:
fromAi(
'imageName',
'Storage reference for an existing image to edit, or leave empty for a new generation. Format depends on the backend: an object-storage key like "abc123.png", a Dropbox file ID, a Google Drive file ID. Use the exact key/ID shown in the system prompt; do not reconstruct.',
'string'
)A bad description:
fromAi('imageName', 'image name') // useless to the modelTreat fromAi descriptions like JSDoc for an API: the model reads them to figure out what to pass.
Workflow-filled parameters: hide what the agent shouldn't decide
Tool parameters don't all have to be fromAi. Any parameter can be filled deterministically from workflow context, and workflow-filled values are invisible to the agent: not in the tool schema, not in any turn, not influence-able by anything the model produces.
workflowInputs: {
value: {
reason: '={{ $fromAI("reason", "Why the user is requesting a refund") }}', // agent-filled
customerId: '={{ $("Chat Trigger").first().json.user.id }}', // hidden from agent
maxRefundAmount: '={{ $("Get user tier").first().json.refundLimit }}', // hidden from agent
idempotencyKey: '={{ $("Chat Trigger").first().json.sessionId }}', // hidden from agent
},
}Use for anything the agent shouldn't be able to get wrong or read:
Identity:
userId,customerId, authenticated actor, tenant scope.Authority limits: refund caps, tier flags, allowed regions, role-based permissions.
Correlation IDs:
sessionId, idempotency keys, trace IDs.Anything the agent doesn't need to see to do its job.
The strongest version: a sensitive tool with zero fromAi parameters. The agent's only decision is whether to call the tool. A "Refund order" tool can take orderId from the chat trigger payload, amount from the order record fetched in an earlier node, and actor from the authenticated session, all plumbed in deterministically. The agent literally cannot refund the wrong order or the wrong amount, it can only choose whether to fire the call.
Capability-style tool design: give the agent a button to push, not a steering wheel. Pair with the patterns in HUMAN_REVIEW.md for actions that need deterministic params AND human sign-off.
Tool name and description as prompt
Selection process:
Model gets the system prompt, conversation, and list of available tools.
For each tool, it sees name + description + parameter schema (with
fromAidescriptions).It picks the tool whose description best matches what it needs to do.
Bad names and descriptions cause bad selection. The failure mode isn't always loud: sometimes the model just doesn't call your tool, or it calls a different one with garbage parameters.
Tool name patterns
Use verb-first specific names:
| Good | Bad | Why |
|---|---|---|
Search customer database | query | "query" is generic, "search customer database" is specific |
Generate image with Veo | imageGen | Specific tool, specific model, "imageGen" doesn't say which |
Edit existing image | edit | "edit" doesn't say what's being edited |
Send Slack message to channel | slack | The name should hint at the action, not just the surface |
Lookup user by email | getUser | "getUser" doesn't say how |
Tool description patterns
A well-written tool description has three parts:
What the tool does (one sentence).
When to use it (one or two sentences with examples or boundaries).
Parameter format notes (only if not covered in
fromAidescriptions).
Example:
Edit Image: Modifies an existing image based on a prompt. Use when the user has uploaded an image and asks for changes (color, style, composition, or content edits). Do not use for generating new images from scratch; use Generate Image for that. The `imageName` parameter must be the storage key of the existing image as listed in your available files; do not pass the original filename or a URL.This description does work that would otherwise sit in the system prompt. That's the point. See "Tool descriptions as modular prompts" below.
Tool descriptions as modular prompts
Anything specific to how to call this tool belongs in the tool's description, not the system prompt. Three reasons:
Reusability. A well-described tool works in any agent. The system prompt doesn't teach each new agent how to use it.
Token efficiency. The model only "loads" tool descriptions when deciding to use a tool. Per-tool guidance in the system prompt is loaded every turn, even when irrelevant.
Maintainability. When tool behavior changes, update the tool description, not a paragraph buried in a 5000-token system prompt.
Examples of what to move:
| In the system prompt | Better in the tool description |
|---|---|
| "When generating images, always preserve focus depth" | Edit Image: "When editing background only, match the original's depth of field..." |
| "If you call the search tool with no results, summarize that politely" | Search: "Returns up to 10 results, and if empty, report 'no matches found' rather than retrying with broader terms" |
| "Use 9:16 aspect ratio for video tools" | Generate Video: "Defaults to 9:16 for vertical/mobile, pass aspectRatio: '16:9' for landscape" |
Long system prompts often have multiple "when calling X, do Y" sections that can move into X's tool description.
Granularity: one tool with branching, not two near-identical tools
The model gets confused choosing between near-identical tools. If two tools are ~80% the same internally, consider:
One tool with a parameter that branches. Branch in the sub-workflow based on a parameter value.
Two tools only when the use cases are genuinely distinct AND descriptions can clearly differentiate.
Example: Send DM vs Send Channel Message are distinct, and the model needs to decide from the user's request. Generate Image vs Edit Image look distinct but share most logic, so collapse to one with an imageName parameter (empty = generate, populated = edit).
Operational notes
Max iterations. Agents have a configurable tool-call iteration cap. When stuck in a loop, it caps out, surfacing as "max iterations reached" or empty output. Build a fallback, and don't trust graceful recovery.
Tool call cost. Each tool call is at minimum one extra model round-trip. Frequently-called tools should return concise results, since bloated returns burn tokens fast.
Tool failure handling. Wire
onError: 'continueErrorOutput'on tool sub-workflows where you want the agent to receive an error string rather than halting. The agent can retry, switch tools, or report to the user.
Cross-references
For the sub-workflow tool pattern in detail:
SUBWORKFLOW_AS_TOOL.md.For passing binary into tools:
n8n-binary-and-data-officialreferences/AGENT_TOOL_BINARY.md.For wrapping APIs as MCP tools accessible to agents:
n8n-extending-mcp-official.For tool naming alignment with the rest of the workflow conventions:
n8n-workflow-lifecycle-officialreferences/NAMING_CONVENTIONS.md.
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs Node.js
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- n8n
- Publisher
- n8n (Official)
- Source
- n8n-io/skills · skills/n8n-ai-nodes-official · commit 27b6b9f
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by n8n.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download n8n-ai-nodes-official.zip