{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-record-the-tool-call-boundary-when-opentelemetry-genai-semantic-conventions-disagree-with-the-agent-runtime-s-own-span-lifecycl",
  "title": "Where must an instance record the tool-call boundary when OpenTelemetry GenAI semantic conventions disagree with the agent runtime's own span lifecycle",
  "date_of_record": "2026 November 9",
  "scope": "Applies to agent runtimes that emit `gen_ai.*` spans (agent invocation, tool call, and model chat) under the OpenTelemetry GenAI semantic conventions, where the runtime's internal notion of \"a tool call\" is decoupled from the span's start/end lifecycle. Does not apply to single-shot LLM client instrumentation where the span lifetime exactly brackets the network request.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-record-the-tool-call-boundary-when-opentelemetry-genai-semantic-conventions-disagree-with-the-agent-runtime-s-own-span-lifecycl.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-record-the-tool-call-boundary-when-opentelemetry-genai-semantic-conventions-disagree-with-the-agent-runtime-s-own-span-lifecycl.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-record-the-tool-call-boundary-when-opentelemetry-genai-semantic-conventions-disagree-with-the-agent-runtime-s-own-span-lifecycl.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1826,
    "python_slice_tokens": 297,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions define attributes (`gen_ai.operation.name`, `gen_ai.tool.name`, `gen_ai.tool.call.id`, `gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`) and an *intended* span shape: one `execute_tool` span per tool invocation, one `chat` span per model call, one `invoke_agent` span per agent turn. The convention implicitly assumes th...",
    "what_was_observed": "A multi-turn agent (model → tool → model → tool) was instrumented with a naive \"span wraps the executor\" pattern. Under nominal conditions the trace looked correct: `invoke_agent` → `chat` → `execute_tool` → `chat`. Under three ordinary conditions the trace became *wrong in a way that is not visible in the span tree*: 1. **Parallel tool calls.** The model emitted three `tool_calls` in one `chat` response. The runtime...",
    "condition_of_validity": "The \"span wraps executor\" pattern is valid only when all of the following hold: - The model emits exactly one tool call per `chat` turn (no `parallel_tool_calls`). - Tool calls are executed synchronously within the `chat` span's lifetime (no deferred scheduling, no human-in-the-loop approval, no queue). - No pre-execution rejection path exists (or, if it doe...",
    "decision_boundary": "The decision is not \"which span name to use\" but **where the span's start and end are anchored relative to the call's logical identity**. - Anchor the span at **call definition** (when the model's response is parsed and the call id is assigned). The span's parent is the `chat` span that produced the call. The span's end is at **call resolution** — executed, ...",
    "operational_effect": "Anchoring at call definition changes three downstream behaviors: - **Trace completeness.** Every `tool.call.id` that appears in a `chat` span's response is guaranteed to appear as a span (or an explicit rejection event), so an auditor can join model intent to runtime outcome without parsing raw payloads. - **Token accounting correctness.** Summing `gen_ai.us..."
  },
  "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": "c7e4f68ea081ca291115ad7b6c0943333f6e41441631d64d59a387746789a468",
    "verified_classes": [
      "ToolCallBoundaryError",
      "ToolCallSpan"
    ],
    "verified_functions": [
      "open_tool_call_span",
      "resolve_tool_call"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "ToolCallBoundaryError"
    ],
    "sample_fail_closed_invariants": [
      "tool call span opened without gen_ai.tool.call.id; the id must be bound at call definition, not at execution"
    ],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
