{
  "schema_version": "1.3.0",
  "slug": "under-what-conditions-must-an-instance-reject-a-genai-agent-span-when-tool-call-attributes-and-token-cost-telemetry-disagree-at-the-emission-boundary",
  "title": "Under what conditions must an instance reject a GenAI agent span when tool-call attributes and token-cost telemetry disagree at the emission boundary",
  "date_of_record": "2026 November 29",
  "scope": "Applies to any agent runtime that emits OpenTelemetry spans using the GenAI semantic conventions (`gen_ai.*`) for agent invocations, tool calls, and token/cost accounting, particularly when a single logical agent turn is decomposed across multiple spans (agent → tool → sub-agent). Does not apply to single-shot LLM inference spans with no tool-call children, nor to runtimes that emit only a single flat span per turn with no parent/child decomposition.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-reject-a-genai-agent-span-when-tool-call-attributes-and-token-cost-telemetry-disagree-at-the-emission-boundary.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-reject-a-genai-agent-span-when-tool-call-attributes-and-token-cost-telemetry-disagree-at-the-emission-boundary.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/under-what-conditions-must-an-instance-reject-a-genai-agent-span-when-tool-call-attributes-and-token-cost-telemetry-disagree-at-the-emission-boundary.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1966,
    "python_slice_tokens": 318,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions treat *token usage* and *tool-call identity* as two independent attribute families that happen to live on adjacent spans. Usage (`gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`, `gen_ai.usage.cost`) is a **cumulative, monotone, per-model** quantity. Tool-call attributes (`gen_ai.tool.name`, `gen_ai.tool.call.id`, `gen...",
    "what_was_observed": "A multi-tool agent turn (one orchestrator model, three sequential tool calls, each tool backed by a small model) produced this span tree: The root's `input_tokens` (8,412) was computed by the orchestrator's own tokenizer over its prompt — it did *not* include the tool spans' 7,050 input tokens. But the downstream cost aggregator, following the convention that a span's `gen_ai.usage.cost` is the total cost attributabl...",
    "condition_of_validity": "The invariant that must hold for aggregate cost telemetry to be correct is: > For every span S carrying `gen_ai.usage.cost`, the value MUST equal the cost of model inference performed *by S's own operation*, and MUST NOT include the cost of any descendant span. Descendant costs are aggregated by the consumer, not the producer. This is the *non-cumulative pro...",
    "decision_boundary": "At the emission boundary, the runtime must decide, per span, whether to write `gen_ai.usage.*` based on the span's *role*, not its *content*. The decision rule: - **Root agent span:** emit usage for the orchestrator model only. Do not add descendant usage. If the runtime wishes to expose turn-total cost, it must use a *distinct* attribute name (e.g., `agent....",
    "operational_effect": "The observable effect is a cost telemetry stream that is internally consistent (every span validates against the schema) and externally wrong (turn cost inflated by the sum of tool-model costs). In the observed case, the inflation was 2.25×. The failure is silent: no span is malformed, no exporter errors, no alert fires on schema validation. It is only detec..."
  },
  "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": "7105d3f9451587a6bc820bc39ff4c09696b882749824ef600a81c1e897d2d7fe",
    "verified_classes": [
      "GenAIUsageInvariantError"
    ],
    "verified_functions": [
      "validate_usage_tree",
      "emit_turn"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "GenAIUsageInvariantError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
