{
  "schema_version": "1.3.0",
  "slug": "in-what-scenarios-must-an-instance-reject-opentelemetry-genai-agent-spans-when-tool-call-attributes-and-token-accounting-disagree-across-span-boundari",
  "title": "In what scenarios must an instance reject OpenTelemetry GenAI agent spans when tool-call attributes and token accounting disagree across span boundaries",
  "date_of_record": "2026 November 17",
  "scope": "Applies to collector-side and SDK-side validation of `gen_ai.*` spans emitted by LLM agents that perform tool calls, where token usage is attributed both to an `invoke_agent` span and to child `execute_tool` / `chat` spans. Does not apply to single-shot completion spans with no tool execution, nor to providers that report usage only at the top-level agent span with no child attribution.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reject-opentelemetry-genai-agent-spans-when-tool-call-attributes-and-token-accounting-disagree-across-span-boundari.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reject-opentelemetry-genai-agent-spans-when-tool-call-attributes-and-token-accounting-disagree-across-span-boundari.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/in-what-scenarios-must-an-instance-reject-opentelemetry-genai-agent-spans-when-tool-call-attributes-and-token-accounting-disagree-across-span-boundari.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1579,
    "python_slice_tokens": 352,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The OpenTelemetry GenAI semantic conventions define token usage attributes (`gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`) as *per-operation* counters, not *per-tree* counters. An agent invocation that fans out into N tool calls and M nested chat completions will emit N+M+1 spans, each of which may legitimately carry its own usage block. The inva...",
    "what_was_observed": "In a production agent fleet emitting spans through an OTel Collector with a `genai` attribute processor, we observed a 2.0× to 2.4× inflation in aggregated `input_tokens` for agent traces versus provider-side billing dashboards. The inflation factor was not constant — it tracked the average tool-call fan-out per agent invocation, which is the tell. Root cause: the agent framework emitted `invoke_agent` spans with `ge...",
    "condition_of_validity": "The rejection rule below is valid only when **all** of the following hold: - The span carries `gen_ai.operation.name` in `{invoke_agent, create_agent, execute_tool, chat}`. - The span has a non-null `parent_span_id` within the same trace, or is a trace root. - At least one descendant span in the trace carries a `gen_ai.usage` block. - The emitter has not set...",
    "decision_boundary": "The operational rule: **an instance must reject (quarantine, not drop) any `invoke_agent` span whose reported `input_tokens` is greater than or equal to the sum of descendant `input_tokens`, when descendant count ≥ 2 and the parent/child ratio falls within [0.95, 1.05] of the descendant sum.** A ratio near 1.0 is the signature of cumulative accounting; a rat...",
    "operational_effect": "After deploying the quarantine rule, billing reconciliation error dropped from 2.3× to within 1.02× of provider invoices. The quarantine stream itself became a useful signal: it identified three agent framework versions still on cumulative accounting, which were then migrated to additive emission with explicit child-only usage. The `tool.call.id` dedup fix e..."
  },
  "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": "c478507eaba2cc541685d7abaa72c819c6921500d91de86194f69c93d55f5dcb",
    "verified_classes": [
      "GenAIAccountingAmbiguity",
      "Usage",
      "Span"
    ],
    "verified_functions": [
      "classify_agent_span",
      "should_quarantine"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "GenAIAccountingAmbiguity"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
