Tracking spend on a simple AI feature is easy: one request, one call, one cost. Agents break that cleanly. A single agentic task can trigger a dozen or more model calls plus tool calls, retries, and self-checks, and call-level tracking loses the thread. Tracking agent spend means tracking the task, not the call.

Why call-level tracking fails for agents

An agent decides, call by call, whether to retry, invoke a tool, or branch. Two runs of the same task can take very different paths and cost very different amounts. Counting individual calls tells you how busy the agent was, not what a task cost or why one task cost far more than another. The relationship between calls and the task they serve is never captured at the call level.

Correlate calls into tasks

The foundation is correlation. Tag every model call and tool call an agent makes with a session identifier and a workflow identifier at the moment it is made. That tagging lets you group a scattered series of calls back into the single task they belong to, the way a distributed trace groups spans across services. Without it, an agent task is a dozen anonymous requests.

Track cost per completed task

Once calls are grouped by task, the metric that matters is cost per completed task, measured against an accepted outcome. An agent that finishes in a handful of calls is doing better work than one that needs fifty for the same result. That comparison is invisible at the call level and obvious at the task level.

Watch retry amplification and tool calls

Agents combine two cost amplifiers: they retry failed steps and loop until a validation condition is met. Track observed calls per task against the baseline a task should take, and a task running far above baseline flags itself. Track tool calls too, because searches, lookups, and code execution add real cost that often does not register as model calls.

Agent spend only becomes manageable at the task level. Correlate the calls, track cost per completed task, and watch the amplification, and an opaque agent bill becomes something you can explain and optimize.