Skip to content

fix(logging): preserve agent workflow output and finish reasons - #268

Merged
pradystar merged 1 commit into
mainfrom
bugfix/agent-workflow-output-finish-reason
Oct 8, 2026
Merged

pradystar merged 1 commit into
mainfrom
bugfix/agent-workflow-output-finish-reason

Conversation

@pradystar

Copy link
Copy Markdown
Collaborator

Fix missing output and finish reasons on parent agent/workflow spans.

  • Let successful decorated agents and workflows returning None use the logger’s existing child-output fallback.
  • Preserve explicit empty outputs and prevent failed operations from inheriting a successful child answer.
  • Capture provider finish reasons in streaming and non-streaming OpenAI Chat Completions.
  • Propagate the terminal LLM finish reason to enclosing agent/workflow spans when their outputs match.
  • Add a banking agent example, regression tests, and documentation.

Validation

  • Focused mocked suite: 113 tests passed across decorator ownership, logger OTLP egress, OpenAI extraction/instrumentation, and span conversion.
  • Ruff lint and format checks passed for the changed SDK and test files.
  • The second banking query completed successfully using the modified SDK without raw OTLP capture.
  • Full suite and type checks were not run.
  • Parent span output and finish reason still need confirmation in a live trace.

Before - https://app.us1.observability.splunkcloud.com/#/agent-obs/project/f077de91-25d9-4ae3-9f00-3c38fc32ed69/agent-streams/c6e85115-69de-4192-84ef-6256ee3c8bb4/sessions/b08f50d4-eb10-4247-88a0-213ee02af2a8?timeRange=%7B%22type%22:%22lastYear%22%7D&table-filters-store-v1=%7B%22state%22:%7B%22filters%22:%5B%5D,%22filterConnector%22:%22and%22,%22textSearch%22:%22%22,%22lastContextKey%22:%22f077de91-25d9-4ae3-9f00-3c38fc32ed69-c6e85115-69de-4192-84ef-6256ee3c8bb4-%22%7D,%22version%22:0%7D&traceId=1ddada64-c939-472c-afb7-8175826e1c4b&spanId=7dece5b4-ab5e-4b2c-a938-91d338ad577d
After - https://app.us1.observability.splunkcloud.com/#/agent-obs/project/f077de91-25d9-4ae3-9f00-3c38fc32ed69/agent-streams/c6e85115-69de-4192-84ef-6256ee3c8bb4/sessions/0c94352b-1fc8-4173-b54d-9274032e2b5c?timeRange=%7B%22type%22:%22lastYear%22%7D&table-filters-store-v1=%7B%22state%22:%7B%22filters%22:%5B%5D,%22filterConnector%22:%22and%22,%22textSearch%22:%22%22,%22lastContextKey%22:%22f077de91-25d9-4ae3-9f00-3c38fc32ed69-c6e85115-69de-4192-84ef-6256ee3c8bb4-%22%7D,%22version%22:0%7D&spanId=fe8407d4-bc93-4b27-bce8-5bb704fd8bb4&traceId=9c36724b-3964-41f5-8c9b-632a8208d472

@etserend
etserend self-requested a review October 8, 2026 22:58

@etserend etserend left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me.

@pradystar
pradystar merged commit d3f6c6c into main Oct 8, 2026
13 checks passed
@pradystar
pradystar deleted the bugfix/agent-workflow-output-finish-reason branch October 8, 2026 23:03
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants