{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-treat-opentelemetry-genai-agent-spans-as-authoritative-for-token-attribution",
  "title": "Under what conditions must an instance treat OpenTelemetry GenAI agent spans as authoritative for token attribution",
  "date_of_record": "2026 November 15",
  "scope": "Applies to services that emit or consume `gen_ai.*` spans (agent invocation, tool execution, chat completion) under the OpenTelemetry GenAI semantic conventions, and that use those spans to attribute token consumption to a logical caller, agent, or tool. Does not apply to spans emitted by non-conforming instrumentations that omit `gen_ai.usage.*`, nor to billing reconciliation against provider-side invoices, which requires provider-supplied identifiers.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-opentelemetry-genai-agent-spans-as-authoritative-for-token-attribution.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-opentelemetry-genai-agent-spans-as-authoritative-for-token-attribution.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-treat-opentelemetry-genai-agent-spans-as-authoritative-for-token-attribution.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1667,
    "python_slice_tokens": 365,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two distinct quantities that both look like \"tokens used by this agent span\": 1. **Span-local usage** — the `gen_ai.usage.input_tokens` and `gen_ai.usage.output_tokens` attributes recorded on a single span. These describe the LLM call that span directly wraps. 2. **Subtree-attributed usage** — the sum of usage across the span and all descendant spa...",
    "what_was_observed": "In a three-tier agent (planner → retrieval tool → summarizer sub-agent), a trace showed: - Root `invoke_agent` span: `gen_ai.usage.input_tokens=1840`, `output_tokens=210`. - Child `execute_tool` span (`retrieval`): no usage attributes (correct — tools that do not call a model have none). - Grandchild `invoke_agent` span (summarizer): `gen_ai.usage.input_tokens=41200`, `output_tokens=3900`. - Great-grandchild `chat` s...",
    "condition_of_validity": "Treat a span's `gen_ai.usage.*` as authoritative for that span's *own* model call if and only if all of the following hold: - The span has `gen_ai.operation.name` set to a value that performs inference (`chat`, `text_completion`, `invoke_agent`), not merely `execute_tool`. - The span is a leaf with respect to model-calling descendants, **or** you are explici...",
    "decision_boundary": "The decision boundary is: **does the consumer need per-call cost or per-operation cost?** - If per-call cost: read `gen_ai.usage.*` off the inference span directly. Do not traverse. Do not read agent spans. - If per-operation cost: traverse the subtree, sum only inference-bearing spans, and never read the root agent span's usage as a total. If the subtree is...",
    "operational_effect": "Downstream effects of getting this wrong, in order of severity: 1. **Quota and rate-limit enforcement** keyed on attributed tokens will under-account and permit overrun. An agent that delegates heavily will appear cheap and will be allowed to run until the provider-side limit trips, producing a hard failure rather than a graceful throttle. 2. **Chargeback an..."
  },
  "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": "eaceecdede05cc4aacfcf65c5098a77794f803f282e2ec23efc2b135c42d710b",
    "verified_classes": [
      "AttributionInvariantError",
      "Span"
    ],
    "verified_functions": [
      "attribute_subtree_tokens",
      "attribute_root_span_as_total"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "AttributionInvariantError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
