-
Notifications
You must be signed in to change notification settings - Fork 237
feat(gen-ai): add agent.node.* attributes for agent‑graph spans #2247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
a27d7b4
6d461bd
36a67bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: enhancement | ||
|
||
# The name of the area of concern in the attributes-registry (e.g. http, cloud, db) | ||
component: gen-ai | ||
|
||
# A brief description of the change. | ||
note: "Introduce `gen_ai.agent.node.type`, `gen_ai.agent.node.id`, and `gen_ai.agent.parent_id` attributes for fine‑grained agent‑graph spans." | ||
|
||
# Mandatory: tracking issues related to the change. Use the PR number if no separate issue exists. | ||
issues: [2247] # replace with [12345] or similar when you know the issue/PR number | ||
|
||
# (Optional) Additional information rendered under the primary note. | ||
subtext: > | ||
Enables node‑level latency, cost, and guard‑rail analysis for frameworks such | ||
as CrewAI, LangGraph, and OpenAI Agents by standardising graph‑step metadata. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -231,6 +231,38 @@ groups: | |
type: string | ||
brief: Free-form description of the GenAI agent provided by the application. | ||
examples: ["Helps with math problems", "Generates fiction stories"] | ||
- id: gen_ai.agent.node.type | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @nadeemc2 , but can you share more detail for what does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All three frameworks ultimately execute graphs: vertices are “nodes”, edges are “what happens next”. The four enum values cover the common lowest‑level operations (model call, external function, branch, retriever), so any framework can map its richer taxonomy to them without losing fidelity. Instrumentations only need to look at the framework‑native step type and emit the corresponding node.type, rest of the Gen AI attributes (timing, cost, prompt‑id, etc.) work exactly as they do for plain LLM spans. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gyliu513 See some mapping examples below. Let me know, happy to share more details. CrewAI:
AG2:
OpenAI SDK:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This attribute describes a type of inference call or another agent step type - it should be available as a part of GenAI span, but is not related to agents. If it's set on the agent span, then we don't define agent-step-span - we only have invocation that covers multiple steps, so it won't fit there either. If we define agent step span, it would be a duplicate of inference/tool call span under it. So I'm not sure what purpose this attribute solves and how we would populate it in the instrumentations. |
||
stability: development | ||
type: | ||
members: | ||
- id: llm_call | ||
value: "llm_call" | ||
brief: A direct LLM invocation | ||
stability: development | ||
- id: tool_call | ||
value: "tool_call" | ||
brief: An external tool/function call | ||
stability: development | ||
- id: decision | ||
value: "decision" | ||
brief: A control‑flow / reasoning step | ||
stability: development | ||
- id: vector_search | ||
value: "vector_search" | ||
brief: Retrieval / vector‑store query step | ||
stability: development | ||
brief: Kind of node within the agent execution graph. | ||
examples: ["tool_call", "decision", "llm_call"] | ||
- id: gen_ai.agent.node.id | ||
stability: development | ||
type: string | ||
brief: Unique identifier of the node in the agent graph. | ||
examples: ["step_3a87c9"] | ||
- id: gen_ai.agent.parent_id | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it |
||
stability: development | ||
type: string | ||
brief: Identifier of the node's direct parent in the graph (omit for root). | ||
examples: ["step_1f62b0"] | ||
- id: gen_ai.tool.name | ||
stability: development | ||
type: string | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't recommend defining attributes that are not referenced by any semantic conventions - https://github.com/open-telemetry/semantic-conventions/blob/main/docs/general/how-to-define-semantic-conventions.md#defining-attributes
Please define spans/metrics/events that would reference these attributes or add references to existing spans -