- 01
Set Max Iterations on the agent
In the AI Agent node, open Options and set Max Iterations to the most tool calls a sane run needs, not the most it could ever use.
- 02
Guard expensive tools
Put costly tools behind a sub-workflow that counts calls or checks a budget and returns a short refusal to the agent. For risky tools, require human approval.
- 03
Point n8n's OpenAI credential at Fuse
In n8n's OpenAI credentials, set the Base URL to your Fuse URL and the API key to a Fuse key made just for n8n. Fuse routes by model name, so the same credential reaches Claude, Gemini or Mistral models if you type their id and switch them on in Fuse.
n8n OpenAI credentialBase URL: https://fuse.ospalabs.com/v1 API Key: fz_your_n8n_key
- 04
Set a daily ceiling for n8n
Give n8n its own Fuse project or a key cap. When a loop reaches the limit, the next call gets a 402 and the run fails, instead of running all night.
- 05
Get told when it happens
Connect Slack, Discord or Teams to the project's alerts. You hear about the warning, the blown fuse and unusual hourly spend.
Stop an n8n AI agent from looping (and burning your API budget)
Updated October 2026
The n8n AI Agent node keeps calling tools until the model answers without asking for one. If a tool returns something the model doesn't understand, it can keep trying. And a workflow can loop one level up: a webhook that retries, a schedule that fires while the last run is still going, an error workflow that triggers the same flow again.
Max Iterations limits one run. It doesn't limit how many runs happen, or what they cost in dollars.
Questions
Does Max Iterations stop runaway costs?
It stops a single run from going on forever. It doesn't stop a workflow from being triggered again and again, and it doesn't know about dollars.
What does the agent see when the ceiling is hit?
The model call fails with HTTP 402 (fuse_blown). Add an error branch in the workflow to notify you or end the run cleanly.