aiagentrank.io
Subscribe
⚙️Ops3 min read

How to use AI with n8n in 2026: self-hosted agent workflows

n8n + LLMs lets you build self-hosted AI workflows without vendor lock-in. The practical patterns that work for real production use cases.

AI Agent Rank EditorsPublished May 10, 2026Updated May 22, 2026

n8n is the right pick when you want AI-powered automation without vendor lock-in or per-operation pricing. Self-host on a $20/mo VPS and run unlimited workflows.

Why pick n8n over alternatives

n8n (self-hosted)Make.comZapier
Cost at scale$20/mo VPS, unlimited ops$9-30/mo, limited ops$20-99/mo, expensive at volume
Self-hostedYes (Docker, k8s)NoNo
Data controlFull — never leaves your infraVendor SaaSVendor SaaS
Setup timeHoursMinutesMinutes
Learning curveSteepModerateEasy
LLM integrationsNative + HTTP for anythingNative + HTTPNative + HTTP

Use n8n if: data sensitivity, high volume, want code-level control. Use Make/Zapier if: you want SaaS without ops.

Setup (the boring part)

Quickest path:

  1. Spin up a $20/mo Hetzner or DigitalOcean VPS
  2. Install with Docker: docker run -p 5678:5678 n8nio/n8n
  3. Set up reverse proxy (Caddy or Nginx) with SSL
  4. Optional: managed n8n Cloud if you want to skip ops ($25-50/mo)

Total time: 1-2 hours if you're comfortable with Docker.

Pattern 1 — LLM in the middle of a workflow

Most common pattern. Trigger fires, data flows through, LLM transforms or decides, output goes somewhere.

Example: support ticket triage

  1. Trigger: New ticket in Help Scout / Zendesk
  2. HTTP node: Pull ticket details
  3. OpenAI node: "Classify this ticket as: billing | technical | sales | other. Reply with just the category."
  4. IF node: Route based on category
  5. Action nodes: Update Slack, assign to right team, set priority

This is the bread-and-butter pattern. 80% of real n8n + LLM workflows look like this.

Pattern 2 — LLM with tool calling

Newer pattern. The LLM is the orchestrator, deciding which n8n functions to call.

Example: research agent

  1. Trigger: User submits topic via webhook
  2. OpenAI/Anthropic node: Use the model's function-calling API
  3. Tool functions defined in n8n: search_web, fetch_url, summarize_text
  4. LLM calls tools as needed
  5. Returns final answer

n8n's "AI Agent" node makes this pattern easier — but it's still 10x more complex than Pattern 1. Use only when truly needed.

Pattern 3 — Local model for sensitive data

When data can't leave your network:

  1. Install Ollama or LocalAI on the same server as n8n
  2. Use n8n's HTTP node to hit the local model endpoint
  3. Same workflow patterns, but model inference is local

Cost: $0 in API fees, but you need a beefy server ($100-500/mo for GPU instances) or accept slower CPU inference.

Worth it for healthcare, legal, or proprietary code workflows.

Pattern 4 — Hybrid (the most common production setup)

Most real-world n8n workflows use multiple models:

  • Claude for writing (because tone)
  • GPT for structured outputs (because reliable JSON mode)
  • Local model for sensitive data (because privacy)
  • Embeddings model for vector ops

n8n lets you mix these in one workflow trivially. That flexibility is why teams who care about model selection pick n8n over Make/Zapier.

Real production gotchas

  • Cost spikes: One bug + autorun + LLM API = $$$. Set hard cost caps on every API integration.
  • Race conditions: n8n's default queue concurrency can collide on shared resources. Set concurrency limits per workflow.
  • Error handling: Add Error Trigger workflows so failures notify Slack rather than fail silently.
  • Secrets: Use n8n's credentials vault. Never hardcode API keys in nodes.

The honest path

For most small teams in 2026:

  • Start with Make.com or Zapier to learn the patterns
  • Migrate to n8n when you hit cost ceilings, need self-hosting, or want code-level control

The mistake is starting with n8n if you've never built a workflow. The learning curve will frustrate you for things Make handles in 30 seconds.

For more options see zapier vs make vs n8n vs lindy.

Agents mentioned in this post

More from the blog