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

* Remove workflow register factory methods. Update tests and samples

* Address Copilot feedback
This commit is contained in:
Evan Mattson
2026-02-11 07:16:17 +09:00
committed by GitHub
Unverified
parent f407f726a7
commit a4c9e43afb
46 changed files with 650 additions and 3660 deletions
@@ -2012,7 +2012,9 @@ class TestBuilderControlFlowCreation:
# Create builder with minimal yaml definition
yaml_def = {"name": "test_workflow", "actions": []}
graph_builder = DeclarativeWorkflowBuilder(yaml_def)
wb = WorkflowBuilder(start_executor="dummy")
from agent_framework_declarative._workflows._executors_control_flow import JoinExecutor
wb = WorkflowBuilder(start_executor=JoinExecutor({"kind": "Dummy"}, id="dummy"))
action_def = {
"kind": "GotoAction",
@@ -2036,7 +2038,9 @@ class TestBuilderControlFlowCreation:
yaml_def = {"name": "test_workflow", "actions": []}
graph_builder = DeclarativeWorkflowBuilder(yaml_def)
wb = WorkflowBuilder(start_executor="dummy")
from agent_framework_declarative._workflows._executors_control_flow import JoinExecutor
wb = WorkflowBuilder(start_executor=JoinExecutor({"kind": "Dummy"}, id="dummy"))
action_def = {
"kind": "GotoAction",
@@ -2056,7 +2060,9 @@ class TestBuilderControlFlowCreation:
yaml_def = {"name": "test_workflow", "actions": []}
graph_builder = DeclarativeWorkflowBuilder(yaml_def)
wb = WorkflowBuilder(start_executor="dummy")
from agent_framework_declarative._workflows._executors_control_flow import JoinExecutor
wb = WorkflowBuilder(start_executor=JoinExecutor({"kind": "Dummy"}, id="dummy"))
action_def = {
"kind": "GotoAction",
@@ -2094,7 +2100,9 @@ class TestBuilderControlFlowCreation:
yaml_def = {"name": "test_workflow", "actions": []}
graph_builder = DeclarativeWorkflowBuilder(yaml_def)
wb = WorkflowBuilder(start_executor="dummy")
from agent_framework_declarative._workflows._executors_control_flow import JoinExecutor
wb = WorkflowBuilder(start_executor=JoinExecutor({"kind": "Dummy"}, id="dummy"))
# Create a mock loop_next executor
loop_next = ForeachNextExecutor(
@@ -2124,7 +2132,9 @@ class TestBuilderControlFlowCreation:
yaml_def = {"name": "test_workflow", "actions": []}
graph_builder = DeclarativeWorkflowBuilder(yaml_def)
wb = WorkflowBuilder(start_executor="dummy")
from agent_framework_declarative._workflows._executors_control_flow import JoinExecutor
wb = WorkflowBuilder(start_executor=JoinExecutor({"kind": "Dummy"}, id="dummy"))
action_def = {
"kind": "BreakLoop",
@@ -2149,7 +2159,9 @@ class TestBuilderControlFlowCreation:
yaml_def = {"name": "test_workflow", "actions": []}
graph_builder = DeclarativeWorkflowBuilder(yaml_def)
wb = WorkflowBuilder(start_executor="dummy")
from agent_framework_declarative._workflows._executors_control_flow import JoinExecutor
wb = WorkflowBuilder(start_executor=JoinExecutor({"kind": "Dummy"}, id="dummy"))
# Create a mock loop_next executor
loop_next = ForeachNextExecutor(
@@ -2179,7 +2191,9 @@ class TestBuilderControlFlowCreation:
yaml_def = {"name": "test_workflow", "actions": []}
graph_builder = DeclarativeWorkflowBuilder(yaml_def)
wb = WorkflowBuilder(start_executor="dummy")
from agent_framework_declarative._workflows._executors_control_flow import JoinExecutor
wb = WorkflowBuilder(start_executor=JoinExecutor({"kind": "Dummy"}, id="dummy"))
action_def = {
"kind": "ContinueLoop",
@@ -2203,7 +2217,9 @@ class TestBuilderEdgeWiring:
yaml_def = {"name": "test_workflow", "actions": []}
graph_builder = DeclarativeWorkflowBuilder(yaml_def)
wb = WorkflowBuilder(start_executor="dummy")
from agent_framework_declarative._workflows._executors_control_flow import JoinExecutor
wb = WorkflowBuilder(start_executor=JoinExecutor({"kind": "Dummy"}, id="dummy"))
# Create a mock source executor
source = SendActivityExecutor({"kind": "SendActivity", "activity": {"text": "test"}}, id="source")
@@ -2236,7 +2252,9 @@ class TestBuilderEdgeWiring:
yaml_def = {"name": "test_workflow", "actions": []}
graph_builder = DeclarativeWorkflowBuilder(yaml_def)
wb = WorkflowBuilder(start_executor="dummy")
from agent_framework_declarative._workflows._executors_control_flow import JoinExecutor
wb = WorkflowBuilder(start_executor=JoinExecutor({"kind": "Dummy"}, id="dummy"))
source = SendActivityExecutor({"kind": "SendActivity", "activity": {"text": "source"}}, id="source")
target = SendActivityExecutor({"kind": "SendActivity", "activity": {"text": "target"}}, id="target")
@@ -223,11 +223,11 @@ class TestGraphWorkflowCheckpointing:
builder = DeclarativeWorkflowBuilder(yaml_def)
_workflow = builder.build() # noqa: F841
# Verify multiple executors were created
# Verify multiple executors were created (+ _workflow_entry node)
assert "step1" in builder._executors
assert "step2" in builder._executors
assert "step3" in builder._executors
assert len(builder._executors) == 3
assert len(builder._executors) == 4
def test_workflow_executor_connectivity(self):
"""Test that executors are properly connected in sequence."""
@@ -243,8 +243,8 @@ class TestGraphWorkflowCheckpointing:
builder = DeclarativeWorkflowBuilder(yaml_def)
workflow = builder.build()
# Verify all executors exist
assert len(builder._executors) == 3
# Verify all executors exist (+ _workflow_entry node)
assert len(builder._executors) == 4
# Verify the workflow can be inspected
assert workflow is not None