The AI Agent node in n8n gives a language model a set of tools and lets it decide which to call, in what order, and how many times. That is genuinely different from a chain, where you decide the sequence. The autonomy is the feature, and it is also why an agent costs more, runs slower, and behaves differently on identical inputs.
Knowing when that trade is worth taking is most of what separates a workflow that works from one that quietly burns credits. A lot of what gets built as an agent is a chain with extra steps and a bill.
Table of contents
- How the node works
- Agent against chain
- Writing tool descriptions that work
- Controlling cost and runaway loops
- What to watch in production
- Where this runs matters
- How this fits the rest of the stack
- FAQ
How the node works
The AI Agent node is a root node that requires sub-nodes connected to it:
- A chat model — the language model doing the reasoning. Required.
- Tools — at least one. Each is something the model can invoke: an HTTP request, a database query, a calculator, another workflow.
- Memory — optional. Lets the agent retain context across executions rather than starting fresh.
- An output parser — optional. Constrains the response into a structure you can rely on downstream.
At runtime the model receives your prompt plus descriptions of the available tools. It decides whether to answer directly or call a tool, sees the result, and decides again. That loop continues until it produces a final answer or hits an iteration limit.
The tool descriptions are the part that determines whether this works. The model chooses tools based entirely on what you wrote about them. A vague description produces wrong tool choices, and the failure looks like the model being unreliable rather than the description being unclear.
Agent against chain
A basic LLM chain does one thing: takes input, calls the model, returns output. You control the sequence entirely.
The comparison that matters:
- Predictability. A chain runs the same steps every time. An agent may call three tools on one input and none on the next.
- Cost. A chain is one model call. An agent is one call per reasoning step plus the tool results fed back in, so a five-step agent run can be an order of magnitude more expensive.
- Latency. Sequential model calls add up. A chain returns in one round trip; an agent takes as many as it decides to.
- Debuggability. A chain that produces wrong output has one place to look. An agent has a decision path that differs per run.
The honest guidance: if you can express the task as a fixed sequence, use a chain. Reach for an agent when the correct sequence genuinely depends on the input in ways you cannot enumerate.
A useful test: write down the steps for three representative inputs. If the steps are the same, you want a chain. If they differ substantially and unpredictably, an agent earns its cost.
Writing tool descriptions that work
This is where most agent workflows succeed or fail, and it gets far less attention than the prompt.
A description needs to answer three questions for the model: what does this do, when should it be used, and what does it need. Compare:
- Weak: Gets customer data.
- Better: Looks up a customer record by email address. Use when you need a customer’s plan, signup date, or billing status. Requires the exact email address; returns nothing for a partial match.
The second tells the model when not to use the tool, which is at least as valuable. Agents fail more often by calling the wrong tool confidently than by failing to call one.
Two related practices:
- Keep the tool count low. Five well-described tools outperform fifteen vaguely-described ones. Every additional tool is more to choose between and more tokens in every request.
- Make tools do one thing. A tool that behaves differently depending on a mode parameter is hard for a model to use correctly, exactly as it would be for a person reading only the docstring.
Controlling cost and runaway loops
An agent that loops is the failure mode with a bill attached. Four controls worth setting before anything reaches production:
- Max iterations. The node exposes a limit on reasoning steps. Set it deliberately — a low number fails fast rather than spending fifty calls discovering it cannot complete the task.
- A cheaper model where it suffices. Reasoning quality matters for tool selection, and it matters much less for summarising a result. Different nodes can use different models.
- Trimmed tool outputs. Everything a tool returns goes back into the next request as tokens. A tool returning a full API response including forty irrelevant fields is paying for those fields on every subsequent step.
- Memory bounds. Conversation memory grows, and every message is resent. Window it rather than letting it accumulate indefinitely.
That third point is the most commonly missed and often the largest single saving. Filtering a tool’s response down to the fields the model actually needs can cut token usage dramatically with no effect on behaviour.
What to watch in production
Agents fail differently from ordinary workflows, and the failures are quiet:
- Silent wrong answers. The agent completes successfully with an incorrect result. No error, no failed execution, nothing to alert on. This is the main risk and it is why output validation matters more here than elsewhere.
- Cost drift. A prompt change or a model update alters how often tools are called. The workflow still works and costs twice as much.
- Tool failures absorbed. The agent calls a tool, gets an error, and reasons around it — producing an answer based on missing data rather than failing.
- Non-determinism in testing. A workflow that passed your three test inputs can behave differently on the fourth in ways a chain would not.
The countermeasures are unglamorous: use an output parser so the response shape is enforced, validate the result downstream before acting on it, log the tool calls each run made, and alert on cost rather than only on errors.
Logging the decision path is the one that pays back most. When an agent produces a wrong answer, knowing which tools it called and what they returned turns an unreproducible complaint into a specific fault.
Where this runs matters
Agent workflows have infrastructure characteristics that ordinary automations do not.
They are long-running — a multi-step agent can take a minute or more, which affects timeouts on anything calling the workflow via webhook. They are memory-hungry when handling large tool outputs. And they hold state in the n8n database if memory is enabled, which makes that database more load-bearing than for a stateless workflow.
That last point deserves attention if you self-host. The Postgres instance behind n8n holds your workflow definitions, credentials, execution history, and any agent memory. Losing it is losing the work, and execution history from agent runs grows faster than from simple workflows because each run stores every reasoning step.
n8n runs as a managed tool on RunxBuild with its own plan, custom domains, environment variables, autoscaling, and logs — a small instance on the $6 Basic plan, with a managed Postgres beside it on the same ladder. That keeps the instance yours while making the database something that is backed up rather than assumed, which matters more once agent memory is part of what is stored.
Whatever you run it on, set a retention policy on execution history early. Agent workflows fill a disk faster than you expect.
How this fits the rest of the stack
The recurring trade with agents is autonomy against predictability, and the operational consequence is that you need more observability than a fixed workflow requires — the decision path, the token cost, and the output shape all need watching. Running n8n as a managed tool on RunxBuild puts the logs alongside the instance and the managed Postgres beside it from the same $6 Basic plan, so execution history and agent memory sit in a database with backups rather than one you configured yourself. Databases on RunxBuild covers what that includes, and the RunxBuild hosting calculator shows the tool and the database as separate line items.
Useful related references:
- n8n + Qdrant: A Vector Search Node for Real Workflows
- n8n HTTP Request Node: The Auth and Error Playbook
- n8n Rate Limit Node: The Practical Way to Stop Workflows From Hammering an API
- Node services on RunxBuild
FAQ
What is the difference between the AI Agent node and an LLM chain?
A chain runs a fixed sequence you define. An agent gives the model tools and lets it decide which to call and in what order. Agents cost more, run slower, and vary between runs — use a chain whenever the sequence is knowable.
What do I need to connect to an AI Agent node?
A chat model and at least one tool are required. Memory and an output parser are optional but worth adding — memory for multi-turn context, and an output parser so the response shape is enforced rather than hoped for.
Why does my agent call the wrong tool?
Almost always the tool descriptions. The model chooses based entirely on what you wrote, so a description should say what the tool does, when to use it, when not to, and what it requires. Fewer, clearer tools beat many vague ones.
How do I stop an agent from running up costs?
Set a max iterations limit, trim tool outputs to only the fields needed, bound conversation memory with a window, and use a cheaper model for steps that do not need reasoning. Trimming tool output is usually the largest single saving.
What should I monitor on an agent workflow?
Silent wrong answers are the main risk — the run succeeds with an incorrect result and nothing alerts. Validate output shape with a parser, log which tools each run called, and alert on cost as well as errors.