{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-emit-gen-ai-agent-turn-id-versus-inherit-the-parent-turn-for-agent-to-agent-correlation",
  "title": "When must an instance emit `gen_ai.agent.turn.id` versus inherit the parent turn for agent-to-agent correlation",
  "date_of_record": "2026 November 14",
  "scope": "Applies to OpenTelemetry-style GenAI semantic conventions where spans carry `gen_ai.agent.id`, `gen_ai.agent.turn.id`, and a causal link (`gen_ai.agent.parent.turn.id` or a span `Link`) between an initiating agent turn and a responding agent turn. Does not apply to single-agent request/response spans, nor to tool-call spans that are children of the same turn.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-emit-gen-ai-agent-turn-id-versus-inherit-the-parent-turn-for-agent-to-agent-correlation.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-emit-gen-ai-agent-turn-id-versus-inherit-the-parent-turn-for-agent-to-agent-correlation.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-emit-gen-ai-agent-turn-id-versus-inherit-the-parent-turn-for-agent-to-agent-correlation.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1435,
    "python_slice_tokens": 282,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is a conflation of two distinct relations: **continuation** (the responder is executing inside the causal frame of the requester's turn) versus **delegation** (the responder opens a new turn whose cause is the requester's turn). The invariant is: > A span MUST inherit the parent `gen_ai.agent.turn.id` only if it is a *synchronous continuation* of...",
    "what_was_observed": "A multi-agent pipeline (planner → N workers → aggregator) emitted worker spans with `gen_ai.agent.turn.id` equal to the planner's turn ID whenever the worker was \"spawned by\" the planner, regardless of whether the planner awaited it. In the synchronous fan-out path this was correct. In the asynchronous path — workers enqueued and drained by a separate pool — three anomalies appeared: 1. **Turn cardinality undercount....",
    "condition_of_validity": "Inheritance of `gen_ai.agent.turn.id` is valid **iff all** of the following hold: - The child span's execution is bounded by the parent turn: the parent cannot complete, commit, or be cancelled while the child is in flight without the child also being cancelled. - The child is not independently retryable, reschedulable, or persistable beyond the parent turn'...",
    "decision_boundary": "The decision is not \"is this a child agent?\" but \"is this agent's execution a continuation of the caller's turn or a new turn caused by it?\" The diagnostic test: - **Blocking call, in-process, parent awaits to completion** → continuation → inherit turn ID. - **Fire-and-forget, queued, or retried independently** → delegation → fresh turn ID + `parent.turn.id`...",
    "operational_effect": "Correcting the boundary — minting fresh turn IDs at the delegation seam and recording `parent.turn.id` — restored turn cardinality (7 workers counted as 7 turns), made retry dedup key on the new per-attempt turn ID, and broke the spurious self-cycle in loop detection (the planner re-invocation now has a distinct turn whose parent is the worker's turn, an acy..."
  },
  "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": "9b129dda96adc319909163d7acbe60953530535a52504db2a5cbf03befcdff62",
    "verified_classes": [
      "TurnBoundaryViolation",
      "SpanContext"
    ],
    "verified_functions": [
      "assign_turn_id"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "TurnBoundaryViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
