TraceBudget CI failed a scripted runaway agent loop on 5 budget rules from its spans
TraceBudget gates agent pull requests on OpenTelemetry GenAI spans. Real SDK spans against a scripted mock API tripped 5 budget rules on a runaway loop and caught tracing switched off.
By David Discua
Measured in the lab
- 4/4
- scenarios that reproduced their fixture
- 5
- budget rules tripped by the runaway loop
- 10,500 in 628 ms
- spans checked
- Weather smoke session passed with 0 errors
- Runaway loop tripped TB001, TB003, TB004, TB005 and TB007
- Tracing switched off caught by TB010, TB011 and TB030
- Deprecated gen_ai.system flagged in instrumentation-openai 0.22.0
- Claude SDK span names reported as TB025 notes
From reports/measured.json · run on October 21, 2026. GenAI semconv pin e57c543b; real span producers (Claude TypeScript SDK 0.137.0, instrumentation-openai 0.22.0) against local mock APIs; token counts are scripted by the mocks
How it is wired
01/04Your pull request runs the agent's smoke session in CI.
TraceBudget CI is a GitHub Action and Bun CLI that gates agent pull requests on their OpenTelemetry traces. It runs your agent's smoke session under a local OTLP collector, then checks the spans against the GenAI semantic conventions at a pinned commit and against the token, LLM-call and tool-call budgets in .tracebudget.yml. We ran four real span producers against local mock APIs: a normal session passed, a runaway loop failed on 5 budget rules, and a session with tracing switched off failed too. The catch is that the token counts were scripted by the mock servers, so the run proves the gate reads spans correctly and says nothing about what a real model spends.
The catch
The spans, names, attributes and nesting are what the real libraries emitted. The token numbers inside them came from a script. API-side spans and Managed Agents spans were not run, because Anthropic's API sends spans only to an OTLP destination an org admin adds in the Claude Console, which a localhost CI collector cannot receive. Those checks rest on hand-built unit tests that follow the span reference. The live test against the real API was skipped; the live path was not run in this lab. Only the TypeScript SDK was exercised, and Anthropic says span names and attributes can change during the beta. Every GenAI semconv span type is still marked development.
What we ran (keyless)
bun install --frozen-lockfile
bun run tracebudget check tests/fixtures/otel/pass
bun run tracebudget run --out traces/smoke.jsonl -- bun examples/smoke-agent.ts --scenario weather
bun run report
From reports/measured.json, run on October 21, 2026. Each row is a real producer talking to a local mock:
| Scenario | Spans | LLM calls | Tool calls (failed) | Findings E/W/N | Exit |
|---|---|---|---|---|---|
| Weather smoke session (Claude TS SDK 0.137.0) | 7 | 3 | 2 (0) | 0/0/3 | 0 |
| Runaway loop (Claude TS SDK 0.137.0, http/protobuf) | 21 | 10 | 9 (1) | 5/0/3 | 1 |
| Tracing switched off | 1 | 0 | 0 (0) | 6/0/0 | 1 |
| instrumentation-openai 0.22.0 | 1 | 1 | 0 (0) | 2/0/0 | 1 |
All four fresh runs reproduced the committed fixtures exactly. The runaway loop tripped TB001 and TB003 (total and output tokens over budget), TB004 (LLM calls), TB005 (tool calls) and TB007 (failed tool calls). With tracing off, the session emitted one span with no GenAI scope, and TB010, TB011 and TB030 fired. The checker read 10,500 spans in 628 ms, including Bun start-up.
Two findings about the real libraries came out of the run. The Claude SDK names its spans anthropic.messages.create and anthropic.custom_tool_use get_weather instead of the semconv SHOULD pattern, although the attributes follow the conventions, so TraceBudget reports names as notes. OpenTelemetry's own @opentelemetry/instrumentation-openai 0.22.0 sets the deprecated gen_ai.system instead of the required gen_ai.provider.name on chat completion spans.
How it is wired
Tokens are summed only on leaf spans with usage, and each gen_ai.response.id counts once per trace, so the SDK span, the API span and the model-request child of one request are not triple counted. LLM calls are counted by operation name, tool calls by gen_ai.tool.call.id. Budget findings point at the line in .tracebudget.yml that set the limit.
Minilab (open source)
The pin is open-telemetry/semantic-conventions-genai at e57c543b (478 stars, Apache-2.0, Python), and the smoke agent uses anthropics/anthropic-sdk-typescript (2,150 stars, Apache-2.0, TypeScript), both as of October 24, 2026. Point smoke-command at your own agent and set budgets from a run you trust.
Run it yourself
SkilledDragonCorp/tracebudget-ci
Clone, install and run the report with no API keys. The numbers above are what that run writes.
bun install --frozen-lockfile && bun run tracebudget check tests/fixtures/otel/passSkilledDragon is not affiliated with Anthropic, OpenAI, the OpenTelemetry project or GitHub. Token counts in our keyless lab run are scripted by mock servers, not produced by a model; re-run the report before relying on it. Marks belong to their owners.
All labs