Guide

How to limit what a CrewAI crew can spend

A crew of three agents, each allowed 20 iterations, with long task outputs passed between them. You find out what it cost when it finishes.

Short answer

CrewAI lets you cap each agent with max_iter, max_execution_time and max_rpm, but it has no dollar limit: usage_metrics only tells you what a crew spent after it finished. To cap spend, check a running cost total before each model call and stop the crew when the next call would go over budget.

CrewAI has several settings that keep agents from running forever. None of them is a dollar limit. Here is what each setting does, where the gap is, and how to stop a crew before it spends more than you planned.

What CrewAI gives you

These settings come from CrewAI's own docs:

  • max_iter on an agent: the most iterations it may take before it must give its best answer. The default is 20.
  • max_execution_time on an agent: a time limit in seconds. Off by default.
  • max_rpm on an agent or the crew: a cap on model requests per minute. The crew's value overrides the agents'.
  • A fixed repeat stop. From release 1.15.29, a run that makes the same tool call with the same arguments and gets the same result five times is stopped. You cannot change the five.
  • usage_metrics on the crew: token usage, available after the run ends.
from crewai import Agent, Crew

researcher = Agent(
    role="Researcher",
    goal="Find pricing for the top 5 competitors",
    backstory="...",
    max_iter=10,              # default is 20
    max_execution_time=300,   # seconds
    max_rpm=20,               # model requests per minute
)

crew = Crew(agents=[researcher], tasks=[research_task], max_rpm=30)
result = crew.kickoff()
print(crew.usage_metrics)    # what it spent, after the fact

Where the gap is

Every limit above counts iterations, seconds or requests. usage_metrics is the only thing that knows about tokens, and it tells you after the money is spent. In a crew this matters more than for a single agent:

  • Limits are per agent. Three agents at max_iter=20 is up to 60 iterations, and each task passes its output into the next task's context.
  • Rate limits slow spending down, they do not stop it. max_rpm spreads the same bill over more minutes.
  • The repeat stop needs an identical result too. A tool that returns a slightly different answer each time never trips it.

Adding a spend limit

What you need is a running cost total for the whole crew, checked before each model call, that ends the crew when the next call would go over budget. CrewAI has hooks that run before and after each model call and each tool call, which is the right place for that check. Keep the prices for each model you use up to date, and make sure one total covers every agent in the crew, not one total per agent.

Doing it with SteerPlane

SteerPlane's CrewAI monitor uses those same hooks. It keeps one budget for the whole crew, with prices for over 100 models, plus a step limit, a time limit and deny rules on tool names. Install it with pip install steerplane:

from steerplane.integrations.crewai import SteerPlaneCrewMonitor

monitor = SteerPlaneCrewMonitor(
    agent_name="research_crew",
    model="gpt-4o-mini",
    max_cost_usd=1.00,
    max_steps=100,
    max_runtime_sec=600,
    denied_actions=["delete_*", "send_*"],
)

crew = Crew(agents=[researcher, writer], tasks=[research_task, write_task])
result = monitor.kickoff(crew)   # raises the SteerPlane error if a limit stops the crew

Each model call and each tool call counts as one step. Once the crew reaches a limit, the next call is refused and the crew ends. It needs CrewAI 1.15.35 or newer. CrewAI's hooks apply to the whole process, so use one monitor per crew. Every run shows up in the dashboard with its steps, cost and why it stopped.

We tested it on 24 November 2026 with CrewAI 1.15.45, SteerPlane 1.1.5 and gpt-4o-mini: a one-agent crew with a tool that always fails, told to keep retrying, and max_cost_usd=0.0003. The crew was ended with a cost limit error after six tool calls.

Loop detection is off by default in the monitor, because it matches on tool names and would stop a healthy crew that calls the same tool over a list. CrewAI's own repeat stop still applies. Setup steps are on the setup page.

A checklist for CrewAI crews

  • max_iter set on every agent, lower than the default if the task is small.
  • max_execution_time set, so a stuck agent cannot run all night.
  • One dollar budget for the whole crew, checked before each model call.
  • Deny rules on tools that send, pay or delete.
  • A test crew built to overspend, to prove the limit stops it.

Questions people ask

Does CrewAI have a budget or cost limit?

No. CrewAI reports token usage after a run through usage_metrics, but it has no setting that stops a crew at a dollar amount.

What does max_iter do in CrewAI?

It is the most iterations an agent may take before it must give its best answer. The default is 20.

Does CrewAI stop repeated tool calls?

From release 1.15.29, CrewAI stops a run after the same tool call with the same arguments and the same result five times. The limit of five is fixed.

Keep reading
Design partners

Shipping agents? Let's talk.

Our first 10 design partners get every paid feature free, plus direct help setting up.