Repository navigation
Python: Add factory pattern to concurrent orchestration builder - #2738
Merged
Tao Chen (TaoChenOSU) merged 13 commits intoDec 11, 2025
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds factory pattern support to the ConcurrentBuilder class, allowing participants and aggregators to be created through factory functions rather than requiring pre-instantiated objects. This enhancement enables better state isolation between workflow instances created from the same builder.
Key changes:
- Added
register_participants()method accepting factory functions for creating participants - Enhanced
with_aggregator()to accept executor factories in addition to instances and callbacks - Updated
build()method to handle both direct instances and factories
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
python/packages/core/agent_framework/_workflows/_concurrent.py |
Core implementation adding factory pattern support with new register_participants() method and enhanced with_aggregator() to handle executor factories |
python/packages/core/tests/workflow/test_concurrent.py |
Comprehensive test coverage for factory patterns including tests for executor instance aggregators, executor factory aggregators, and participant factories |
python/samples/getting_started/workflows/orchestration/concurrent_participant_factories.py |
New sample demonstrating concurrent orchestration using participant factories and custom aggregator with proper state isolation across workflow instances |
python/samples/getting_started/workflows/orchestration/concurrent_custom_aggregator.py |
Updated documentation comment to reflect method rename from with_custom_aggregator to with_aggregator |
Tao Chen (TaoChenOSU)
requested review from
Eduard van Valkenburg (eavanvalkenburg) and
Evan Mattson (moonbox3)
December 10, 2025 19:00
Contributor
Python Test Coverage Report •
Python Unit Test Overview
|
|||||||||||||||||||||||||||||||||||
Ben Thomas (alliscode)
approved these changes
Dec 10, 2025
Evan Mattson (moonbox3)
approved these changes
Dec 11, 2025
Tao Chen (TaoChenOSU)
enabled auto-merge
December 11, 2025 01:13
Evan Mattson (moonbox3)
approved these changes
Dec 11, 2025
Motivation and Context
Follow up for #2486
Description
This PR adds factory to the concurrent orchestration builder.
This PR also fixes a bug where executors with the same ID created by different factories can pass validation undetected.
Contribution Checklist