{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-attribute-tool-call-latency-when-opentelemetry-genai-spans-collapse-a-multi-turn-agent-trajectory-into-a-single-parent-span",
  "title": "How should an instance attribute tool-call latency when OpenTelemetry GenAI spans collapse a multi-turn agent trajectory into a single parent span",
  "date_of_record": "2026 November 30",
  "scope": "Applies to agents that emit OpenTelemetry `gen_ai.*` spans under the GenAI semantic conventions where a single `invoke_agent` (or `chat`) span wraps an entire multi-turn trajectory containing multiple tool calls. Does not apply to single-shot inference calls, nor to architectures that emit one root span per turn.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-attribute-tool-call-latency-when-opentelemetry-genai-spans-collapse-a-multi-turn-agent-trajectory-into-a-single-parent-span.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-attribute-tool-call-latency-when-opentelemetry-genai-spans-collapse-a-multi-turn-agent-trajectory-into-a-single-parent-span.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-attribute-tool-call-latency-when-opentelemetry-genai-spans-collapse-a-multi-turn-agent-trajectory-into-a-single-parent-span.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1579,
    "python_slice_tokens": 267,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions model a span as a single model interaction: `gen_ai.operation.name`, `gen_ai.request.model`, `gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`, and `gen_ai.response.finish_reasons` are all defined as *per-request* attributes. When an agent framework wraps an entire multi-turn trajectory — plan, tool call, observe, re-pl...",
    "what_was_observed": "A two-tool agent trajectory over a 47-second wall-clock window. The framework emitted a single `invoke_agent` span with `gen_ai.usage.input_tokens = 18,204` and `gen_ai.usage.output_tokens = 1,102`, plus two child `execute_tool` spans (`search_docs`, `fetch_url`) and — critically — *no child `chat` spans per turn*. The model invocations happened inside the parent span's own execution, not as children. Three concrete ...",
    "condition_of_validity": "The aggregate-span model is only sound when the following invariant holds: **the span's attributes are interpreted as trajectory-level aggregates, and no consumer joins them against per-request expectations.** Concretely, this requires: - The span MUST carry a distinguishing attribute (e.g., `gen_ai.agent.trajectory = true` or a non-standard `gen_ai.operatio...",
    "decision_boundary": "The boundary is drawn at the point where a consumer must choose between two incompatible readings of the same attribute: - If `gen_ai.usage.input_tokens` is read as *cost*, the aggregate span is usable only with a cache-aware correction, and the correction is not derivable from the span alone. - If it is read as *context size at the final turn*, the aggregat...",
    "operational_effect": "The downstream effect is a class of *quietly wrong* dashboards. Cost-per-trajectory over-reports by the cache-ratio factor. p99 latency for `invoke_agent` spans is dominated by trajectory length, not model speed, so a model regression that adds 200ms per turn shows up as a 1.4s p99 shift on a 7-turn agent and is misattributed to \"agent framework slowness.\" T..."
  },
  "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": "457f309e2daa0ab57600c95330f4136521afe4760c53d6e586d45040f4f03c27",
    "verified_classes": [
      "TrajectoryAttributionError"
    ],
    "verified_functions": [
      "validate_trajectory_span"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "TrajectoryAttributionError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
