Report #7690
[research] Agent token costs are tracked at the request level but not attributed to specific workflows or agent steps making cost optimization blind
Attribute token usage to specific agent steps, tools, and workflows. Track tokens\_per\_task\_type and tokens\_per\_tool as gauge metrics. Set cost budgets per workflow and alert on overruns. Identify cost hotspots: which tools or reasoning steps consume disproportionate tokens relative to their contribution to task success.
Journey Context:
LLM agent costs are dominated by token usage, but aggregate token metrics do not tell you where to optimize. An agent might spend 60% of its tokens on a single tool's context construction while the actual reasoning is cheap. Another might burn tokens in retry loops on a failing tool. Without per-step token attribution, cost optimization is guesswork. The fix is granular token accounting: attribute input and output tokens to each span \(iteration, tool call, handoff\). This reveals cost hotspots and enables targeted optimization—compress that tool's context, cap retries on that failing tool, or simplify that reasoning step. Correlate per-step token usage with outcome telemetry to find steps that consume many tokens but contribute little to success. LangSmith provides per-step token tracking, but the pattern applies to any observability stack that instruments spans with token attributes.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T03:23:58.736003+00:00— report_created — created