Uh oh!
There was an error while loading. Please reload this page.
Python: Add factory pattern to sequential orchestration builder - #2710
Conversation
Python Test Coverage Report •
Python Unit Test Overview
| |||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
This PR adds a factory pattern to the SequentialBuilder to enable proper state isolation between workflow instances. The feature allows users to register participant factories instead of participant instances, ensuring that each workflow built from the same builder gets fresh participant instances with independent state.
Key Changes:
- Added
register_participants()method to SequentialBuilder accepting factory functions - Updated SequentialBuilder to call factories during
build()to create fresh participant instances - Added comprehensive test coverage for factory pattern with various scenarios
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| python/samples/getting_started/workflows/orchestration/sequential_participant_factory.py | New sample demonstrating factory pattern usage with stateful accumulator showing state isolation between workflow instances |
| python/samples/getting_started/workflows/orchestration/sequential_custom_executors.py | Removed unused Never import and simplified code by removing type ignore comments |
| python/packages/core/tests/workflow/test_sequential.py | Added comprehensive tests for factory pattern including validation, checkpointing, builder reusability, and mixed participants |
| python/packages/core/agent_framework/_workflows/_typing_utils.py | Removed unused _coerce_to_type function and its associated imports |
| python/packages/core/agent_framework/_workflows/_sequential.py | Implemented factory pattern support with validation, added register_participants() method, updated build logic to call factories |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…osoft#2710) * Add factory pattern to sequential orchestration builder * Use temp list to avoid override * Add sample and some other fixes * Fix comments * Small fix * Update readme
Motivation and Context
Follow up for #2486
Description
This PR adds factory to the sequential orchestration builder.
Contribution Checklist