The introduction of the LangChain-powered AI Agent node in n8n enables developers to construct dynamic, non-deterministic decision engines. Rather than hard-coding static If/Else branching rules, an AI Agent dynamically selects which sub-tools to invoke based on user prompts:
1. The 4 Essential Component Sub-Nodes
- Chat Model: The core reasoning engine (e.g. OpenAI GPT-4o, Anthropic Claude 3.5 Sonnet, or Ollama local models).
- Memory Buffer: Persists conversation context across multiple turns (Window Memory or Vector Store Memory).
- Tools & Sub-Workflows: Discrete functional capabilities exposed to the LLM (e.g. SQL Database query, Calculator, Webhook caller, or Web Search).
- Output Parser: Formats final agent synthesis into valid structured JSON payloads.