Observed Signal · May 21, 2026 · Technical Release · Source: DEV Community · Impact: 1/5 · Sentiment: Positive
agenttrace-rs: Rust tracer reveals O(n²) LLM cost bug
A developer published agenttrace-rs, a small Rust crate that aggregates LLM call records into runs and reports cost, latency (p50/p95/p99), and per-model and per-step breakdowns. The author used the tool to debug a three-step agent whose cite-check step unexpectedly executed nine times and reattached full history each iteration, causing O(n²) token growth and a $4.20 bill instead of the expected ~$0.12. Switching to a sliding-window history and reducing repeated context lowered the run cost to $0.1432. agenttrace-rs is an in-memory aggregator (no API calls or pricing logic) and is available on GitHub and crates.io (package agenttrace-rs v0.1).
Open-source developer tooling that improves observability and cost debugging for LLM agents; useful for engineering teams but not industry-shifting.
Track GitHub Signals & Market Shifts in Real-Time
Polaris7 autonomous intelligence agents track regulatory filings, primary sources, executive changes, and deal flow 24/7. Create your Polaris7 workspace to monitor these entities.
Key Takeaways & Evidence Grounding
- agenttrace-rs is a Rust crate that aggregates LLM call records into runs and reports cost, latency percentiles, and per-model / per-step breakdowns.
- The author observed a three-step agent that cost $4.20 because step 3 performed 9 calls with linearly-growing inputs, producing O(n²) token usage.
- A fix (stop re-attaching full history; use a sliding window) reduced the same run's cost to $0.1432 (about 30x cheaper).
- agenttrace-rs is in-memory only; users must serialize runs themselves. The repo is on GitHub and the crate is published on crates.io as agenttrace = { package = "agenttrace-rs", version = "0.1" }.
- agenttrace integrates with other crates like claude-cost (per-call cost estimation), cachebench (cache metrics), and llm-circuit-breaker (short-circuiting degraded upstreams).
Connected Companies & Entities
Ontology Mapping & Concepts
Related Market Signals & Shifts
Recent verified developments and strategic activity across this market segment.
agent-cost: Measure LLM Usage, Separate Task Attribution
The author describes agent-cost, a small tooling primitive that reads local logs from LLM CLIs (e.g., Claude Code and Codex) to produce auditable, machine-readable usage facts (model, token kind, timestamp, count) and an estimated price. The tool is designed to run with no network calls at runtime, carry a versioned price catalog (with SHA-256 digest), and keep session measurement distinct from task attribution. Unknown or unsupported pricing and ambiguous session-to-task bindings are surfaced (labels like "unpriced" or "lower_bound") rather than silently allocated. The author re-ran the published coding-agent-cost 0.1.0 package and notes a catalog version 2026-07-29 and workflows that validate the measure/v1 protocol and data quality.
Agent Control Flow Prevents Unbounded LLM Cost Spikes
The author argues that deterministic control flow (harnesses/flowcharts) around LLM agents is essential not only for predictable behavior but also for predictable costs. Open-ended agent loops create high variance in token usage and therefore unpredictable bills; recent provider repricings (GitHub Copilot, Anthropic, OpenAI) have amplified this risk. Measurements show agentic runs produce a bimodal cost distribution with a small tail driving most spend and some cron/ free-tier users generating disproportionate token costs. The author built llmeter, an open-source AGPL cost dashboard, and recommends practical steps: log per-call metadata, separate cached-token accounting, tag agent loops with task IDs, alert on p95 rather than mean, and model known provider promo expirations in budgets.
Agent Trees Break OpenTelemetry, Instrumentation Fixes Needed
A developer post by Nathaniel Cruz describes an incident where a cron job silently corrupted writes for three weeks while costing only about $0.40/day, because existing monitoring exposed only aggregate spend and not agent behaviour. The author argues the OpenTelemetry LLM semantic conventions lack constructs for agent trees and recommends three minimal instrumentation changes teams should adopt: a pre-commit spending ceiling per session, session and agent-depth tagging on spans, and a per-session audit ledger (tokens, cost, max depth, ceiling hits). The post cites a root-cause note from "Timur" who aggregated spans in ClickHouse and calls for OTel to add session_id, agent_depth and a ceiling convention so frameworks gain observability by default.
Receive all future signals for GitHub & competitors in your briefing
Never miss material M&A deals, leadership changes, account wins, or product rollouts. Polaris7 monitors 20,000+ primary sources 24/7, delivering verified telemetry directly into your executive briefing.
