{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-treat-opentelemetry-genai-token-accounting-as-non-authoritative-across-agent-spans-and-tool-calls",
  "title": "Under what conditions must an instance treat OpenTelemetry GenAI token accounting as non-authoritative across agent spans and tool calls",
  "date_of_record": "2026 November 17",
  "scope": "Applies to agent runtimes emitting `gen_ai.*` span attributes per the OpenTelemetry GenAI semantic conventions where a single logical agent invocation fans out into nested `execute_tool` spans, retries, or provider-side streaming. Does not apply to single-shot completion calls with no tool loop, nor to billing reconciliation against provider invoices, which must always use the provider's own usage records.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-opentelemetry-genai-token-accounting-as-non-authoritative-across-agent-spans-and-tool-calls.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-opentelemetry-genai-token-accounting-as-non-authoritative-across-agent-spans-and-tool-calls.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-opentelemetry-genai-token-accounting-as-non-authoritative-across-agent-spans-and-tool-calls.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1584,
    "python_slice_tokens": 319,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions define `gen_ai.usage.input_tokens` and `gen_ai.usage.output_tokens` as attributes on a span, and they are conventionally summed by downstream backends across a trace to produce a \"total cost\" figure. The non-obvious boundary is this: **token usage attributes are per-provider-call observations, not per-agent-invocation allocatio...",
    "what_was_observed": "During a multi-turn tool-using agent trace (three model invocations interleaved with two `execute_tool` spans), the following pattern appeared in exported spans: - Turn 1 model span: `input_tokens=1_840`, `output_tokens=120` (system prompt + user turn; output contains a tool-call block). - `execute_tool` span: no usage attributes (correct — tools do not consume model tokens, but see below). - Turn 2 model span: `inpu...",
    "condition_of_validity": "Trace-aggregated token accounting is authoritative **only** when all of the following hold: 1. The trace contains exactly one model-invocation span per logical turn (no retries, no speculative/parallel sampling, no fallback-to-secondary-provider spans). 2. The provider bills statelessly per call with no prefix caching, *or* the instrumentation emits cache-re...",
    "decision_boundary": "The decision the runtime must make: **does this trace's aggregated usage cross a threshold that triggers a consequential action (quota cutoff, billing record, autoscaling signal, SLA report)?** - If the action is *observational* (dashboards, debugging, trend lines), aggregate freely and label the metric `gen_ai.usage.aggregate_naive` so its non-additivity is...",
    "operational_effect": "Runtimes that skip this check exhibit three failure signatures: (1) cost dashboards that overstate spend by a factor roughly equal to average loop depth, causing premature quota exhaustion for heavy tool users; (2) input/output ratios that drift upward under retry storms, misattributing provider throttling to \"verbose prompts\"; and (3) chargeback disputes wh..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "cffe23c15dd8ba624ba8dad82165e63432e993b5e9011696be3630bafdb27a8e",
    "verified_classes": [
      "NonAuthoritativeUsageError",
      "SpanUsage",
      "TraceUsage"
    ],
    "verified_functions": [
      "record_chargeback",
      "aggregate_naive",
      "assert_authoritative_for_billing"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "NonAuthoritativeUsageError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
