Python: Add executor I/O data to ExecutorInvokedEvent and ExecutorCompletedEvent#2591
Merged
moonbox3 merged 4 commits intomicrosoft:mainfrom Dec 4, 2025
Merged
Python: Add executor I/O data to ExecutorInvokedEvent and ExecutorCompletedEvent#2591moonbox3 merged 4 commits intomicrosoft:mainfrom
moonbox3 merged 4 commits intomicrosoft:mainfrom
Conversation
Member
Python Test Coverage Report •
Python Unit Test Overview
|
|||||||||||||||||||||||||||||||||||
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds executor input/output data to workflow events, enabling observability of executor I/O without modifying executor code. The implementation tracks messages sent via ctx.send_message() and exposes them through ExecutorInvokedEvent.data and ExecutorCompletedEvent.data, aligning Python behavior with the .NET implementation.
Key changes:
- Added
WorkflowContext._sent_messagestracking andget_sent_messages()method to capture messages sent during handler execution - Updated
ExecutorInvokedEventto include the input message as event data - Updated
ExecutorCompletedEventto include sent messages as event data (orNoneif no messages were sent)
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| python/samples/getting_started/workflows/observability/executor_io_observation.py | New sample demonstrating executor I/O observation through streaming events with two executors and helper formatting function |
| python/samples/getting_started/workflows/README.md | Added documentation entry for the new executor I/O observation sample |
| python/packages/core/tests/workflow/test_handoff.py | Improved test robustness by using explicit AgentRunEvent type check and removing fragile attribute checks |
| python/packages/core/tests/workflow/test_executor.py | Added comprehensive unit tests covering input data in invoked events, sent messages in completed events, and complex message types |
| python/packages/core/agent_framework/_workflows/_workflow_context.py | Implemented _sent_messages tracking in send_message() and added get_sent_messages() method; added type ignore comment to existing deprecated method |
| python/packages/core/agent_framework/_workflows/_executor.py | Updated executor event creation to include input message in ExecutorInvokedEvent and sent messages in ExecutorCompletedEvent |
eavanvalkenburg
approved these changes
Dec 3, 2025
dmytrostruk
approved these changes
Dec 4, 2025
arisng
pushed a commit
to arisng/agent-framework
that referenced
this pull request
Feb 2, 2026
…pletedEvent (microsoft#2591) * Add executor I/O data to ExecutorInvokedEvent and ExecutorCompletedEvent * Sample cleanup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Enables observing executor input/output without modifying executor code:
ExecutorInvokedEvent.datanow contains the input message received by the executorExecutorCompletedEvent.datanow contains messages sent viactx.send_message()WorkflowContext.get_sent_messages()to track sent messages during handler executionThis aligns Python behavior with .NET, where these events already carry I/O data.
Description
AgentRunUpdateEventevent #2536executor_io_observation.pysample demonstrating the featuretest_handoff.pyto useAgentRunEventtype checkContribution Checklist