Cloud Computing · N8N

AI agents in n8n on a local LLM: process automation without sending data out

Remote Admin SysOps Team·November 3, 2026·6 min read

AI agents in n8n can read an email, pull data out of an invoice, score a lead or draft a report, then hand the result to your other systems. If the language model runs on your own GPU rather than a public API, the content of those documents never leaves your infrastructure. Here is how to wire it up, what hardware you need and where projects go wrong.

n8n is a workflow automation platform that we host and deploy for clients. New to it? Start with n8n: what it is and how it works. A classic workflow is deterministic; an agent adds a step that understands unstructured text and decides which tool to call. Below we explain how to build AI agents in n8n on a local model.

The problem: lots of text work you would rather not send outside

Most manual effort goes into unstructured data: a shared inbox, PDF invoices from hundreds of suppliers, contact forms, sales notes. Keyword rules break quickly because everyone writes differently. Our post on automating business processes with n8n workflows covers rule-based scenarios. A language model fills the gaps where rules cannot be written.

A public API works, but customer data goes to an external provider, cost grows with every document and the model can change without notice. A local model avoids that; in exchange it needs hardware and someone to run it.

How AI agents in n8n work with a local model

In n8n an agent is the AI Agent node with a chat model and a set of tools attached: an HTTP request to your ERP or CRM API, a database query, another workflow. The model reads the task and tool descriptions and decides which tool to call, with which parameters (tool calling).

Connecting a local model is straightforward because vLLM and Ollama expose an OpenAI-compatible API. In n8n you create an OpenAI credential with a custom base URL such as http://llm.internal:8000/v1, or use the Ollama Chat Model node. Ollama suits testing, vLLM suits many parallel workflows (see Ollama vs vLLM vs SGLang vs NVIDIA NIM). Keep the endpoint on a private network or behind a VPN.

Example agents

Process What the agent does What needs human approval
Email triage Classifies the message, extracts the order or customer number, routes it to the right queue, drafts a reply Sending the reply to the customer
Invoices to ERP Reads text from the PDF, returns JSON with VAT ID, amounts and line items, checks the supplier record Posting an invoice from a new supplier or above an amount threshold
Lead qualification Reads the form and CRM history, scores the lead against your criteria, assigns a salesperson Changing a customer or deal status
Report generation Pulls figures from the database, writes commentary, assembles the weekly report Sending the report outside the company

Open models that handle tool calling

As of November 2026 (the market changes monthly), these Apache 2.0 models handle tool calling well:

  • Qwen-AgentWorld-35B-A3B: a mixture-of-experts model built for agent work, 35B parameters with 3B active. It computes quickly, but memory must still hold all parameters.
  • gpt-oss-20b and gpt-oss-120b (OpenAI): the smaller one fits a single card, the larger one handles harder multi-step tasks.
  • Qwen3.8-27B: multimodal, useful when the agent has to read scans or photos of documents.

Do not choose by leaderboard: test two or three models on 50–100 real cases from your business. In vLLM you need to enable tool calling and the correct parser for the model family. More in the best open-source LLMs to self-host.

Hardware: DGX Spark or a GPU VPS

A rough memory estimate: parameters × bytes per parameter (4-bit ≈ 0.5 B, 8-bit = 1 B), plus context memory and 10–20% headroom. Agent prompts are long, so leave room for context.

Model Weights only (estimate) Example hardware
gpt-oss-20b approx. 11 GB at 4-bit GPU VPS with A10 24 GB
Qwen3.8-27B approx. 14 GB at 4-bit, 28 GB at 8-bit A10 24 GB (4-bit) or A40 48 GB
Qwen-AgentWorld-35B-A3B approx. 18 GB at 4-bit, 35 GB at 8-bit A40 48 GB
gpt-oss-120b approx. 59 GB at 4-bit 2× A40 96 GB or DGX Spark

A GPU VPS is the simplest start. Our ready-made GPU packages range from a single RTX A2000 12 GB to 2× A40 with 96 GB in total, and run any model, not only DeepSeek. You can have root access or full 24/7 administration.

NVIDIA DGX Spark has 128 GB of unified memory and runs models of up to 200B parameters. Its limit is memory bandwidth (273 GB/s), so with large models it generates tokens more slowly than HBM-based servers. For background automations with few concurrent users that is usually enough. We run it in our data center as a service on a custom quote; see DGX Spark as a Service. n8n itself can run on a separate, ordinary VPS.

Rollout step by step

  1. Pick one high-volume process, for example the shared inbox.
  2. Collect 50–100 real examples with the correct outcome as your test set.
  3. Run the model on vLLM in a private network and connect it to n8n.
  4. Build the workflow: trigger → agent → validation (JSON schema, business rules) → approval → action.
  5. Run in shadow mode for a few weeks: the agent proposes, a person decides.
  6. Switch to automatic only where a mistake is cheap and easy to reverse.
  7. Re-run the same test set after every model or prompt change.

Human in the loop and security

Any action with consequences (sending to a customer, posting, payments, deleting data) should go through approval. In n8n use the Wait node or the “send and wait for response” operation in the email and chat nodes.

  • Least privilege: give the agent its own API account, read-only wherever possible. The ERP user can create draft documents but cannot approve them.
  • Prompt injection: an email may contain text posing as an instruction to the AI. Limit tools to the minimum; a triage agent does not need a send-email tool.
  • Logging: store the input, the model response and every tool call.

Common pitfalls

  • One agent with a dozen tools; several narrow agents with 2–4 tools each work better.
  • No output validation: models occasionally return broken JSON or skip a field.
  • A model too small for multi-step planning; small models are fine for classification.
  • A model endpoint exposed to the internet without authentication.
  • Expecting 100% automation from day one. Aim for the routine cases and pass the rest to people.

FAQ: frequently asked questions

Can n8n use a local LLM?

Yes. n8n connects to any OpenAI-compatible API (vLLM, SGLang, Ollama) via a credential with a custom base URL, and to Ollama via a dedicated node.

Which model is best for AI agents in n8n?

Start by testing Qwen-AgentWorld-35B-A3B, gpt-oss-20b and Qwen3.8-27B on your own examples. For harder multi-step tasks, consider gpt-oss-120b.

Can an AI agent send emails and post invoices on its own?

Technically yes, but we recommend human approval for any action that is hard to undo. Classification, extraction and drafts can be fully automated.

How much does a GPU server for n8n with AI cost?

For 20–35B models a GPU VPS with an A10 24 GB or A40 48 GB is the typical choice; see our ready-made packages. DGX Spark is quoted individually. To compare that cost with staff time and API fees, read how to calculate the ROI of an AI deployment.

Does n8n send my workflow data to OpenAI?

Not if the model runs locally and n8n is hosted by you or by us. But every node that integrates an external service sends data to it.

We host n8n and GPU servers in a Tier III, ISO 27001-certified data center in Poland, with 24/7 administration. See n8n deployment and GPU packages, or get in touch and we will help you pick the first process and size the hardware.