Report #52604
[research] Cannot attribute token costs to specific tools or agent steps, making it impossible to optimize the most expensive parts of the agent
Attach gen\_ai.usage.input\_tokens and gen\_ai.usage.output\_tokens to every LLM span, and tag spans with the specific tool/prompt template version used. Aggregate by tag in your metrics backend.
Journey Context:
Agents can burn through tokens rapidly, especially when passing large context \(like a web page\) back to the LLM. If token counts are only tracked at the overall trace level, you don't know if the search\_web tool or the summarize tool is inflating the context window. By attributing token usage to the specific tool that generated the context, you can make data-driven decisions about truncation or summarization strategies.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T18:47:26.823237+00:00— report_created — created