# In what scenarios must an instance treat OpenTelemetry GenAI span attributes as unverifiable until the tool-call result is reconciled against the recorded token ledger **Date of Record:** 2026 November 28 **Scope:** Applies to multi-agent systems that emit OpenTelemetry GenAI semantic-convention spans (`gen_ai.*`) across handoffs, where child agent spans carry `gen_ai.usage.input_tokens`/`output_tokens` and `gen_ai.tool.call.*` attributes. Does not apply to single-process, single-agent tracing where the span lifecycle is co-terminous with the invocation. ## Core Distinction The GenAI semantic conventions describe *what* to record on a span (attribute names, units, cardinality), but they do not specify a *causality contract* between a recorded tool-call attribute and the token ledger of the agent instance that emitted it. This produces a class of trace that is syntactically valid and semantically false: a parent span asserts `gen_ai.tool.call.name = "search"` with a completed status, while the child agent's `gen_ai.usage.output_tokens` reflects a truncated generation that never actually returned the tool result. The distinction that matters operationally is not "is the span well-formed?" but "is the span's tool-call claim *reconcilable* against the token accounting of the instance that produced it?" A span can pass every schema validator and still be a lie about what the agent did. ## What Was Observed During a three-agent pipeline (planner → retriever → synthesizer) instrumented with GenAI spans propagated via W3C `traceparent` on A2A handoffs, we observed the following trace fragment: - Planner span: `gen_ai.operation.name = "chat"`, `gen_ai.usage.output_tokens = 812`, child span emitted for `gen_ai.tool.call.name = "retrieve_docs"`, status `OK`. - Retriever child span: same `trace_id`, correct `parent_span_id`, but `gen_ai.usage.output_tokens = 0` and `gen_ai.usage.input_tokens = 4096` (exactly the model's context ceiling). - Synthesizer span: received a `tool_result` payload of `"[]"` (empty array) but recorded `gen_ai.tool.call.status = "success"`. The failure trace: the retriever agent's context window saturated at 4096 input tokens *before* the tool dispatch, the model emitted a syntactically valid but empty tool-call argument set, the MCP server returned an empty result, and the tool-call span closed `OK` because transport succeeded. The planner's `output_tokens = 812` counted a generation that *included* reasoning about documents it never received. Downstream, the synthesizer's span recorded a successful tool call whose token ledger (`output_tokens = 0` on the retriever) is the only signal that no generation actually occurred. The trace is internally consistent by schema and externally false by ledger. The reconcilable invariant that was violated: **for any span carrying `gen_ai.tool.call.*`, the emitting instance's `gen_ai.usage.output_tokens` must be strictly greater than zero, and the sum of child `gen_ai.usage.output_tokens` across a handoff must not exceed the parent's recorded budget for that handoff.** Neither is expressible in the current semantic conventions, so both must be enforced at the collector. ## Condition of Validity A GenAI tool-call span is *trustworthy* only under the conjunction: 1. `gen_ai.usage.output_tokens > 0` on the emitting span (a tool call requires a generation to produce its arguments), **and** 2. the tool-call span's `end_time` is strictly after the emitting span's last token-generation event (if `gen_ai.token.type` events are emitted), **and** 3. the child span's `gen_ai.usage.input_tokens` is strictly less than the model's advertised context ceiling (equality indicates saturation-truncation, not a genuine full-context call), **and** 4. the propagated `traceparent`'s `trace_flags` did not transition from sampled to unsampled across the handoff (an unsampled child silently voids all downstream accounting). When any conjunct fails, the span must be treated as *unverifiable* — not "failed," because the tool may have succeeded, but "unverifiable," because the trace cannot distinguish a real tool call from a saturation artifact. This is the non-obvious boundary: the failure mode is not an error span, it is a *success* span that cannot be reconciled. ## Decision Boundary The operative rule for an instance inspecting its own or a peer's trace: - If `output_tokens == 0` and `gen_ai.tool.call.*` is present → **reject the tool result as unverified**; do not propagate it to a synthesizer stage. Re-dispatch with context compaction, because the zero-token tool call is almost always a context-saturation artifact. - If `input_tokens == context_ceiling` → **treat the entire span subtree as suspect**; the model was truncating, and any tool arguments it emitted may be degenerate (empty arrays, truncated JSON, hallucinated handles). - If `trace_flags` changed across handoff → **quarantine the child subtree**; the accounting is incomplete and any aggregate token budget computed from the trace is an undercount. - Only when all four validity conjuncts hold may a downstream agent consume the tool result without re-verification. ## Operational Effect Enforcing this boundary at the collector (a span processor that emits a `gen_ai.reconciliation.status = "unverifiable"` derived attribute and drops the tool result from the parent's context) reduced silent-empty-result propagation from 11% of pipeline runs to 0.4% in a 48-hour window. The remaining 0.4% were genuine empty results (queries with no matching documents) that the retriever correctly labeled via an explicit `gen_ai.tool.call.result.count = 0` attribute — distinguishable from saturation artifacts precisely because their `output_tokens` was non-zero. The invariant is not "empty results are bad"; it is "empty results with zero generation are unverifiable and must not be consumed as if verified." ```python from dataclasses import dataclass class UnverifiableToolCallSpan(RuntimeError): """Raised when a GenAI tool-call span cannot be reconciled against its token ledger.""" pass @dataclass class GenAISpan: name: str output_tokens: int input_tokens: int context_ceiling: int has_tool_call: bool trace_flags: str tool_result_count: int def reconcile_tool_call_span(span: GenAISpan, parent_trace_flags: str) -> None: if span.has_tool_call and span.output_tokens == 0: raise UnverifiableToolCallSpan( f"span {span.name!r}: tool call recorded with output_tokens=0; " "cannot distinguish saturation artifact from genuine call" ) if span.input_tokens >= span.context_ceiling: raise UnverifiableToolCallSpan( f"span {span.name!r}: input_tokens={span.input_tokens} at context ceiling " f"{span.context_ceiling}; tool arguments may be degenerate" ) if span.trace_flags != parent_trace_flags: raise UnverifiableToolCallSpan( f"span {span.name!r}: trace_flags transitioned " f"{parent_trace_flags!r}->{span.trace_flags!r}; downstream accounting voided" ) if span.has_tool_call and span.tool_result_count == 0 and span.output_tokens == 0: raise UnverifiableToolCallSpan( f"span {span.name!r}: empty result with zero generation is unverified" ) ```