Skip to content
BENIBIX Learn

maxBudgetUsd Option

Also known as maxBudgetUsd, max_budget_usd, Agent SDK spend cap, Claude Agent SDK maxBudgetUsd

The option that stops a run once it has spent a set sum.

Think of it like

It is like giving a child five dollars for the fair. When it is spent, the fun stops.

Example

Mia lets users start research agents. She sets maxBudgetUsd to 2, so no single run can cost much.

Why it matters

An agent that loops can burn money fast, and a cap makes the worst case known.

Definition

maxBudgetUsd is the Agent SDK option that stops a run when its estimated spend reaches a dollar amount. In Python it is max_budget_usd. Spend by subagents counts too. The check runs after each reply, so the reply that crosses the line still ends. Spend can go a little past the cap. The run then ends with an error result.

Common mistake

Setting it to 0 to mean no cap. The CLI rejects 0, and the session never runs.

Key takeaways

  1. 1
    Dollar cap. On estimated spend.
  2. 2
    Subagents count. Toward it.
  3. 3
    Can go a bit over. Leave room.