Writing

AI agent cost control: set spending limits before you build

By Scott Wilder · November 5, 2026 · 7 min read · All writing

Set a hard spending limit before an AI agent runs unattended. Agent overruns come from loops, retries and long contexts, and only a limit that stops the run is a real control. Finout reports that Gartner predicts over 40% of agentic AI projects will be canceled by 2027 due to escalating costs and inadequate controls. Finout sells cost governance software, so read that forecast with the seller in mind.

Quick version

Why agents overspend

A chatbot stops when you stop typing. An agent does not. According to CuratedAI's guide, an agent is bounded only by its own stop condition, and many setups have a weak one or none at all.

Three things make the bill grow faster than most people expect.

  1. One request becomes many actions. Finout notes that one user request can cascade into multiple agent actions, each generating its own costs.
  2. Context is resent on every call. Finout says agents consume between 5 and 30 times more tokens per task than standard chatbots, because they carry system prompts, tool definitions and multi-turn reasoning context with every call. CuratedAI gives an example: a 100K-token context used across twenty agent turns is 2M input tokens, not 100K.
  3. Retries can compound. TrueFoundry describes a context that starts at 4,000 tokens and doubles at each step because the previous output gets appended. It reaches 128,000 tokens at step 5, and the per-step cost has gone up 32 times. The check: 4,000 times 32 is 128,000. TrueFoundry sells a gateway with rate limiting, so treat its scenario as an illustration, not a measurement.

People also get the forecast wrong. Finout reports that 85% of organizations misestimate AI costs by more than 10%. If large teams miss, a guess made on a Sunday night will miss too.

What a runaway looks like

Here are two vendor scenarios. Both come from companies that sell cost controls, so they are framed to make the problem look serious. The mechanism is still worth understanding.

Cycles sells a runtime for budget enforcement. It describes a constructed scenario, not a real incident: a team intends to cap a coding agent at $50 overnight. The agent hits an ambiguous error, retries with longer prompts, fans out across three sub-agents and loops for four hours. The bill is $2,300. That is $2,300 divided by $50, or 46 times the intent.

The same article shows how a small task grows. A single summarize-this-repository task can produce 23 calls at an estimated $2.63. If the agent retries or loops, a 23-call task becomes a 200-call task and the cost grows by 10 times.

TrueFoundry says a runaway loop can drain an API quota in 20 minutes. It also says a single incident without enforcement typically costs $2,000 to $8,000 by the time someone notices, and $20 to $100 with its three layers in place. Those are the vendor's own figures, so treat them as a rough range, not a promise.

CuratedAI, which sells nothing related, adds an enterprise data point: one in five enterprises say they cannot stop a runaway AI agent in real time.

Why alerts, dashboards and rate limits are not enough

Most people reach for monitoring first. It feels responsible. It does not stop anything.

Tool What it does What it misses
Dashboard Shows spend after the fact. Cycles says dashboards are retrospective by design. The money is already spent when you see the spike.
Alert Notifies you at a threshold. An alert that fires at $100 does not prevent the $101 call.
Rate limit Controls how fast an agent spends. An agent limited to 10 requests per minute can still burn through $500 over a few hours.
Monthly invoice Shows the total. CuratedAI says monthly invoices arrive too late.
Hard cap Kills the run at a threshold. Needs a sensible threshold, set before the run.

The cleanest line comes from CuratedAI: a budget in a spreadsheet is not a control, and a real control is a hard stop that kills the run when a threshold is crossed.

Four limits to set before the first run

The numbers below are examples from vendors, not recommendations for your project. Pick your own from what the task is worth.

1. A per-run budget

Cap what one task can cost. ElixirData gives the example of a maximum of $2 per customer-support task. ElixirData sells agent governance products, so its framing favors runtime enforcement.

If you run several agents under one task, split the budget. ElixirData's example divides a $5.00 parent budget into $2.00, $1.00 and $1.50 for three agents plus a $0.50 reserve. The sum: $2.00 plus $1.00 plus $1.50 plus $0.50 is $5.00.

2. A quota and a rate limit

Quotas cap how much of a resource one workflow can touch. ElixirData gives a maximum of 50 database queries per workflow. Rate limits cap speed. Its example is a maximum of 20 API calls per minute.

CuratedAI says to treat rate limits like circuit breakers, not annoyances. If an agent hits a limit, it should pause and surface the reason, not retry harder.

3. An account-level cap at your provider

This is the backstop if everything else fails. Anthropic's documentation says that once you reach your tier's spend cap, API usage pauses until 00:00 UTC on the first day of the next month, and that requests return HTTP 429 while paused. It also says you can set your own spend limit below your tier's cap. Other providers have their own rules, so check each provider's docs.

4. A stop condition the agent cannot argue with

The limit must live outside the model. ElixirData puts it this way: cost limits should not depend on the model remembering or voluntarily following them, and the runtime must enforce the boundary. A line in a prompt saying be frugal is a wish, not a limit.

TrueFoundry suggests a circuit breaker that trips when more than 50% of requests in the last 60 seconds are failing. A failing loop is often an expensive loop.

Start in log-only mode

Limits set too tight break good runs. Limits set too loose do nothing. TrueFoundry recommends starting with every threshold set to log but not enforce, then setting token bucket thresholds at the P99 of observed legitimate traffic plus a margin. In plain terms: watch normal use first, then draw the line just above it.

That is sensible for a solo builder too. Run the agent on a small task with logging only. Look at what a normal run costs. Then set the cap above that and turn it on.

What to ask before you buy a tool

This is our view, not a sourced fact: for a one-person project, a plain provider cap plus a per-run limit beats a large platform you will not maintain. If you do shop, ask these questions.

One more point from CuratedAI: the orchestration layer matters more than the model for cost control. A platform with per-task tracing, budget caps and approval gates will save more money than switching from a $3 to a $1 model.

Every vendor cited here sells something. Ask each to show the stop behavior, not a dashboard.

Why this matters most for a side project

A company can absorb a bad week. A side project with one spare hour a night often cannot. The homepage of this site cites the Federal Reserve: 37 percent of adults could not cover a surprise $400 expense with cash. A runaway agent bill is exactly that kind of surprise.

In our view, this is how side projects die. The idea was fine. One uncapped weekend ended it before it could show whether it worked. Limits are cheap insurance for the time you have already put in.

If you are still choosing what to hand to an agent, read what to never automate with an AI agent. For the money side, see AI agent spending limits. For fitting this into a day job, see shipping side projects while working full time.

Get the checklist

The short version of all this fits on one page. Sunday Night Truths is a free weekly email, and signing up sends The Agent Leash, which Scott's page describes as a one-page checklist with 15 checks before your AI agent touches your money. Get Sunday Night Truths.

This article is general information, not financial advice. Check with a professional before making decisions about money.

Questions

What is the first spending limit to set on an AI agent?

Start with a hard cap at your provider, then add a per-run budget. Anthropic's docs say you can set your own spend limit below your tier's cap. A per-run budget, such as ElixirData's example of $2 per task, keeps one bad run from using the whole month.

Are billing alerts enough to control agent costs?

No. Cycles points out that an alert fires but does not block the next action, so an alert at $100 does not prevent a $101 call. Cycles sells budget enforcement software, but the logic holds: alerts report, caps stop.

Does a cheaper model solve runaway costs?

Not by itself. CuratedAI says the orchestration layer matters more than the model, and that tracing, caps and approval gates save more than switching from a $3 to a $1 model.

Where should I enforce limits: in the prompt or outside the model?

Outside the model. ElixirData says cost limits should not depend on the model remembering or voluntarily following them, and that the runtime must enforce the boundary. ElixirData sells governance tools, but the point is basic: a prompt can be ignored.

How do I avoid setting limits that break normal runs?

Start in log-only mode and watch real usage. TrueFoundry recommends setting thresholds at the P99 of observed legitimate traffic plus a margin before turning enforcement on.