Repository navigation
Python: [BREAKING] align workflow span name with OpenTelemetry conventions - #9900
Vincent Biret (baywet) wants to merge 6 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: fa592ce6-05c6-4421-801b-59c77df4b2df
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are identified for the workflow invocation span-name update.
No open issues 🎉
What changed in this PR
Aligns Python workflow invocation span names with OpenTelemetry conventions, complementing the .NET correction in #9899. Workflow execution and public API signatures remain unchanged; telemetry filters using workflow.run must switch to invoke_workflow.
Changes:
- Renames the shared workflow invocation span to
invoke_workflow. - Adds four regression cases covering graph and functional workflows in streaming and non-streaming modes.
- Updates existing core and AG-UI telemetry assertions and a test docstring.
| File | Description |
|---|---|
python/packages/core/tests/workflow/test_workflow.py |
Updates the abandoned-stream span assertion. |
python/packages/core/tests/workflow/test_workflow_observability.py |
Adds span-name regression coverage and updates telemetry expectations. |
python/packages/core/tests/workflow/test_functional_workflow.py |
Updates the span name in a test docstring only. |
python/packages/core/agent_framework/observability.py |
Changes the shared workflow invocation span-name constant. |
python/packages/ag-ui/tests/ag_ui/test_workflow_run.py |
Updates workflow span filters in conversation-ID tests. |
Review effort: Balanced
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: Findings reported
Scope: full PR (1 commit(s)): db7ed22ba370
Model: gpt-5.6-sol
Overview
The PR centralizes the workflow invocation span rename in the shared telemetry constant and adds graph/functional and streaming/non-streaming regression coverage, while existing tests preserve span lifecycle, parenting, error, cleanup, and conversation-ID behavior. The resulting bare span name does not implement the workflow-name suffix required for named workflows by the referenced convention. The change also breaks existing telemetry consumers that match the previously emitted name without the explicit breaking-change classification required for the stable core package.
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
2 verified findings remained after source verification (2 medium) across 1 file. Details are attached to the affected lines below.
Affected areas: python/packages/core/agent_framework/observability.py
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: fa592ce6-05c6-4421-801b-59c77df4b2df
There was a problem hiding this comment.
MAF Automated Review — Iteration 2
Result: No findings
Scope: 1 net-new commit(s): c4c2dd58b83b
Model: gpt-5.6-sol
Overview
This incremental update adds an explicit union annotation for the graph and functional workflow instances used by the telemetry regression test. Both builders' declared return types, public exports, compatible run overloads, and the four-case streaming/non-streaming test matrix support the annotation without changing runtime behavior. No new Critical, High, or Medium issue is introduced by the reviewed commit.
Reviewed the supplied incremental change set across correctness, security/reliability, architecture, and failure behavior.
No publishable findings remained after source verification for this scope.
|
Vincent Biret (@baywet) |
Rename workflow.name to gen_ai.workflow.name and cover graph and functional workflows in streaming and non-streaming runs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: aa4dae7a-fdbd-475c-8ec6-fa8333e77cc4
Set gen_ai.operation.name to invoke_workflow when workflow invocation spans are created. Cover graph and functional workflows, attached span creation, and unchanged executor/message spans. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: aa4dae7a-fdbd-475c-8ec6-fa8333e77cc4
Prepare workflow span names and attributes together so named invocation spans preserve operation and scoped conversation attributes. Cover both span factories, graph and functional workflows, AG-UI propagation, and unnamed fallback behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: aa4dae7a-fdbd-475c-8ec6-fa8333e77cc4
|
Eduard van Valkenburg (@eavanvalkenburg) I've now aligned the remaining invocation-span names/attributes with the pinned
The description now includes the telemetry-consumer migration: use the operation attribute to identify workflow invocations, update the workflow-name attribute lookup, and account for the workflow-name suffix instead of exact matching the old span name. The 23 targeted tests, Ruff checks, and focused source/test Pyright checks passed in Docker. I've also made the scope explicit: |
There was a problem hiding this comment.
🟡 Changes recommended
Unnamed graph workflows expose generated UUID-based names in span names and gen_ai.workflow.name, violating low-cardinality conventions and requiring omission of generated names plus regression coverage.
1 open issue
Review effort: Balanced
Track generated-name provenance while retaining runtime names and checkpoint identity. Cover unnamed and explicitly named graph workflows in streaming and non-streaming modes and preserve scoped conversation propagation through core and AG-UI paths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: aa4dae7a-fdbd-475c-8ec6-fa8333e77cc4

Motivation & Context
Align Python workflow invocation telemetry with the pinned OpenTelemetry GenAI invoke-workflow conventions. Graph and functional workflows previously emitted
workflow.run, used the customworkflow.nameattribute instead ofgen_ai.workflow.name, and omitted the requiredgen_ai.operation.nameattribute.Description & Review Guide
invoke_workflow {gen_ai.workflow.name}when a meaningful workflow name is available, falling back toinvoke_workflowotherwise. Renameworkflow.nametogen_ai.workflow.nameand supplygen_ai.operation.name="invoke_workflow"at span creation. Track generated graph-workflow names separately so they remain available for runtime/checkpoint identity but are omitted from the semantic attribute and invocation span suffix. Explicit names, including names resembling generated names, and functional workflows' function-name defaults remain intact. Prepare names and attributes together in the shared span factories so the workflow-name suffix does not bypass conversation-ID enrichment. Extend graph/functional, streaming/non-streaming, checkpoint, scoped conversation, and AG-UI regression coverage, and document the telemetry format in the Python consumer skill.breaking changelabel and title prefix. Update processors, dashboards, alerts, and filters as described below. Workflow execution, span parenting/lifecycle, sensitive-data controls, and public function signatures are unchanged. Existing ambient conversation IDs and explicit conversation-ID precedence are preserved. Missing conversation IDs are not synthesized.gen_ai.conversation.idwith named and unnamed workflows; and unchanged executor/message spans, error reporting, and abandoned-stream cleanup.workflow.rungen_ai.operation.name == "invoke_workflow"to identify invocations independently of workflow names. Display names are nowinvoke_workflow {workflow_name}, or bareinvoke_workflowwhen no non-empty name attribute is supplied.workflow.namegen_ai.workflow.name.OtelAttr.WORKFLOW_NAMEnow resolves to this standard key. Unnamed graph workflows omit this attribute instead of emitting a generated UUID-based runtime name.OtelAttr.WORKFLOW_RUN_SPANworkflow.runto the base operation nameinvoke_workflow; exported named spans also include the workflow-name suffix. Do not compare every exported span name directly to this constant.gen_ai.conversation.idanderror.type; their names are unchanged.This PR is limited to Python workflow invocation spans and their direct attributes. Framework-only spans such as
workflow.build, executor-processing spans, message-send spans, and workflow events remain unchanged; the pinned invoke-workflow section does not define replacements for them. Default graph-workflow names are still generated and retained in runtime/checkpoint identity and serialized workflow definitions, but are no longer included ingen_ai.workflow.nameor the invocation span name.The following commands passed in a Python 3.14 Docker container against the current source, from
python/, using the isolated interpreter at/validation/venv/bin/python:The named-span and operation-attribute regressions failed before their respective fixes. Six unnamed-graph regressions also failed before generated names were excluded. Full package and integration suites were not run; all five configured test type checkers were run on the three test files changed for this review fix.
Related Issue
N/A - trivial change: correct unambiguous workflow invocation span-name and required-attribute mismatches with the linked specification. This PR changes only Python; #9899 contains the related .NET correction. #8559 concerns middleware telemetry and is not closed by this PR.
AI Assistance
AI assistance details: GitHub Copilot assisted with implementation, regression tests, consumer documentation, validation, and this PR description.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.