Use case / Agent cost control

Find the run that spent the budget.

Agent bills grow from loops and oversized prompts, not from one big call. See cost for every run and every step, and the expensive one stands out.

Cost
Per step
Loops
Detected
Limits
Enforced

The failure to catch

One stuck run that spent a day of budget in an hour.

See cost per run, per step and per model, so a loop or an oversized prompt shows up before the bill does.

What Tracify watches.

01

Cost per run

Recorded on every run, so it can be searched, compared and alerted on.

02

Tokens per step

Recorded on every run, so it can be searched, compared and alerted on.

03

Loop detection

Recorded on every run, so it can be searched, compared and alerted on.

04

Budget limits

Recorded on every run, so it can be searched, compared and alerted on.

Spend breakdown

Where the budget went.

  1. Cost is recorded on each step, not only on the whole run.

  2. Tokens and price are shown next to the call that spent them.

  3. Repeated calls are the loop, counted and priced.

  4. Budget ceilings can stop a run, and the stop is part of the trace.

  5. Sort by cost to find the runs worth fixing first.

Agent cost control1 / 5 steps
  1. 01

    Run starts

    Support agent, production, release 2.14.

    ok
  2. 02

    Step costs add up

    Each model call is priced as it finishes.

    ok
  3. 03

    Loop begins

    The same tool is called 14 times in a row.

    runaway
  4. 04

    Budget limit hit

    The run passes its daily cost ceiling.

    runaway
  5. 05

    Run stopped

    The agent is stopped and the run is flagged.

    ok
Cost of the loop$0.00

Instrument it

Price every step as it runs.

Model calls already carry their token cost. Wrap the steps around them and the trace adds up where the money went.

$ npm install tracify-sdk

import { span, traceAgent } from "tracify-sdk";

export const work = traceAgent(async (task: string) => {
  const plan = await span("plan", () => callModel(task), { type: "llm", input: task });
  return span("act", () => runTools(plan), { type: "tool" });
}, { environment: "production", release: "2.14" });