What you get from span-level cost attribution
Your cost dashboard shows a spike. The line goes up, the number is real, and that is where the information ends. According to the FinOps Foundation's State of FinOps 2026 survey, 73% of enterprises exceeded their AI cost projections in the past year, with average enterprise AI budgets growing from $1.2M in 2024 to $7M in 2026. The survey also notes that the root cause is rarely a single runaway model call; it is the absence of attribution connecting token consumption to the teams and workflows responsible for it.
This article covers how span-level instrumentation closes that gap: recording each agent call with the model used, the token counts consumed, and enough context to answer "which agent, on which task, at what cost."
Why agent workloads break cost dashboards
A conventional chatbot makes one model call per user turn. An agentic workflow makes 10 to 20 model calls to complete the same task, according to a 2026 analysis from Point Five, meaning the same user request can cost an order of magnitude more to serve. Cost dashboards built around per-seat or per-request pricing never anticipated that ratio.
The spending patterns that result are difficult to diagnose without instrumentation. A RAG retrieval agent doing a routine lookup can fan out into multiple retrieval passes if the context window fills unexpectedly. A multi-agent orchestrator routing subtasks may call a frontier model for a classification step that a smaller model could handle at a tenth of the cost. Neither behavior is visible in a line item on a cloud invoice.
Flexera's 2026 State of ITAM Report found that only 31% of organizations have accurate visibility into AI software spending, and 59% report wasted AI spend increasing year over year. Walmart's AI operations illustrate how quickly this scales: the company runs workloads across fashion production, customer support, developer tooling, and HVAC monitoring with digital-twin agents, with its Trend-to-Product system alone cutting fashion production timelines by 18 weeks. At that breadth, a model routing error in one pipeline does not announce itself; it accumulates quietly across thousands of calls.
What span-level instrumentation records
A span is a discrete unit of work in a trace: one tool call, one model invocation, one retrieval step. Instrumenting at the span level means every model call carries metadata about which agent issued it, which model was selected, how many input and output tokens were consumed, and what the call cost at current pricing. The trace assembles those spans into the full picture of a task.
This is the foundation that OpenTelemetry-compatible agent tracing provides. When every call is a labeled span, a cost spike becomes traceable: you can identify the specific agent run, the step where token consumption jumped, and whether the model selected was appropriate for the task.
Model routing infrastructure matters here. NVIDIA's routing layer, announced on 2026-08-15, examines prompts and directs requests to the lowest-cost capable model for that request. Instrumentation tells you whether that routing is working as designed. If a span records a GPT-4-class model handling a task your policy assigned to a smaller model, that is a routing violation you can catch before it recurs across ten thousand calls.
DHL Supply Chain's deployment of HappyRobot AI for appointment scheduling, transport status calls, and warehouse coordination targets hundreds of thousands of emails and millions of voice minutes annually. At that volume, a per-call cost difference of a few cents between a correctly routed and incorrectly routed model call is not a rounding error; it accumulates into a material budget variance. Span-level records make that variance legible.
Validating model routing with activity schemas
Recording spans is necessary but not sufficient. You also need a way to assert what correct behavior looks like and flag deviations automatically. Activity schemas for agent behavior validation let you define which model a given agent should call for a given task class, and compare that against what the spans record.
Dow Chemical's agents for freight invoice analysis target millions in cost savings on annual freight spend of several billion dollars, by identifying overcharges in shipping invoices. That use case involves structured document processing steps where the appropriate model tier is predictable. An activity schema can assert that classification steps stay below a token budget and that extraction steps use a specific model family, then flag any call that departs from that definition.
Prefactor records spans at the call level and scores them against schemas you define. When a span deviates, the record includes the actual model, the actual token count, and the step in the workflow where it occurred. That is what turns an unexplained cost spike into a specific correctable event.
Engine, the B2B travel platform, deployed an Agentforce agent named Eva that now handles 50% of customer cases autonomously, with average handle time down 15% and customer satisfaction up from 3.7 to 4.3 out of 5. Those gains depend on the agent continuing to route cases correctly. A schema that validates model selection and step count per case type gives you early warning if the routing drifts, before the cost and quality numbers move.
Identifying runaway behavior before it compounds
Some cost problems are not routing errors; they are feedback loops. An agent retrying a failed tool call, a context window growing unbounded across turns, or a planning step that expands its subtask list on each invocation can each cause spend to compound across a session. Detecting runaway agent behavior before it becomes a budget problem requires span-level records that show token counts and call counts per session, not just per day.
Token efficiency metrics across agent deployments give you baselines. A session that normally consumes 8,000 tokens and suddenly consumes 80,000 is a signal worth examining whether or not it results in a support ticket. The same instrumentation that attributes cost also catches the outlier sessions that push averages up without any single call looking wrong in isolation.
Measuring what agents actually cost at the token level requires the same infrastructure you need for quality evaluation. Wiley's Agentforce deployment achieved a 213% ROI with $230,000 in savings from student service automation. That figure is only auditable if there is a record connecting each automated case to its model calls and token costs. Without spans, the ROI calculation rests on estimates.
For more on how to approach model routing and cost optimization in production, the measurement approach matters as much as the tooling.
Where to start
Instrument your agents at the span level, define an activity schema that captures which models should handle which task types, and set a baseline for token consumption per workflow. Outliers above that baseline are where most unexplained cost spikes originate.
Start evaluating your agents or read the docs to see how Prefactor records spans and validates routing against your defined schemas.