What is n8n?
n8n is a self-hosted automation platform with support for AI agents, vector databases, and LangChain chains right in the visual editor.
Installing via Docker Compose
version: "3"
services:
n8n:
image: n8nio/n8n
ports:
- "5678:5678"
environment:
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=admin
- N8N_BASIC_AUTH_PASSWORD=securepassword
- WEBHOOK_URL=https://n8n.yourdomain.com
volumes:
- n8n_data:/home/node/.n8n
restart: always
volumes:
n8n_data:Creating an AI agent in n8n
- Create a new Workflow
- Add an AI Agent node
- Select Chat Model → Ollama
- Enter the URL:
http://host.docker.internal:11434 - Add tools: Wikipedia, Calculator, HTTP Request
- Connect a trigger (Webhook, Schedule, Chat)
AI workflow examples
- Telegram chatbot with memory and search
- Automatic processing of incoming email with AI replies
- Website monitoring and AI analysis of changes
- Generating reports from databases
Common setup errors
ECONNREFUSED when calling Ollama
The AI Agent node fails with a connection error:
ECONNREFUSED 127.0.0.1:11434This happens when the URL field is set to localhost while n8n runs in a Docker container: inside a container, localhost points to the container itself, not to the host machine where Ollama listens. The fix is the address http://host.docker.internal:11434, or running both services on the same Docker network and calling by container name.
The production webhook returns 404 even though the test works
In the editor the test webhook fires fine, but the same address in production returns an error:
404 - The requested webhook is not registeredThe production webhook path is only registered for an active workflow. After any change to the nodes you need to toggle Active again, and the WEBHOOK_URL environment value must match the real public address behind the reverse proxy, including the https protocol.
The AI Agent hangs in the "Running" state for a long time
On a VDS without a GPU a large local model responds slowly, and execution is cut off by the node's internal timeout:
Problem in node 'AI Agent'
Workflow did not finish, possible timeoutThe timeout is set in the node's own parameters (Options → Timeout) and defaults to values tuned for cloud APIs, not CPU inference. Increase the timeout or switch to a lighter quantized model.
«Unrecognized node type: n8n-nodes-langchain.agent»
Unrecognized node type: n8n-nodes-langchain.agentAI nodes were added to n8n relatively recently and are not present in every image tag. Update the Docker image to a current version and recreate the container — workflow data survives as long as the n8n_data volume is mounted separately from the container itself.
n8n, Flowise, and hand-written LangChain code: which to choose
All three options solve the same problem — wiring an LLM to tools and triggers — but they trade setup effort for flexibility differently.
| Criterion | n8n | Flowise | Custom LangChain code |
|---|---|---|---|
| Learning curve | Low | Low | High |
| Business logic flexibility | Medium | Low | High |
| Git diff and code review | Hard to read | Hard to read | Full support |
| Ready-made external integrations | Hundreds of nodes | Dozens of nodes | Written by hand |
When n8n is not a good fit
The no-code layer saves time at the start, but it has a complexity ceiling beyond which the visual editor starts getting in the way instead of helping.
- Branching logic with dozens of conditions — the node graph turns into an unreadable canvas
- You need git diffs and code review of business logic — a workflow's JSON export reads poorly line by line
- The task needs high concurrency and minimal latency — the Node.js worker becomes a bottleneck
- The team already writes Python or TypeScript, and the no-code layer only adds an extra abstraction layer
- You need unit tests for individual logic steps — the visual editor has no built-in tooling for that
Verifying the result
Before handing a workflow off to production, walk it through from a manual run to a real external call.
- Open the workflow and click Execute Workflow — check the output of each node in turn
- Check the Executions tab for errors and the runtime of each node
- Send a test request to the production webhook address and compare the response
- Run 3–5 questions typical of your domain and judge the agent's answer quality
- Make sure the workflow is marked Active — otherwise the production webhook will not accept requests
curl -X POST https://n8n.yourdomain.com/webhook/test-agent \
-H "Content-Type: application/json" \
-d '{"message":"test question"}'Related: a visual no-code builder — Flowise on a VDS, a local model for the agent — installing Ollama, answers over your own documents — RAG on a VDS.