Skip to content

Comments

[BREAKING] Python: Remove workflow register factory methods. Update tests and samples#3781

Merged
moonbox3 merged 2 commits intomicrosoft:mainfrom
moonbox3:remove-workflow-factories
Feb 10, 2026
Merged

[BREAKING] Python: Remove workflow register factory methods. Update tests and samples#3781
moonbox3 merged 2 commits intomicrosoft:mainfrom
moonbox3:remove-workflow-factories

Conversation

@moonbox3
Copy link
Contributor

@moonbox3 moonbox3 commented Feb 10, 2026

Motivation and Context

Remove workflow register factory methods in favor of creating a helper method with executor/agent instances + workflow builder.

Description

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.

@moonbox3 moonbox3 self-assigned this Feb 10, 2026
@moonbox3 moonbox3 added python workflows Related to Workflows in agent-framework labels Feb 10, 2026
Copilot AI review requested due to automatic review settings February 10, 2026 03:11
@moonbox3 moonbox3 added the breaking change Introduces changes that are not backward compatible and may require updates to dependent code. label Feb 10, 2026
@moonbox3 moonbox3 changed the title Python: Remove workflow register factory methods. Update tests and samples [BREAKING] Python: Remove workflow register factory methods. Update tests and samples Feb 10, 2026
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Feb 10, 2026

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/core/agent_framework/_workflows
   _workflow_builder.py137993%171, 448–452, 454, 557, 572
packages/orchestrations/agent_framework_orchestrations
   _concurrent.py1552782%51, 60–61, 69–70, 89–90, 95, 122, 127, 132–133, 139, 161, 171, 178, 245, 261, 264, 321, 351, 353–354, 356, 361, 374, 378
   _group_chat.py2664981%175, 338, 345, 374, 385–386, 392, 397, 413, 440–445, 447, 480–483, 485, 490–494, 615, 618, 621, 624, 632, 642, 651, 657, 701–702, 706–707, 721–722, 724–725, 756–757, 823, 842, 850, 857, 867
   _handoff.py3265682%104–105, 107, 136–137, 159–169, 171, 173, 175, 180, 280, 334, 359, 387, 395–396, 410, 461–462, 494, 534–536, 541–543, 661, 664, 671, 676, 738, 743, 750, 760, 762, 781, 783, 865–866, 898–899, 981, 988, 1060–1061, 1063
   _magentic.py5859683%63–72, 77, 81–92, 257, 268, 272, 292, 353, 362, 364, 406, 423, 432–433, 435–437, 439, 450, 592, 594, 634, 682, 718–720, 722, 730–733, 737–740, 801–804, 895, 901, 907, 949, 987, 1019, 1036, 1047, 1104–1105, 1109–1111, 1135, 1159–1160, 1173, 1189, 1211, 1259–1260, 1298–1299, 1462, 1465, 1474, 1477, 1482, 1533–1534, 1575–1576, 1624, 1654, 1712, 1726, 1737
   _sequential.py861187%73, 166, 177, 183, 214, 216–217, 219, 224, 237, 241
TOTAL16323201487% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
3862 225 💤 0 ❌ 0 🔥 1m 10s ⏱️

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

Removes the Python workflow “factory registration” APIs (and related participant factory patterns in orchestrations) in favor of building workflows directly from executor/agent instances, and updates tests/samples to match.

Changes:

  • Removed WorkflowBuilder.register_executor/register_agent and string-based node wiring; workflows are now wired with executor/agent instances.
  • Removed participant_factories support from orchestration builders (Sequential/Concurrent/GroupChat/Magentic/Handoff) and updated tests accordingly.
  • Updated (and in a few cases removed) getting-started samples that previously demonstrated factory-based patterns.

Reviewed changes

Copilot reviewed 46 out of 46 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
python/samples/getting_started/workflows/visualization/concurrent_with_visualization.py Updates sample to build workflow from executor/AgentExecutor instances.
python/samples/getting_started/workflows/state-management/state_with_agents.py Updates sample to use direct agent instances and direct edge wiring.
python/samples/getting_started/workflows/parallelism/map_reduce_and_visualization.py Updates map/reduce sample to instantiate executors directly and wire by instance.
python/samples/getting_started/workflows/parallelism/fan_out_fan_in_edges.py Updates fan-out/fan-in sample to use AgentExecutor instances and instance wiring.
python/samples/getting_started/workflows/parallelism/aggregate_results_of_different_types.py Updates sample to instantiate executors directly and wire by instance.
python/samples/getting_started/workflows/control-flow/workflow_cancellation.py Updates sample to wire @executor instances directly (no registration).
python/samples/getting_started/workflows/control-flow/switch_case_edge_group.py Updates switch/case sample to use AgentExecutor instances and instance wiring.
python/samples/getting_started/workflows/control-flow/simple_loop.py Updates loop sample to use AgentExecutor instance and instance wiring.
python/samples/getting_started/workflows/control-flow/sequential_streaming.py Updates sequential streaming sample to wire executors by instance.
python/samples/getting_started/workflows/control-flow/sequential_executors.py Updates sample to instantiate executors and wire by instance.
python/samples/getting_started/workflows/control-flow/multi_selection_edge_group.py Updates multi-selection sample to use AgentExecutor instances and instance wiring.
python/samples/getting_started/workflows/control-flow/edge_condition.py Updates conditional routing sample to use AgentExecutor instances and instance wiring.
python/samples/getting_started/workflows/composition/sub_workflow_request_interception.py Updates sub-workflow composition sample to instantiate executors directly.
python/samples/getting_started/workflows/composition/sub_workflow_parallel_requests.py Updates sub-workflow parallel request sample to instantiate executors directly.
python/samples/getting_started/workflows/composition/sub_workflow_basics.py Updates basic sub-workflow composition sample to use direct instances.
python/samples/getting_started/workflows/checkpoint/workflow_as_agent_checkpoint.py Updates SequentialBuilder usage to pass participant instances (no factories).
python/samples/getting_started/workflows/checkpoint/sub_workflow_checkpoint.py Updates checkpointing sample to instantiate executors directly and wire by instance.
python/samples/getting_started/workflows/checkpoint/checkpoint_with_resume.py Updates checkpoint resume sample to instantiate executors directly and wire by instance.
python/samples/getting_started/workflows/checkpoint/checkpoint_with_human_in_the_loop.py Updates HITL checkpoint sample to use AgentExecutor instance and instance wiring.
python/samples/getting_started/workflows/agents/workflow_as_agent_with_thread.py Updates SequentialBuilder usage to pass agent instances (no factories).
python/samples/getting_started/workflows/agents/workflow_as_agent_reflection_pattern.py Updates workflow-as-agent sample to instantiate executors directly.
python/samples/getting_started/workflows/agents/workflow_as_agent_human_in_the_loop.py Updates workflow-as-agent HITL sample to instantiate executors directly.
python/samples/getting_started/workflows/agents/azure_chat_agents_tool_calls_with_feedback.py Updates agent-to-agent workflow sample to use AgentExecutor instances and instance wiring.
python/samples/getting_started/workflows/agents/azure_ai_agents_with_shared_thread.py Updates shared-thread sample to use AgentExecutor instances and instance wiring.
python/samples/getting_started/workflows/_start-here/step4_using_factories.py Removes factory-focused “start here” step sample.
python/samples/getting_started/workflows/_start-here/step1_executors_and_edges.py Adds helper-function guidance for state isolation now that factories are removed.
python/samples/getting_started/orchestrations/sequential_participant_factory.py Removes orchestration sample demonstrating participant factories.
python/samples/getting_started/orchestrations/handoff_participant_factory.py Removes orchestration sample demonstrating participant factories.
python/samples/getting_started/orchestrations/concurrent_participant_factory.py Removes orchestration sample demonstrating participant factories.
python/packages/orchestrations/tests/test_sequential.py Removes participant factory tests and updates assertions for participants-only behavior.
python/packages/orchestrations/tests/test_magentic.py Removes participant factory tests and updates builder validation expectations.
python/packages/orchestrations/tests/test_handoff.py Removes participant factory tests and updates validation expectations.
python/packages/orchestrations/tests/test_group_chat.py Removes participant factory tests and updates validation expectations.
python/packages/orchestrations/tests/test_concurrent.py Removes participant factory and aggregator-factory tests; updates for participants-only behavior.
python/packages/orchestrations/agent_framework_orchestrations/_sequential.py Removes participant_factories support; requires participants.
python/packages/orchestrations/agent_framework_orchestrations/_magentic.py Removes participant_factories support; requires participants.
python/packages/orchestrations/agent_framework_orchestrations/_handoff.py Removes factory-based participant APIs; updates handoff wiring to instance-only.
python/packages/orchestrations/agent_framework_orchestrations/_group_chat.py Removes participant_factories support; requires participants.
python/packages/orchestrations/agent_framework_orchestrations/_concurrent.py Removes participant_factories and custom aggregator factory registration; requires participants.
python/packages/declarative/tests/test_graph_workflow_integration.py Updates executor count expectations due to declarative entry node.
python/packages/declarative/tests/test_graph_coverage.py Updates tests to construct WorkflowBuilder with a real executor instance.
python/packages/declarative/agent_framework_declarative/_workflows/_declarative_builder.py Introduces a stable _workflow_entry node and wires it to the first action.
python/packages/core/tests/workflow/test_workflow_observability.py Updates tracing test to reflect start executor is now an instance, not a string.
python/packages/core/tests/workflow/test_workflow_builder.py Rewrites tests to use direct executor/agent instances (no registration APIs).
python/packages/core/tests/workflow/test_workflow_agent.py Updates tests to build workflows directly from executor/agent instances.
python/packages/core/agent_framework/_workflows/_workflow_builder.py Removes factory registration APIs and string-based wiring; requires instance-based wiring.

@moonbox3 moonbox3 added this pull request to the merge queue Feb 10, 2026
Merged via the queue into microsoft:main with commit a4c9e43 Feb 10, 2026
25 checks passed
@dmytrostruk dmytrostruk mentioned this pull request Feb 10, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Introduces changes that are not backward compatible and may require updates to dependent code. python workflows Related to Workflows in agent-framework

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Python: Remove workflow factory methods from WorkflowBuilder in favor of a helper instantiation method

5 participants