Uh oh!
There was an error while loading. Please reload this page.
Python: WorkflowBuilder registry - #2486
Conversation
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.
Evan Mattson (moonbox3)
commented
Nov 27, 2025
Also, is this truly breaking? It should be additive, right? |
There was a problem hiding this comment.
Pull request overview
This PR introduces a factory-based registration pattern for executors and agents in the WorkflowBuilder, enabling lazy initialization and isolated workflow instances. Key changes include new register_executor() and register_agent() methods, deprecation warnings for direct instance addition, and comprehensive sample updates demonstrating the new pattern.
- Factory-based registration via
register_executor()andregister_agent()for deferred instantiation - Backward compatibility maintained with deprecation warnings on
add_agent()and direct executor addition - All 25+ sample files migrated to use the factory pattern
- Comprehensive test coverage for new registration patterns
- New sample file (
step4_using_factories.py) demonstrating best practices
Reviewed changes
Copilot reviewed 33 out of 33 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
_workflow_builder.py | Implements executor/agent factory registration with deferred edge resolution |
_workflow.py | Simplifies start executor handling to require Executor instance |
_validation.py | Updates validation to accept Executor instance instead of union type |
_edge.py | Allows Case and Default targets to be strings for deferred resolution |
test_workflow_builder.py | Adds 13 new tests for factory registration patterns |
| Sample files (25+) | Migrated to factory pattern with agent/executor factory functions |
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.
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.
* Add workflow builder factory pattern * Add internal edge groups to registered executors; next samples * Update samples: Part 1 * register -> register_executor * update hil samples * Update other samples * Update agent samples * Update doc string * Add new sample * Fix mypy * Address comments * Fix mypy
Motivation and Context
Closing #429
Description
Add support for providing factories to create executors and agents to the workflow builder to allow the workflow builder to create isolated workflow instances.
builder.register_executor().builder.register_agent().Contribution Checklist