Token-heavy spans and slow spans differ in agent runs, so trace ledgers need both rankings
A developer on DEV Community argues that the span that uses the most tokens in an agent run is often not the one that takes the longest. Standard trace viewers sort spans by start time, which hides the cost picture an operator needs. The proposed fix is a per-run span ledger built from six core fields, including token counts logged per span and a retry marker. The author supplies a sample six-span fixture containing a retried tool call and a slow test step, along with a Python script that reads and orders the spans. The approach also adds a deterministic budget breaker that can be tested, so runs halt before exhausting their allowance.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in