From 52a2cd0516fd3edc43b7be27c492cfc8bd05e50f Mon Sep 17 00:00:00 2001 From: Tao Chen Date: Mon, 8 Dec 2025 10:41:26 -0800 Subject: [PATCH 1/2] Update fan in fan out sample to show concurrency --- .../workflows/parallelism/fan_out_fan_in_edges.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/python/samples/getting_started/workflows/parallelism/fan_out_fan_in_edges.py b/python/samples/getting_started/workflows/parallelism/fan_out_fan_in_edges.py index c6f9cad496..8eac7647c2 100644 --- a/python/samples/getting_started/workflows/parallelism/fan_out_fan_in_edges.py +++ b/python/samples/getting_started/workflows/parallelism/fan_out_fan_in_edges.py @@ -6,10 +6,11 @@ from agent_framework import ( # Core chat primitives to build LLM requests AgentExecutorRequest, # The message bundle sent to an AgentExecutor AgentExecutorResponse, # The structured result returned by an AgentExecutor - AgentRunEvent, ChatAgent, # Tracing event for agent execution steps ChatMessage, # Chat message structure Executor, # Base class for custom Python executors + ExecutorCompletedEvent, + ExecutorInvokedEvent, Role, # Enum of chat roles (user, assistant, system) WorkflowBuilder, # Fluent builder for wiring the workflow graph WorkflowContext, # Per run context and event bus @@ -141,9 +142,11 @@ async def main() -> None: # 3) Run with a single prompt and print progress plus the final consolidated output async for event in workflow.run_stream("We are launching a new budget-friendly electric bike for urban commuters."): - if isinstance(event, AgentRunEvent): + if isinstance(event, ExecutorInvokedEvent): # Show which agent ran and what step completed for lightweight observability. - print(event) + print(f"{event.executor_id} invoked") + elif isinstance(event, ExecutorCompletedEvent): + print(f"{event.executor_id} completed") elif isinstance(event, WorkflowOutputEvent): print("===== Final Aggregated Output =====") print(event.data) From 6c33d1ac575d078e416a7b20604fd8910be3bd49 Mon Sep 17 00:00:00 2001 From: Tao Chen Date: Mon, 8 Dec 2025 10:51:54 -0800 Subject: [PATCH 2/2] Update python/samples/getting_started/workflows/parallelism/fan_out_fan_in_edges.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../workflows/parallelism/fan_out_fan_in_edges.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/samples/getting_started/workflows/parallelism/fan_out_fan_in_edges.py b/python/samples/getting_started/workflows/parallelism/fan_out_fan_in_edges.py index 8eac7647c2..fbec7ca303 100644 --- a/python/samples/getting_started/workflows/parallelism/fan_out_fan_in_edges.py +++ b/python/samples/getting_started/workflows/parallelism/fan_out_fan_in_edges.py @@ -143,7 +143,7 @@ async def main() -> None: # 3) Run with a single prompt and print progress plus the final consolidated output async for event in workflow.run_stream("We are launching a new budget-friendly electric bike for urban commuters."): if isinstance(event, ExecutorInvokedEvent): - # Show which agent ran and what step completed for lightweight observability. + # Show when executors are invoked and completed for lightweight observability. print(f"{event.executor_id} invoked") elif isinstance(event, ExecutorCompletedEvent): print(f"{event.executor_id} completed")