Skip to content

add gen_ai.main_agent.name for nested agent and workflow inocations - #385

Draft
lmolkova wants to merge 1 commit into
open-telemetry:mainfrom
lmolkova:gen-ai-main-agent-name
Draft

add gen_ai.main_agent.name for nested agent and workflow inocations#385
lmolkova wants to merge 1 commit into
open-telemetry:mainfrom
lmolkova:gen-ai-main-agent-name

Conversation

@lmolkova

@lmolkova lmolkova commented Jul 17, 2026

Copy link
Copy Markdown
Member

Fix #300
This is an alternative to #355 and complements #270

In #270 we're adding a notion of main agent (local within the process). The root_operation name is pretty much the same except it's not resource/entity attribute, but still identifies the thing this operation is nested under.

Is there a conflict with entity? No:

  • main_agent is limited to in-process propagation. It's interesting to have origin agent (or maybe end-to-end task name), but it's additive and should not break 'my local boss' identification. I.e. if we do this, it should come through some other attribute(s)
  • since main_agent is local, the worst case is that main agent would show up as entity and signal attribute, but they will have the same value
  • entity can only be set by infra / application code and can only apply to cases when main agent is global for the whole process.
  • signal attributes can be set by all agentic / inference instrumentations

Are we blurring the line between agent and workflow Yes:

  • main_agent is either agent or workflow - this is a logical thing rather than something related to agentic library API
  • this line is effectively blurred for the agent registries and other places where we call something an 'agent' from the outside and internally it can be a single llm call or a giant graph of graphs.
  • As a consequence, we should consider demoting invoke_workflow to operation name on an invoke_agent span and reporting its metrics as invoke_agent metrics. To follow up on Clarify workflow span criteria and add reference scenarios for langchain and openai agents #354

Motivation

  • ability to differentiate main agents/workflows from nested ones
  • as a follow up, we can reference this attribute from inference, tool calls and use it as a filtering mechanism for them (give me inference token usage by main agent)

Checklist

  • Motivation section filled in above
  • Reference scenarios updated for affected libraries
  • Towncrier fragment added under changelog.d/ for any change to the conventions that a consumer would care about. Editorial changes (typos, pure rewording, repo tooling) don't need an entry.

See [CONTRIBUTING.md]

…cations

Add gen_ai.main_agent.name to invoke_agent and invoke_workflow spans and
duration metrics to identify the outermost local agent or workflow an
operation runs within, distinguishing top-level invocations from nested
ones. Wire it through the ADK reference scenario.
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Jul 18, 2026

Copy link
Copy Markdown

Pull request dashboard status

Waiting on the author · refreshed 2026-08-20 16:07 UTC

Move out of draft to request review.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: gen_ai.workflow.name on GenAI child spans and client metrics

1 participant