Skip to content

BudgetControl

Stable

Shows and sets how much time, money and steps a run may use, and what happens at the limit.

Also known as spend limit, cost limit, budget cap

Install with npm install @tattva/ui (setup), or copy the code from the kit in Downloads.

Limits for a trip search

Limits for this run

  • Time

    12 of 30 minutes used

  • Spend

    4.2 of 5 $ usedClose to the limit

  • Steps

    50 of 50 steps usedLimit reached

When a limit is reached

Spend: Close to the limit. Steps: Limit reached

Change a number and the bar updates. Spend is close to its limit and steps have reached theirs.

When to use it

Puts the limits of a run where people can see and change them: time, spend and steps. One choice sets what happens at a limit, so a run never quietly goes past it.

Made of: Heading · Limit row: name, number box with unit · Progress bar · Used of cap text and near-limit note · When a limit is reached choices · Status text for screen readers

Use it for

  • Before or during a long run, to set how much time, money or steps it may use.
  • Showing how close a run is to each limit.
  • Choosing whether a run stops, stops and asks, or asks for more at a limit.

Not for

  • Usage of a plan or account over time: use UsageMeter.
  • How full the conversation's memory is: use ContextMeter.
  • A single bar with no settings: use Meter.

Do and avoid

Limits for this run

  • Time

    12 of 30 minutes used

  • Spend

    4 of 10 $ used

  • Steps

    18 of 50 steps used

When a limit is reached

Do. Time, spend and steps in plain words, with a rule for the limit.

Limits for this run

  • Tokens

    41000 of 100000 tok used

  • Iterations

    18 of 50 iters used

When a limit is reached

Avoid. Words like tokens and iterations mean nothing to most people.

Do

  • Show used and cap in plain numbers next to the bar.
  • Say what happens at the limit before it happens.
  • Default to Stop and ask me.
  • Use the same unit people see on their bill.

Avoid

  • Don't use jargon like 'iterations'. Say steps.
  • Don't rely on the bar color alone. A note names the state.
  • Don't let a cap go below zero.
  • Don't continue past a limit without asking, unless the person chose that.

On a phone

  • The limit field opens the number keypad on a phone, and on a touch screen it is 44px tall with 16px text so the page does not zoom.
  • Each limit stacks its name above the field when the card is narrow.
  • The three choices for what happens at a limit are rows that grow to at least 44px tall on touch screens.

Seen in products

  • Anthropic advises stopping conditions such as a maximum number of iterations, to keep control of an agent.
  • Shape of AI lists cost estimates among the ways people govern an agent (snippet only).
  • Claude Code shows a notice when safety-check requests may be billed.

Build your next AI screen with Tattva.

Free and open, with the code. Start in one line.

Get started