{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-lose-causal-linkage-between-a-tool-call-span-and-its-parent-agent-span-under-opentelemetry-genai-semantic-conventions",
  "title": "Why does an instance lose causal linkage between a tool-call span and its parent agent span under OpenTelemetry GenAI semantic conventions",
  "date_of_record": "2026 November 30",
  "scope": "Applies to agent runtimes that emit OpenTelemetry spans using the GenAI semantic conventions (`gen_ai.*`) across a multi-step tool-calling loop, where tool invocations are emitted as child spans of an agent-invocation span. Does not apply to single-shot LLM completions with no tool fan-out, nor to runtimes that emit a flat, non-hierarchical span stream with no parent/child context propagation.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-causal-linkage-between-a-tool-call-span-and-its-parent-agent-span-under-opentelemetry-genai-semantic-conventions.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-causal-linkage-between-a-tool-call-span-and-its-parent-agent-span-under-opentelemetry-genai-semantic-conventions.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-lose-causal-linkage-between-a-tool-call-span-and-its-parent-agent-span-under-opentelemetry-genai-semantic-conventions.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2701,
    "python_slice_tokens": 598,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions describe *attributes* on spans — `gen_ai.operation.name`, `gen_ai.tool.name`, `gen_ai.request.model`, `gen_ai.usage.input_tokens` — but they do not by themselves define the *hierarchy contract* that binds a tool-call span to the agent span that authorized it. The convention assumes the runtime propagates a valid `SpanContext` (...",
    "what_was_observed": "An agent loop dispatching three sequential tool calls per turn across a stdio-based MCP server. The agent-invocation span `agent.turn` was emitted correctly with `gen_ai.operation.name = \"invoke_agent\"`. Each tool call was emitted from inside the MCP server process, which had been launched by the agent host as a subprocess. The MCP server's telemetry SDK was initialized with its own `TracerProvider` and no `TextMapPr...",
    "condition_of_validity": "A tool-call span is causally valid under the GenAI conventions if and only if all of the following hold at the moment the span is started: 1. The dispatching agent captured `traceparent` (and `tracestate` if present) from the *active* agent span via the configured `TextMapPropagator.inject()`, not from a cached or module-level value. 2. The captured header w...",
    "decision_boundary": "The runtime must decide, per dispatch, whether the tool execution substrate is *in-process and context-propagating* or *out-of-process and context-serializing*. The boundary is not \"local vs remote\" — an in-process `asyncio.create_task` can drop context just as effectively as a network hop if the task is created outside the captured context. The boundary is:...",
    "operational_effect": "The consequence of the mis-linkage is not lost data but *false causal data*. Incident triage that asks \"which tool call caused this agent turn to fail\" walks the span tree upward from the failing child; with a one-turn-lagged parent link, the walk lands on the previous turn's agent span, and the investigator attributes the failure to a tool that ran in a pri..."
  },
  "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": "ab62dc6afc828ef0ca77448881eedc8e111e2729fd5776237c3fc2f1cbe21308",
    "verified_classes": [
      "CausalLinkageError",
      "SpanContext",
      "ToolDispatch"
    ],
    "verified_functions": [
      "verify_causal_linkage",
      "dispatch_tool_call"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 6,
    "raised_exceptions": [
      "CausalLinkageError"
    ],
    "sample_fail_closed_invariants": [
      "receiver could not reconstruct a SpanContext from the inbound traceparent"
    ],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
