An AI agent is handed a goal and, within whatever limits you set, can pick or change its next steps and tools as it works, so nobody has written down in advance how many steps it will take, how long it will run, or how much it will cost. Without limits, the answer to all three can be “until something else stops it”: a surprised person looking at a bill, a queue of repeated emails, or a run that never finished.
The fix is to set limits at four levels before the agent runs without you watching: per step (how many model calls or tool calls one run may make, where a tool is an action or data source the agent may call), per run (a timeout, the longest a job may run before it is canceled, plus a budget for it), per period (a daily or monthly spending cap at your AI provider or builder), and per action (how many times a step may be retried, and which actions need a person’s approval). Then add alerts that reach a named person early enough to act. One detail catches many beginners: a budget alert on its own usually stops nothing, because alerts notify while traffic continues; only a hard limit or spend cap blocks further use [1, 2].
If you are still planning your first build, start with the beginner's guide to building an AI agent.
TL;DR
- Before an agent runs unattended, write down a step limit, a timeout, a per-run budget where supported, a monthly cap, alert thresholds and recipients, and a retry rule.
- Base every number on observed test runs, leave margin, and treat vendor defaults as settings, not advice.
- Confirm whether each budget blocks usage or only alerts, and set at least one hard cap at the provider or builder, below your true maximum, because enforcement can lag [1, 2, 3].
- Never let an action that sends, buys, deletes or changes records retry automatically; send it to a person.
The limits you can set, in plain English
- Token: the small unit of text a language model reads and writes, such as a word, a fragment of a word or punctuation [3]. Many AI services price requests by input and output tokens, so tokens drive your bill [3].
- Run: one complete job by the agent, from receiving its goal or trigger to finishing, failing or being stopped. In the OpenAI Agents SDK, for example, a run loops through model calls and tool calls until the agent produces a final answer [4].
- Step (or turn, or iteration): one pass through that loop, usually a model call plus any tool calls it requests [4]. Tools name and count this differently, as “turns,” “iterations” or “LLM calls,” while Zapier meters agent usage in “tasks” [4, 5, 6, 7].
- Timeout: the maximum time a run or a single call may take before it is canceled [8]. Timeouts keep a system from waiting indefinitely on something that will not finish [9].
- Budget or spend limit: a cap on money spent per run, per month or per project [10, 1]. Some budgets only warn; others block further use [1, 2].
- Rate limit: a cap on how many requests can be made in a period, such as requests per minute [5, 11].
- Retry: automatically trying a failed step again. Retries are useful for brief glitches but need their own limit [9].
- Alert: a notification sent when usage crosses a threshold you set, so a person can act before the hard limit [1].
| Limit | What it caps | What it protects against |
|---|---|---|
| Step or turn limit | Model or tool calls in one run | Loops and runaway runs |
| Timeout | Clock time for a run or call | Hung runs and slow failures |
| Per-run budget | Estimated cost of one run | One expensive job |
| Monthly spend limit | Total spend at the provider | A bad week becoming a bad bill |
| Retry limit | Repeats of a failed step | Duplicate actions and wasted cost |
| Alert | Nothing by itself | Finding out late |
Why an agent needs limits even when it is small
Cost per run is hard to predict
TheAgentCompany benchmark (published at NeurIPS 2025) gives agents 175 simulated software-company tasks through the OpenHands agent framework; there, the best model tested, Gemini 2.5 Pro, fully completed 30.3% of tasks while averaging about 27 steps and more than $4 in API cost per task [12, 13]. Another model in the same study, Gemini 2.0 Flash, averaged about 40 steps per task but cost under $1 [12]. Those figures reflect 2025 model versions and prices in a test environment, not your agent, but they show why “it was cheap in testing” is not a spending plan [12].
Princeton researchers make a related point in “AI Agents That Matter” (Transactions on Machine Learning Research, May 2025), an analysis of how AI agents are benchmarked: because calling a model repeatedly can raise accuracy, chasing accuracy alone can lead to unbounded cost, so evaluations must be cost-controlled [14, 15]. Their argument concerns research benchmarks, not a specific product [15].
Loops can keep running until something stops them
LangChain’s documentation says that when a LangGraph agent hits its step limit before a stop condition (the rule that tells it the job is done), the cause is often an infinite loop, though complex graphs can also reach the limit without one [16]. Zapier describes its per-run task limit as protection against “runaway costs from long-running loops or repeated tool calls” [17]. Security guidance treats a related problem, users or attackers driving excessive use, as a risk category: OWASP’s 2025 LLM Top 10 lists “Unbounded Consumption,” where an application allows excessive and uncontrolled model use, leading to outages, economic losses and degraded service [11].
A step limit does not fix a loop; it caps the damage while you find the cause. Diagnosing why an agent repeats itself is covered in how to fix an AI agent that gets stuck or repeats the same mistake.
Retries can repeat real actions
Retrying a failed search is harmless; retrying an action with side effects is not. A timeout does not prove an action failed; an AWS engineering essay notes that side effects may already have happened, and recommends designing such operations so they can be safely repeated [9]. It also recommends capping the number of retries [9]. For an agent, that means a “send email” or “create invoice” step that times out might already have run, and a blind retry could do it twice.
How to choose starting limits
We found no study, standard or government guidance that prescribes starting values for a beginner’s agent. The method below is BuildAIQ editorial judgment: base each limit on what your agent did in testing, leave room, and adjust later with evidence.
- Observe real test runs first. Run realistic test tasks and record each run’s steps, time and cost. Use your builder’s run history, the log of what each run did, where it exists; Zapier’s Zap history, for example, shows how many tasks each run consumed, broken down by tool call and step [17]. If you use an SDK’s cost figure, remember it may be an estimate: Anthropic says the Claude Agent SDK’s cost fields are client-side estimates, not billing data [18]. Planning those test runs is covered in how to test an AI agent before you trust its work.
- Set the step limit a little above your longest good run. If successful test runs never needed more than 12 steps, a limit somewhere around 15 to 20 lets normal variation through and stops a run that is clearly lost.
- Set a timeout a bit longer than your slowest good run. If the slowest successful run took eight minutes, a timeout around 12 to 15 minutes gives room without letting a stuck run sit for hours.
- Set a per-run budget where your tool supports one. A modest multiple of your most expensive good test run is a reasonable start. As of November 2026, tools cap a run in different units: Zapier’s per-run task limit pauses an AI by Zapier step for approval, while Anthropic’s per-run budget option stops a run when its cost estimate reaches the limit, though the estimate can overshoot, so leave headroom [7, 10].
- Set a monthly cap at the provider for an amount you could absorb. Set it below your true maximum, because enforcement lags: as of November 2026, OpenAI says recorded spend can slightly exceed a hard limit, and Google says overages from reporting delays are billed as normal [1, 19].
- Add alerts well before the cap. OpenAI advises alert thresholds that leave time to adjust usage, raise the limit or investigate [1]. Google’s spend caps, for comparison, notify at 50%, 80% and 100% of the cap, as of November 2026 [19].
- Write a retry rule. Allow a small number of retries for read-only steps such as searches. For anything that sends, buys, deletes or changes records, do not retry automatically unless you know the action is safe to repeat; route it to a person instead [9]. Designing that approval step is covered in how to make an AI agent ask before it takes action.
Don’t treat a tool’s default as advice. Defaults differ widely and measure different things: as of November 2026, n8n’s AI Agent node defaults to 10 iterations, CrewAI to 20 iterations, an AI by Zapier step to 75 tasks per run, and Google’s Agent Development Kit to 500 LLM calls per run [20, 5, 7, 6]. Some settings have no limit unless you set one, such as the Claude Agent SDK’s turn and budget options and n8n’s self-hosted workflow timeout [10, 8].
Where the settings usually live
Limits typically sit in three layers: the no-code builder, the agent framework and the AI provider’s billing settings. A well-limited agent uses more than one. The examples below are as of November 2026, not exhaustive, and change often; check current documentation and your plan before relying on them [17, 7, 1].
No-code builders
In AI by Zapier, the agent step in Zapier’s Zap editor, each step has a task limit per run, 75 tasks by default and adjustable up to 500, as of the help page updated November 13, 2026 [7]. The plan badges on that page, checked in its HTML, mark the Free plan as ineligible and the Professional, Team and Enterprise plans as eligible [7]. Zapier’s October 1, 2026 help article says the older standalone Agents are being migrated to AI by Zapier steps, with no shutdown date set for Agents yet [17].
In n8n, the AI Agent node has a Max Iterations option, and self-hosted installations can set a workflow timeout that cancels a workflow after a set number of seconds [20, 8]. In Microsoft Copilot Studio, admins can set a monthly consumption limit for each agent in the Power Platform admin center, according to a Microsoft page last updated October 15, 2026 [21].
Agent frameworks
The OpenAI Agents SDK uses max_turns [4]. The Claude Agent SDK offers max_turns and a max_budget_usd option for a per-run cost ceiling [10]. Google’s Agent Development Kit uses max_llm_calls [6]. LangGraph uses a recursion_limit setting [16]. CrewAI offers max_iter, max_execution_time in seconds, and max_rpm for requests per minute [5].
AI provider billing
OpenAI’s API platform separates spend alerts, which send a notification while traffic continues, from hard spend limits, which can be set for an organization or a single project [1]. Anthropic lets an organization set its own monthly spend limit below its usage tier’s cap in the Claude Console, and lets workspaces have their own limits [22]. Google Cloud’s alerts-only budgets notify but do not cap spending, while spend cap budgets pause one listed service in one project for the rest of the monthly budget period; four services are listed, including the Gemini API [2, 19].
What happens when a limit is hit
As of November 2026, each limit does one of four things when reached; know which applies to yours [4, 7, 21, 1].
- Stop with an error. The OpenAI Agents SDK raises a MaxTurnsExceeded error, LangGraph raises GRAPH_RECURSION_LIMIT, and the Claude Agent SDK ends with a result marked error_max_turns or error_max_budget_usd [4, 16, 10]. At the provider level, a spend limit you set fails differently by vendor: OpenAI returns a 429 error coded organization_spend_limit_exceeded or project_spend_limit_exceeded, while Anthropic returns a 400 invalid_request_error saying you reached your specified usage limits [1, 22]. Separate tier-based caps return other codes: organization_usage_limit_exceeded at OpenAI and a 429 coded enforced_spend_limit_reached at Anthropic [1, 22].
- Pause for a person. When an AI by Zapier step reaches its task limit during a live run, Zapier pauses the step and asks for approval before continuing [7].
- Switch something off. Copilot Studio can turn an agent off automatically once it hits its monthly limit, though that limit doesn’t stop agent flows the agent calls, which are billed separately; Google’s spend caps pause the capped service until the next period unless someone lifts the cap [21, 19].
- Alert only. OpenAI spend alerts and Google’s alerts-only budgets notify people but let usage continue [1, 2].
Enforcement is rarely instant. OpenAI, Google and Microsoft each say usage can continue past a limit for a while as it takes effect, and Google notes that requests already in progress are allowed to finish [1, 19, 21]. A timeout may also wait for the current step: in self-hosted n8n, a timeout in the main process takes effect after the current node finishes [8].
A stopped run may leave work half done. Check what the agent completed before it stopped, especially any external actions, before you rerun it. Retrying blindly can also fail: Anthropic says that once an organization reaches its tier’s spend cap, retries, including automatic ones, keep failing until access resumes [22]. In code, you can return a clear message instead of a raw error; the OpenAI Agents SDK, for example, can turn a turn-limit stop into a controlled final answer [4]. When a limit keeps tripping, find out why before raising it; it often signals a loop or a poorly scoped goal.
Who gets alerted, and who decides what happens next
Default alert recipients are often billing or platform administrators, not the person who owns the agent. Google Cloud budget emails go by default to billing administrators and users on the billing account, and spend cap notifications go to billing administrators and project owners, recipients that can’t be customized; alerts-only budgets can add other email recipients through Cloud Monitoring [2, 19]. Copilot Studio sends per-agent limit alerts to environment and tenant admins [21].
So decide, before launch:
- Who owns the agent and receives every limit alert, plus a backup for when that person is away.
- Who may raise a limit and how that change is recorded.
- Who approves a paused run, as in Zapier’s pause-for-approval flow, and what they should check before approving [7].
- When to pause the agent entirely, for example after the same limit trips twice in a week.
For how closely a person should watch, see when an AI agent needs human supervision; for alert routing, logs and limit changes after launch, see monitoring your agent after launch.
Example: limits for a weekly research-summary agent
Imagine an agent that runs every Monday, searches a fixed list of public industry sources, and saves a draft summary for a small team. It can search and read web pages and save a draft to one shared folder; it cannot send email or publish anything. The starting limits below are BuildAIQ editorial judgment, derived from imagined test runs in which the longest good run took 18 steps and the slowest took nine minutes.
| Limit | Starting setting | Why |
|---|---|---|
| Step limit | About 25 steps | Above the longest good test run |
| Timeout | About 15 minutes | Room above the slowest good test run |
| Per-run budget | About twice the most expensive good test run | Catches a single runaway run |
| Monthly cap | Set at the provider, at an amount the team could absorb | Backstop across all runs |
| Alerts | At about half and about four-fifths of the monthly cap, to the owner and a backup | Time to investigate before the cap |
| Retries | Up to two for searches; none for saving the draft | Avoids duplicate drafts |
Human review point: a named person reads the draft and checks its sources before anyone shares or acts on it. If a run stops on a limit, that person checks what was saved before rerunning it.
Sensitive-data flags: keep the agent’s sources public. If you later point it at client files, internal documents, or anything containing personal, financial, health, employment or other regulated information, move to a system approved for that kind of data and narrow the agent’s access first; see how to give an agent tool access without giving it too much control. Run histories can record data passed to tools, so they need the same care [17].
If an agent can spend money directly, such as buying or paying for things, usage limits on the model do not cap those purchases. Treat every purchase or payment as an action that requires a person’s approval, and set limits in the payment system itself.
Practical Takeaways
- Before an agent runs unattended, write down a step limit, a timeout, a per-run budget where supported, a monthly cap, alert thresholds and recipients, and a retry rule.
- Base every number on observed test runs, leave margin, and treat vendor defaults as settings, not advice.
- Confirm whether each budget blocks usage or only alerts, and set at least one hard cap at the provider or builder, below your true maximum, because enforcement can lag [1, 2, 19].
- Never let an action that sends, buys, deletes or changes records retry automatically; send it to a person.
- Route alerts to the agent’s owner and a backup, not only to billing admins; where a platform fixes the recipients, as Google does for spend caps, add a separate alert the owner receives [19, 2]. Decide in advance who may raise a limit.
Sources
- Spend limits. OpenAI (API documentation), accessed 2026-11-13.
- Create, edit, or delete budgets and budget alerts. Google Cloud (Cloud Billing documentation), 2026-11-10, accessed 2026-11-13.
- Understand tokens. Microsoft Learn (.NET AI documentation), 2026-03-13, accessed 2026-11-13.
- Running agents. OpenAI (OpenAI Agents SDK for Python documentation), accessed 2026-11-13.
- Agents. CrewAI (documentation), accessed 2026-11-13.
- Runtime Configuration (RunConfig). Google (Agent Development Kit documentation), accessed 2026-11-13.
- AI by Zapier model tier pricing. Zapier Help Center, 2026-11-13, accessed 2026-11-13.
- Configure workflow timeouts. n8n (documentation), accessed 2026-11-13.
- Timeouts, retries and backoff with jitter. Amazon Builders' Library (AWS), 2019-12-05, accessed 2026-11-13.
- Agent SDK reference – Python. Anthropic (Claude Agent SDK documentation), accessed 2026-11-13.
- LLM10:2025 Unbounded Consumption. OWASP GenAI Security Project, accessed 2026-11-13.
- TheAgentCompany: Benchmarking LLM Agents on Consequential Real World Tasks (arXiv v3). arXiv / NeurIPS 2025, 2025-09-10, accessed 2026-11-13.
- TheAgentCompany: Benchmarking LLM Agents on Consequential Real World Tasks (NeurIPS 2025 poster). NeurIPS, 2025, accessed 2026-11-13.
- AI Agents That Matter (arXiv v1). arXiv, 2024-07-01, accessed 2026-11-13.
- AI Agents That Matter (Transactions on Machine Learning Research, published version PDF). Transactions on Machine Learning Research (OpenReview PDF, read via Internet Archive capture of 2025-12-13), 2025-05, accessed 2026-11-13.
- GRAPH_RECURSION_LIMIT. LangChain (LangGraph documentation), accessed 2026-11-13.
- Migrating from Agents to AI by Zapier. Zapier Help Center, 2026-10-01, accessed 2026-11-13.
- Track cost and usage. Anthropic (Claude Agent SDK documentation), accessed 2026-11-13.
- Manage spend cap budgets. Google Cloud (Cloud Billing documentation), 2026-11-10, accessed 2026-11-13.
- Tools AI Agent node. n8n (documentation), accessed 2026-11-13.
- Manage Copilot Credits and capacity. Microsoft Learn (Power Platform admin documentation), 2026-10-15, accessed 2026-11-13.
- Rate limits. Anthropic (Claude Platform documentation), accessed 2026-11-13.
