Agent Auth Gateway v1.0

Guides / 7 min read

How to Set Spend Limits for a CrewAI Crew

Published 2026-11-14 · Reviewed 2026-11-14 · By the Ingenious AI team

A CrewAI crew is not one agent with a budget problem. It is three or four agents handing work to each other, each retry invisible to the others, and the bill arriving as one undifferentiated total.

The short answer

Give every crew member its own identity and its own ceiling, then cap the crew as a whole. In practice that means: a per-agent daily cap evaluated before every model or tool call, a maximum step count for the crew's process, and a crew-level tripwire that pauses delegation when combined burn passes roughly 70 percent of the day's expected spend. CrewAI's own task retries and manager re-planning multiply calls quietly, so a single shared API key with a monthly provider cap is not a limit on a crew — it is a shared pool the fastest member drains first.

Check your own setup as you read: run the free Spend Guard self-check or test a policy in the playground — five minutes, no signup, and the gaps it names map to the controls below.

Worked example: the research crew that billed $612 in a weekend

Northfield Advisory, a fictional six-person market-research shop, ran a CrewAI crew of a researcher, an analyst and a writer every Friday at 18:00. Normal cost was $11 to $14 per run. On the Friday before a holiday weekend the researcher's search tool began returning empty results, the manager agent re-delegated the same task 214 times, and each re-plan re-ran the analyst's $0.31 summarisation call. By Monday 07:40 the crew had made 19,480 model calls and spent $612.40 — against a monthly budget of $400 for the whole practice.

Northfield's fix took an afternoon. Each crew member got its own gateway identity: researcher capped at $25 a day, analyst at $18, writer at $9, with a crew-level tripwire at $38 a day that holds new delegations for approval. The step budget for the whole process was set at 400 steps — the largest legitimate run in their logs had used 311. The next empty-result Friday, the crew stopped itself at $25.04 after 96 minutes, the owner approved one manual retry from her phone, and the run finished for $13.70 total.

Why crews spend differently from single agents

A single agent loops in a line; a crew loops in a graph. Delegation means agent A can re-ask agent B, whose answer triggers agent C, whose question sends A back to its tools. No individual member sees an abnormal pattern — the researcher in the example made a perfectly reasonable request each time. Only the authorisation layer, which sees every call from every member against every cap, sees the shape of the whole loop. That is why crew controls have to live outside the crew: a prompt instruction like 'do not spend more than $20' is advice the next re-plan can forget.

Size member caps from the task, not the crew total

Start from what each role legitimately costs. A researcher with search tools is your expensive member; a writer working from supplied notes is cheap. Log two weeks of normal runs, take each member's 95th-percentile daily spend, and set the daily cap at three to five times that figure. Then set the crew tripwire below the sum of the member caps — its job is to catch correlated failure, where several members burn together in a way no single cap would catch until much later.

Step budgets are the crew's second brake

Dollars are a lagging signal when calls are cheap. Steps are not: a crew that normally finishes in 300 steps and is at step 900 is looping, whatever the bill says so far. Set a process-level step budget, count every delegation, tool call and re-plan against it, and end the run when it is exhausted. Pair it with the spend caps rather than choosing one — cheap-call loops are caught by steps, expensive-call drift is caught by dollars.

What the gateway evaluates on every call

Each call arrives with the member's identity, the action name and an estimated cost. The policy layer checks the member's daily and monthly ceilings, the crew tripwire and the step count, in that order, before the call is allowed to spend. A member that hits its own cap is refused while the rest of the crew can still finish read-only work — a scoped stop, not a fleet outage. Every evaluation is logged, which is what makes the Monday-morning question 'which member spent what' answerable in one query instead of an archaeology dig through provider invoices.

How this maps to a CrewAI deployment in the gateway

Register the crew as a small fleet, not as one agent: the orchestrator and each member get separate registry entries, linked by the crew's name, so caps, tripwires and logs all roll up by member and by crew. In the proxy, every member call carries its member id and the crew's run id, which is what lets the gateway enforce the crew tripwire — a rule no single member could evaluate, because no member can see the others' spend. When you test the setup, run the crew against a deliberately empty search result and watch three numbers in the live log: the researcher's cap refusing at its line, the crew tripwire holding delegation, and the step counter ending the run. If all three fire in the test, they will fire on the bad Friday.

Five actions to cap a CrewAI crew today

  1. Give each crew member its own agent identity and API credential — never one shared key for the whole crew.
  2. Set a per-member daily spend cap at 3–5× that member's observed 95th-percentile daily spend.
  3. Add a crew-level tripwire below the sum of member caps that routes new delegations to a human approval.
  4. Set a process step budget roughly 25 percent above your largest legitimate run, and end runs that exhaust it.
  5. Run one deliberate empty-tool-result test and confirm the crew stops at the cap, not at the provider invoice.

Source note and related guides

Figures in the worked example are illustrative, drawn from a fictional company created for this guide; the controls, failure patterns and procedures described are the gateway's documented behaviour — see the Agent Auth Gateway documentation and the policy patterns in allowlists vs denylists, spend caps and the agent kill switch. Reviewed by the Ingenious AI team, 2026-11-14.

Sources

  • OpenAI API documentation — Rate limits and spend limits, on how provider-side usage and spend limits are defined at organization and project level: platform.openai.com, 2026
  • NIST AI Risk Management Framework (AI RMF 1.0), the voluntary framework for managing AI risk across design, development and use: nist.gov, 2023
  • OWASP Top 10 for Large Language Model Applications, the OWASP GenAI Security Project's risk list for LLM and agent systems: owasp.org, 2025

Frequently asked questions

How do I limit how much a CrewAI crew can spend?

Give each crew member its own identity with a per-agent daily spend cap evaluated before every call, add a crew-level tripwire that holds delegation for approval, and set a process step budget. A shared provider cap cannot tell members apart and reacts monthly, not per call.

Why did my CrewAI crew spend so much overnight?

The usual cause is re-delegation: a tool returns empty or malformed results, the manager re-plans and re-asks, and each loop re-runs downstream members. It is a graph-shaped loop, so no single member looks abnormal — only the combined burn and step count show it.

What step budget should a crew have?

Measure your largest legitimate completed run and add about 25 percent. In the worked example the largest real run used 311 steps, so the budget was set at 400. Revisit it when you add members or tools.

Can one capped member block the whole crew?

It blocks that member's further calls. Other members can still do read-only or already-funded work, and the owner can raise the cap deliberately after reviewing the log. That scoped stop is the point — the alternative is the whole crew draining a shared pool.

Do prompt instructions count as a spend limit?

No. A prompt is advice inside the system you are trying to bound; re-planning, retries and delegation can all route around it. A limit only counts if something outside the agent refuses the call that would cross it.

Governing agents in production?

Spend caps, approval queues, policy simulation, burn forecasting, and step-up lockdowns — all built into the gateway. Free tier to start. Or test policies in the playground with no signup.

Share this: X Facebook LinkedIn WhatsApp
← MCP Health Probe: Is Your MCP Server Rea… All guides How to Control Spend in AutoGen Multi-Ag… →