Skip to content

Python: Update fan in fan out sample to show concurrency#2705

Merged
TaoChenOSU merged 3 commits intomicrosoft:mainfrom
TaoChenOSU:taochen/python-update-fan-in-fan-out-sample
Dec 8, 2025
Merged

Python: Update fan in fan out sample to show concurrency#2705
TaoChenOSU merged 3 commits intomicrosoft:mainfrom
TaoChenOSU:taochen/python-update-fan-in-fan-out-sample

Conversation

@TaoChenOSU
Copy link
Contributor

@TaoChenOSU TaoChenOSU commented Dec 8, 2025

Motivation and Context

AgentRunEvent is not emitted by the workflow when it's run in streaming mode. The sample python/samples/getting_started/workflows/parallelism/fan_out_fan_in_edges.py shows the wrong event.

Description

This PR replaces the AgentRunEvent with the expected events from executors when they are invoked and complete.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

@TaoChenOSU TaoChenOSU self-assigned this Dec 8, 2025
Copilot AI review requested due to automatic review settings December 8, 2025 18:44
@TaoChenOSU TaoChenOSU added python workflows Related to Workflows in agent-framework labels Dec 8, 2025
@github-actions github-actions bot changed the title Update fan in fan out sample to show concurrency Python: Update fan in fan out sample to show concurrency Dec 8, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes incorrect event handling in the fan-out-fan-in workflow sample. The sample was using AgentRunEvent which is not emitted during streaming mode, and now correctly uses ExecutorInvokedEvent and ExecutorCompletedEvent to observe workflow execution.

Key Changes

  • Replaced AgentRunEvent import with ExecutorInvokedEvent and ExecutorCompletedEvent
  • Updated event handling to check for both executor invocation and completion events
  • Modified print statements to display executor state transitions more clearly

…an_in_edges.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@TaoChenOSU TaoChenOSU enabled auto-merge December 8, 2025 18:52
@TaoChenOSU TaoChenOSU added this pull request to the merge queue Dec 8, 2025
Merged via the queue into microsoft:main with commit d7ca969 Dec 8, 2025
22 checks passed
arisng pushed a commit to arisng/agent-framework that referenced this pull request Feb 2, 2026
)

* Update fan in fan out sample to show concurrency

* Update python/samples/getting_started/workflows/parallelism/fan_out_fan_in_edges.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Victor Dibia <chuvidi2003@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python workflows Related to Workflows in agent-framework

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants