Skip to content

Commit 0f3f4db

Browse files
authored
[BREAKING] Python: Refactor workflow events to unified discriminated union pattern (#3690)
* Refactor events * Merge main * Fixes * Cleanup * Update samples and tests * Remove unused imports * PR feedback * Merge main. Add properties for events to help typing * Formatting * Cleanup * use builtins.type to avoid shadowing by WorkflowEvent.type attribute * Final improvements
1 parent 09f59b2 commit 0f3f4db

File tree

127 files changed

+1634
-1691
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+1634
-1691
lines changed

python/packages/core/agent_framework/_tools.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2135,6 +2135,9 @@ def get_response(
21352135
filtered_kwargs = {k: v for k, v in kwargs.items() if k != "thread"}
21362136
# Make options mutable so we can update conversation_id during function invocation loop
21372137
mutable_options: dict[str, Any] = dict(options) if options else {}
2138+
# Remove additional_function_arguments from options passed to underlying chat client
2139+
# It's for tool invocation only and not recognized by chat service APIs
2140+
mutable_options.pop("additional_function_arguments", None)
21382141

21392142
if not stream:
21402143

python/packages/core/agent_framework/_workflows/__init__.py

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,11 @@
3131
)
3232
from ._edge_runner import create_edge_runner
3333
from ._events import (
34-
ExecutorCompletedEvent,
35-
ExecutorEvent,
36-
ExecutorFailedEvent,
37-
ExecutorInvokedEvent,
38-
RequestInfoEvent,
39-
SuperStepCompletedEvent,
40-
SuperStepStartedEvent,
4134
WorkflowErrorDetails,
4235
WorkflowEvent,
4336
WorkflowEventSource,
44-
WorkflowFailedEvent,
45-
WorkflowLifecycleEvent,
46-
WorkflowOutputEvent,
37+
WorkflowEventType,
4738
WorkflowRunState,
48-
WorkflowStartedEvent,
49-
WorkflowStatusEvent,
5039
)
5140
from ._exceptions import (
5241
WorkflowCheckpointException,
@@ -96,10 +85,6 @@
9685
"EdgeCondition",
9786
"EdgeDuplicationError",
9887
"Executor",
99-
"ExecutorCompletedEvent",
100-
"ExecutorEvent",
101-
"ExecutorFailedEvent",
102-
"ExecutorInvokedEvent",
10388
"FanInEdgeGroup",
10489
"FanOutEdgeGroup",
10590
"FileCheckpointStorage",
@@ -108,14 +93,11 @@
10893
"InMemoryCheckpointStorage",
10994
"InProcRunnerContext",
11095
"Message",
111-
"RequestInfoEvent",
11296
"Runner",
11397
"RunnerContext",
11498
"SingleEdgeGroup",
11599
"SubWorkflowRequestMessage",
116100
"SubWorkflowResponseMessage",
117-
"SuperStepCompletedEvent",
118-
"SuperStepStartedEvent",
119101
"SwitchCaseEdgeGroup",
120102
"SwitchCaseEdgeGroupCase",
121103
"SwitchCaseEdgeGroupDefault",
@@ -132,16 +114,12 @@
132114
"WorkflowErrorDetails",
133115
"WorkflowEvent",
134116
"WorkflowEventSource",
117+
"WorkflowEventType",
135118
"WorkflowException",
136119
"WorkflowExecutor",
137-
"WorkflowFailedEvent",
138-
"WorkflowLifecycleEvent",
139-
"WorkflowOutputEvent",
140120
"WorkflowRunResult",
141121
"WorkflowRunState",
142122
"WorkflowRunnerException",
143-
"WorkflowStartedEvent",
144-
"WorkflowStatusEvent",
145123
"WorkflowValidationError",
146124
"WorkflowViz",
147125
"create_edge_runner",

0 commit comments

Comments
 (0)