[FEATURE] OTLP telemetry lacks agent/subagent identity for team spawns
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
When using Agent Teams (TeamCreate + Task to spawn named teammates), the OTLP telemetry events emitted by subagents are indistinguishable from the parent agent's events. There is no field identifying which agent produced a given event.
All events from parent and child agents share:
- The same
session.id - The same
prompt.id - No
agent.name,agent.id, orparent.session.idfield
The only differentiator is event.sequence number and timestamp, which is insufficient to reconstruct the multi-agent topology.
This means external tooling that consumes the OTLP stream (visualizers, debuggers, cost trackers) cannot attribute activity to individual agents in a team.
Proposed Solution
Add identity fields to OTLP events emitted by subagents:
| Field | Description | Example |
|-------|-------------|---------|
| agent.name | The name parameter from the Task spawn | "bob" |
| agent.id | The assigned agent ID | "bob@my-team" |
| agent.parent_session_id | Session ID of the spawning agent | "22f11775-..." |
| team.name | The team name if applicable | "my-team" |
At minimum, agent.name (or agent.id) on every event emitted by a subagent would be sufficient. Ideally, subagents would also get a distinct session.id so the parent→child relationship is self-describing via agent.parent_session_id.
Events from the root (non-team) agent would simply omit these fields, so there's no breaking change.
Alternative Solutions
- Heuristic inference: Correlate
Tasktool_result timing with subsequent tool calls to guess which subagent made them. This is fragile, breaks with parallel agents and overlapping tool calls, and has no ground truth to validate against. - Subagent-emitted markers: Have agents self-identify by writing to a file or calling a specific tool. This is a workaround, not a real solution — the telemetry should be self-describing.
Priority
Medium - Would be very helpful
Feature Category
Developer tools/SDK
Use Case Example
- User creates a team with 3 named agents ("bob", "dick", "harry") via
TeamCreate+Task - Each agent performs different tool calls in parallel (Glob, Bash, Read)
- An external tool consumes the OTLP stream to analyse sub-agent performance for the session
- Current: All OTLP events appear as a single flat session — no way to tell which agent did what
- With this feature: Each agent's events carry
agent.nameandagent.id, so the analyser can render bob, dick, and harry as separate agents with their own activity streams
Additional Context
I'm building a real-time visualization of Claude Code sessions using the OTLP telemetry stream. With Agent Teams becoming a core workflow pattern, rendering each teammate as a distinct node is essential — but the current telemetry makes subagents completely invisible.
Here's what the raw OTLP data looks like for 3 spawned agents — note the identical session.id and no agent identifier:
# Task spawn for "bob" (line 5)
event.sequence: 2026, session.id: 22f11775-..., tool_name: Task
# Task spawn for "dick" (line 7)
event.sequence: 2028, session.id: 22f11775-..., tool_name: Task
# Task spawn for "harry" (line 12)
event.sequence: 2033, session.id: 22f11775-..., tool_name: Task
# No way to attribute subsequent Glob/Bash/Read calls to bob vs dick vs harry
Environment: Claude Code v2.1.50, macOS darwin/arm64
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗