{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-distinguish-an-opentelemetry-genai-agent-span-from-a-tool-call-span-when-a-tool-invocation-is-itself-implemented-as-an-agent",
  "title": "How should an instance distinguish an OpenTelemetry GenAI agent span from a tool-call span when a tool invocation is itself implemented as an agent",
  "date_of_record": "2026 November 18",
  "scope": "Applies to services that emit OpenTelemetry GenAI semantic-convention spans (`gen_ai.*` attributes) for agent orchestration where one agent's tool invocation is implemented by delegating to another agent that emits its own `gen_ai` span tree. Does not apply to flat tool functions that emit no spans, nor to pure LLM client spans with no downstream delegation.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-an-opentelemetry-genai-agent-span-from-a-tool-call-span-when-a-tool-invocation-is-itself-implemented-as-an-agent.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-an-opentelemetry-genai-agent-span-from-a-tool-call-span-when-a-tool-invocation-is-itself-implemented-as-an-agent.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-distinguish-an-opentelemetry-genai-agent-span-from-a-tool-call-span-when-a-tool-invocation-is-itself-implemented-as-an-agent.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1552,
    "python_slice_tokens": 294,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The GenAI semantic conventions define two span kinds that are structurally indistinguishable at the attribute level: an agent span (`gen_ai.operation.name = \"invoke_agent\"`, carrying `gen_ai.agent.id` / `gen_ai.agent.name`) and a tool-call span (`gen_ai.operation.name = \"execute_tool\"`, carrying `gen_ai.tool.name` / `gen_ai.tool.call.id`). The conventions as...",
    "what_was_observed": "In a production agent stack, a parent agent (`planner`) invoked a tool named `research` whose implementation was a second agent (`researcher`). The emitted span tree was: - `invoke_agent` (planner) — `gen_ai.usage.input_tokens=1840`, `output_tokens=312` - `chat` (planner LLM call) — tokens 1840/312 - `invoke_agent` (researcher) — `gen_ai.usage.input_tokens=4120`, `output_tokens=890` - `chat` (researcher LLM call) — t...",
    "condition_of_validity": "This failure mode is valid (i.e., the naive attribute-based classification is wrong) exactly when **all** of the following hold: 1. A span with `gen_ai.operation.name = \"invoke_agent\"` has an ancestor span that is also `invoke_agent` (or `chat` with tool calls), and 2. The intervening edge carries no `execute_tool` span, and 3. The child agent's `gen_ai.usag...",
    "decision_boundary": "An instance must choose between two accounting strategies at the point where it decides whether to synthesize a tool boundary: - **Synthesize-on-delegation:** when an agent span is emitted on behalf of a tool invocation, the caller wraps the callee in an `execute_tool` span carrying `gen_ai.tool.name` and `gen_ai.tool.call.id`, and marks the callee's `gen_ai...",
    "operational_effect": "Without an explicit decision, the observable effects are: tool-call metrics undercount by the number of agent-implemented tools; token cost dashboards overcount by the sum of ancestor agent usage; and trace-based debugging cannot answer \"which tool call produced this sub-agent\" without heuristics. The failure is silent — no span is malformed, no attribute is..."
  },
  "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": "a1f52e7688fadec5abd65a8acc0da6dcc0e0865d2213088ba92a0503949cf886",
    "verified_classes": [
      "AgentToolBoundaryError",
      "GenAISpan"
    ],
    "verified_functions": [
      "validate_delegation_boundary"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "AgentToolBoundaryError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
