Add gen_ai.agent.invocation.trigger attribute to invoke_agent spans#3614
Open
Krishnachaitanyakc wants to merge 3 commits intoopen-telemetry:mainfrom
Open
Add gen_ai.agent.invocation.trigger attribute to invoke_agent spans#3614Krishnachaitanyakc wants to merge 3 commits intoopen-telemetry:mainfrom
Krishnachaitanyakc wants to merge 3 commits intoopen-telemetry:mainfrom
Conversation
Adds a new enum attribute to distinguish directly-invoked from agent-delegated invocations on both CLIENT and INTERNAL invoke_agent spans. Values: direct (user/app/system trigger) and agent (delegated by another GenAI agent). Partially addresses open-telemetry#1961, open-telemetry#2664.
Run `make registry-generation` and `make table-generation` to update generated docs after adding gen_ai.agent.invocation.trigger.
Resolve merge conflicts in autogenerated docs, keeping gen_ai.agent.invocation.trigger attribute with correct footnote numbering and adopting upstream's gen_ai.tool.definitions schema reference changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Partially addresses #1961, #2664
Problem
All
invoke_agentspans currently look identical regardless of who triggered them.An operator debugging a multi-agent trace cannot distinguish user-initiated from
agent-delegated invocations without manually walking the span tree.
Before
After
Operators can now query
gen_ai.agent.invocation.trigger = "agent"to find alldelegation-triggered invocations, enabling cost attribution, blast radius analysis,
and debugging without tree-walking.
Why not derive from parent-child?
Parent-child shows temporal containment, not semantic intent. When
invoke_agent Bis nested under
invoke_agent A, you know B ran during A's execution, but notwhether A deliberately delegated to B or B was invoked for an unrelated reason
within A's scope. This attribute makes intent explicit.
Cross-provider evidence
Task.delegate()with coworker parameterGroupChatManagerspeaker selectionHandoffobjects with target agenttransfer_to_agent()tool callsend()/ conditional edges to agent nodesChanges
gen_ai.agent.invocation.triggerenum (direct,agent)attributes.gen_ai.invoke_agent.common(applies to both CLIENT and INTERNAL spans)Design decisions
orchestrator— the agent/orchestrator distinction is not reliably auto-instrumentable and collapses in practice.directnotuser:directis semantically neutral — covers user requests, app logic, cron jobs, and non-agent orchestrators without implying a human initiated it.invoke_agentspans viaattributes.gen_ai.invoke_agent.common, matching the PR Splitinvoke_agentinto separate client and internal spans, and split attributes from inference hierarchy #3514 architecture.recommended: if known: Instrumentors populate when the framework exposes delegation signals, not forced when trigger is ambiguous.