n8n agents
Use when building n8n AI Agent / LangChain clusters — tools, memory, RAG, structured output, system prompts, sub-workflow-as-tool, or fixing agent connection topology (ai_languageModel, ai_tool, ai_memory).
By- name:
- n8n-agents
- description:
- Use when building n8n AI Agent / LangChain clusters — tools, memory, RAG, structured output, system prompts, sub-workflow-as-tool, or fixing agent connection topology (ai_languageModel, ai_tool, ai_memory).
n8n AI Agents
Author: Taghi Molavi
Topology (critical)
AI Agent is a cluster, not a single node:
- Chat model → connection type
ai_languageModel - Tools →
ai_tool(HTTP tools, Code tools, Workflow tools, Vector retrieve, …) - Memory →
ai_memory - Output parser →
ai_outputParserwhen structured JSON required
Missing language model = agent that cannot run. Lint should catch this.
Tool quality = prompt quality
Tool names and descriptions are part of the system prompt. Vague tools → tool thrash.
Good description:
create_draft_invoice— Create a draft invoice in Stripe for an existing customer_id. Input: customer_id (string), line_items (array of {price_id, quantity}). Does not finalize or charge.
Bad: helper — does stuff with billing.
System prompt design
- Role, tools available, refusal rules, output format
- Keep business policies explicit (PII, refunds, legal)
- Prefer structured output parser over "please return JSON"
Patterns
| Pattern | When |
|---|---|
| Router agent + specialist sub-agents | Multi-domain support |
| Sub-workflow as tool | Reuse audited business logic |
| RAG retrieve → agent | Docs/help centers |
| Human review gate | Irreversible actions |
| Memory window | Multi-turn chat widgets |
Safety
- Destructive tools require confirmation tool or human-in-the-loop
- Separate staging tools/credentials
- Log tool calls for audit
References
references/TOOLS.mdreferences/RAG_AND_MEMORY.mdreferences/STRUCTURED_OUTPUT.md
Open this reference as its own page
RAG & memory
RAG
- Chunking strategy matters more than model choice for many corpora
- Metadata filters (product, locale, version)
- Cite sources in final answer when user-facing
Memory
- Window buffer for chat UIs
- Do not store secrets in memory
- Per-session keys (conversation id)
Open this reference as its own page
Structured output
- Attach output parser with explicit JSON schema
- Validate in a downstream Code/IF before side effects
- On parse failure → error branch, not silent continue
Open this reference as its own page
Agent tools
Naming
- verb_noun, stable, unique
- No overlapping tools with ambiguous boundaries
Description checklist
- What it does / does not do
- Required inputs + types
- Side effects
- Error modes the model should expect
Workflow-as-tool
- Trigger: Execute Workflow Trigger with Define Below inputs when used as tool (clear schema)
- Return a small JSON the model can read
- Tag workflow
tool+subworkflow
More in this playbook
Safe to turn on
Use this skill when an agent or person is about to create, change or enable an automation inside someone else's account or a shared environment: "create this workflow", "build it in the customer's account", "turn it on", "go live", "deploy this automation". Produces a proposal the human approves, an automation created in the off state, and a short list of what only the human can finish.
Workflow buildingMITn8n agents
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 topologies.
Workflow buildingMITn8n agents
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 topologies.


