Skip to content

Add support for workflow invocation in genAI utils#4334

Open
wrisa wants to merge 12 commits intoopen-telemetry:mainfrom
wrisa:workflow-handler-genai-utils
Open

Add support for workflow invocation in genAI utils#4334
wrisa wants to merge 12 commits intoopen-telemetry:mainfrom
wrisa:workflow-handler-genai-utils

Conversation

@wrisa
Copy link
Contributor

@wrisa wrisa commented Mar 13, 2026

Description

Added start, stop, fail support for workflow invocation type.

Check its example usage in langchain.

span when OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT = SPAN_ONLY

Span #1
    Trace ID       : 433d5dbee2e91ef4753fc382f4b8fbfb
    Parent ID      : 
    ID             : bd9e889d1600f77a
    Name           : invoke_workflow LangGraph
    Kind           : Internal
    Start time     : 2026-03-10 22:53:41.866887 +0000 UTC
    End time       : 2026-03-10 22:53:43.471657 +0000 UTC
    Status code    : Unset
    Status message : 
Attributes:
     -> gen_ai.operation.name: Str(invoke_workflow)
     -> gen_ai.input.messages: Str([{"role":"user","parts":[{"content":"You are a helpful assistant!","type":"text"}]},{"role":"user","parts":[{"content":"What is the capital of France?","type":"text"}]}])
     -> gen_ai.output.messages: Str([{"role":"assistant","parts":[{"content":"The capital of France is Paris.","type":"text"}],"finish_reason":"stop"}])

span when OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT = NO_CONTENT

Span #1
    Trace ID       : 433d5dbee2e91ef4753fc382f4b8fbfb
    Parent ID      : 
    ID             : bd9e889d1600f77a
    Name           : invoke_workflow LangGraph
    Kind           : Internal
    Start time     : 2026-03-10 22:53:41.866887 +0000 UTC
    End time       : 2026-03-10 22:53:43.471657 +0000 UTC
    Status code    : Unset
    Status message : 
Attributes:
     -> gen_ai.operation.name: Str(invoke_workflow)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@wrisa wrisa marked this pull request as ready for review March 18, 2026 18:20
@wrisa wrisa requested a review from a team as a code owner March 18, 2026 18:20
Copy link
Member

@lmolkova lmolkova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a caveat on reusing common fail/stop methods being introduced in #4219

invocation.span.end()
return invocation

def fail_workflow( # pylint: disable=no-self-use
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussed on the SIG call, let's reuse common fail and stop methods

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.

4 participants