[DOCS] `claude_code.llm_request` docs omit `agent_id` and `parent_agent_id` span attributes

Resolved 💬 2 comments Opened May 11, 2026 by coygeek Closed May 12, 2026

Documentation Type

Missing documentation (feature not documented)

Documentation Location

https://code.claude.com/docs/en/monitoring-usage

Section/Topic

claude_code.llm_request span attributes table (under "Span attributes")

Current Documentation

The claude_code.llm_request span attributes table currently lists attributes including model, query_source, speed, llm_request.context, duration_ms, ttft_ms, input_tokens, output_tokens, cache_read_tokens, cache_creation_tokens, request_id, client_request_id, attempt, success, status_code, error, response.has_tool_call, stop_reason, and gen_ai.response.finish_reasons.

The table does not document agent_id or parent_agent_id attributes, which were added in v2.1.139 for subagent tracking in the OTEL span hierarchy.

What's Wrong or Missing?

A. Missing agent_id attribute

The claude_code.llm_request span table does not document the agent_id attribute that was added in v2.1.139 to identify which subagent made the LLM request. When the Task tool spawns a subagent, the subagent's llm_request spans now carry this attribute for trace filtering and debugging.

B. Missing parent_agent_id attribute

The span table also does not document parent_agent_id, which identifies the parent agent that delegated to a subagent. This enables tracing the full delegation chain through the span hierarchy.

C. Traced relationship already documented but attributes not named

The monitoring-usage doc already describes in the span hierarchy that "When the Task tool spawns a subagent, the subagent's llm_request and tool spans nest under the parent agent's claude_code.tool span" (line 149), but the specific agent_id / parent_agent_id attributes that enable this are not listed in the span attributes table.

Suggested Improvement

Add the following rows to the claude_code.llm_request span attributes table:

| Attribute | Description | Gated by |
| --------- | ----------- | -------- |
| agent_id | Unique identifier for the subagent that made this LLM request. Present when the request originates from a subagent (Task tool). | |
| parent_agent_id | Agent ID of the parent agent that delegated to this subagent. Present when running inside a subagent called by a parent agent. | |

The query_source attribute (already documented) covers the subagent name, but agent_id provides the unique identifier needed for programmatic trace filtering and correlation.

Impact

Medium - Makes feature difficult to understand

Additional Context

Affected Pages:

| Page | Context |
|------|---------|
| https://code.claude.com/docs/en/monitoring-usage | claude_code.llm_request span attributes table (Section: "Span attributes") |
| https://code.claude.com/docs/en/agent-sdk/observability | TypeScript SDK observability docs (may also need updating) |

Total scope: 2 pages affected

Changelog reference: v2.1.139 - "API requests from subagents now carry x-claude-code-agent-id / x-claude-code-parent-agent-id headers, and claude_code.llm_request OTEL spans include agent_id / parent_agent_id attributes"

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗