|
```python |
|
from agent_framework import WorkflowBuilder |
|
|
|
builder = WorkflowBuilder() |
|
builder.set_start_executor(splitter_executor) |
|
builder.add_fan_out_edges(splitter_executor, [worker1, worker2, worker3]) |
|
workflow = builder.build() |
|
|
|
# Send to specific targets based on partitioner function |
|
builder = WorkflowBuilder() |
|
builder.set_start_executor(splitter_executor) |
|
builder.add_fan_out_edges( |
|
splitter_executor, |
|
[worker1, worker2, worker3], |
|
selection_func=lambda message, target_ids: ( |
|
[0] if message.priority == Priority.HIGH else |
|
[1, 2] if message.priority == Priority.NORMAL else |
|
list(range(target_count)) |
|
) |
|
) |
|
workflow = builder.build() |
|
``` |
The Python example in the Edges guide shows add_fan_out_edges(..., selection_func=...), but this parameter does not exist in the actual Python SDK.
According to the Python API reference, add_fan_out_edges does not support selection_func. Selection logic in Python is handled by a different API (add_multi_selection_edge_group).
The documentation and the real Python API surface are inconsistent.
References
Edges guide (problematic example):
https://learn.microsoft.com/en-us/agent-framework/user-guide/workflows/core-concepts/edges?pivots=programming-language-python
Python API spec for add_fan_out_edges:
https://learn.microsoft.com/en-us/python/api/agent-framework-core/agent_framework.workflowbuilder?view=agent-framework-python-latest#agent-framework-workflowbuilder-add-fan-out-edges
semantic-kernel-docs/agent-framework/user-guide/workflows/core-concepts/edges.md
Lines 174 to 195 in 56dbe96
The Python example in the Edges guide shows
add_fan_out_edges(..., selection_func=...), but this parameter does not exist in the actual Python SDK.According to the Python API reference,
add_fan_out_edgesdoes not supportselection_func. Selection logic in Python is handled by a different API (add_multi_selection_edge_group).The documentation and the real Python API surface are inconsistent.
References
Edges guide (problematic example):
https://learn.microsoft.com/en-us/agent-framework/user-guide/workflows/core-concepts/edges?pivots=programming-language-python
Python API spec for
add_fan_out_edges:https://learn.microsoft.com/en-us/python/api/agent-framework-core/agent_framework.workflowbuilder?view=agent-framework-python-latest#agent-framework-workflowbuilder-add-fan-out-edges