Python: Introduce WorkflowAgent (#424)

* start a new implementation based on .net

* add response handling

* update init files

* remove handling of WorkflowCompletedEvent

* clean up implemenation

* fix bug

* update tests for merge_updates

* WorkflowAgent validation

* add a sample and fix bug

* revert pre-commit config

* revert pre-commit

* add human in the loop sample

* add comment

* fix type issue in Executor

* fix type errors and rename Executor.type to Executor.type_ with field alias

* fix test

---------

Co-authored-by: Chris <66376200+crickman@users.noreply.github.com>
This commit is contained in:
Eric Zhu
2025-09-02 06:25:03 -10:00
committed by GitHub
Unverified
parent 84b721ee40
commit 3577508a20
13 changed files with 1313 additions and 21 deletions
@@ -19,7 +19,7 @@ _IMPORTS = [
"WorkflowEvent",
"WorkflowStartedEvent",
"AgentRunEvent",
"AgentRunStreamingEvent",
"AgentRunUpdateEvent",
"handler",
"AgentExecutor",
"MagenticAgentDeltaEvent",
@@ -35,6 +35,7 @@ _IMPORTS = [
"RequestInfoMessage",
"WorkflowRunResult",
"Workflow",
"WorkflowAgent",
"WorkflowViz",
"FileCheckpointStorage",
"InMemoryCheckpointStorage",
@@ -5,7 +5,7 @@ from agent_framework_workflow import (
AgentExecutorRequest,
AgentExecutorResponse,
AgentRunEvent,
AgentRunStreamingEvent,
AgentRunUpdateEvent,
Case,
CheckpointStorage,
Default,
@@ -31,6 +31,7 @@ from agent_framework_workflow import (
SubWorkflowRequestInfo,
SubWorkflowResponse,
Workflow,
WorkflowAgent,
WorkflowBuilder,
WorkflowCheckpoint,
WorkflowCompletedEvent,
@@ -50,7 +51,7 @@ __all__ = [
"AgentExecutorRequest",
"AgentExecutorResponse",
"AgentRunEvent",
"AgentRunStreamingEvent",
"AgentRunUpdateEvent",
"Case",
"CheckpointStorage",
"Default",
@@ -69,7 +70,6 @@ __all__ = [
"MagenticProgressLedger",
"MagenticProgressLedgerItem",
"RequestInfoEvent",
"RequestInfoEvent",
"RequestInfoExecutor",
"RequestInfoMessage",
"RequestResponse",
@@ -77,6 +77,7 @@ __all__ = [
"SubWorkflowRequestInfo",
"SubWorkflowResponse",
"Workflow",
"WorkflowAgent",
"WorkflowBuilder",
"WorkflowCheckpoint",
"WorkflowCompletedEvent",