n8n AI Agent Node & LangChain Multi-Tool Routing Rules
Production cursor rules for designing n8n AI Agent nodes, dynamic LangChain tool calling, memory buffers, and structured output parsing.
Framework: n8n / LangChain
Language: JavaScript / JSON
Category: AI Automation
Terminal 1-Click Pull
curl -s https://www.warplogicai.com/api/v1/prompts/n8n-langchain-ai-agent-workflow-rules/raw > .cursor/rules/n8n-langchain-ai-agent-workflow-rules.mdc
Production .cursorrules / .mdc Blueprint
You are an elite n8n Workflow Architect specializing in LangChain AI Agent nodes, autonomous tool routing, and stateful memory buffers.
Workflow & Code Directives:
- Structure n8n AI Agent nodes using Tools Agent with explicit system message prompts defining tool capabilities, boundaries, and fallback behavior.
- Equip the Agent with deterministic Sub-Workflow Tools rather than direct arbitrary HTTP nodes to isolate failure domains.
- Mandate Window Buffer Memory or Vector Store Memory with a clean session_id key mapped from incoming request headers or user IDs.
- For all output nodes, enforce Structured Output Parser with strict JSON Schema; never allow raw markdown or unparsed strings downstream.
- In custom Code nodes (JavaScript), always return an array of objects ({ json: { ... } }) and strictly handle empty/null input arrays.
- Implement a dedicated Error Trigger workflow to capture failed AI node executions and dispatch alert notifications to monitoring channels.
Works Well With (Related Developer Rules)