Python: [BREAKING] Python: Rename workflow to workflows (#1007)

* Rename workflow to workflows

* Update occurence of workflow to new name
This commit is contained in:
Evan Mattson
2025-09-30 20:21:34 +09:00
committed by GitHub
Unverified
parent 189434dd4b
commit b42bb700fb
82 changed files with 87 additions and 90 deletions
@@ -20,4 +20,4 @@ from ._telemetry import * # noqa: F403
from ._threads import * # noqa: F403
from ._tools import * # noqa: F403
from ._types import * # noqa: F403
from ._workflow import * # noqa: F403
from ._workflows import * # noqa: F403
@@ -1,6 +1,6 @@
# Get Started with Microsoft Agent Framework Workflow
# Get Started with Microsoft Agent Framework Workflows
Workflow capabilities now ship with the core `agent-framework` package.
Workflow capabilities ship with the core `agent-framework` package.
```bash
pip install agent-framework
@@ -1,11 +1,14 @@
# Copyright (c) Microsoft. All rights reserved.
from dataclasses import dataclass
from dataclasses import dataclass # noqa: I001
from typing import Any, cast
from agent_framework._workflow._executor import RequestInfoMessage, RequestResponse
from agent_framework._workflow._runner_context import _decode_checkpoint_value, _encode_checkpoint_value # type: ignore
from agent_framework._workflow._typing_utils import is_instance_of
from agent_framework._workflows._executor import RequestInfoMessage, RequestResponse
from agent_framework._workflows._runner_context import ( # type: ignore
_decode_checkpoint_value, # type: ignore
_encode_checkpoint_value, # type: ignore
)
from agent_framework._workflows._typing_utils import is_instance_of
@dataclass(kw_only=True)
@@ -4,8 +4,8 @@ import pytest
from typing_extensions import Never
from agent_framework import WorkflowBuilder, WorkflowContext, WorkflowRunState, WorkflowStatusEvent, handler
from agent_framework._workflow._checkpoint import InMemoryCheckpointStorage
from agent_framework._workflow._executor import Executor
from agent_framework._workflows._checkpoint import InMemoryCheckpointStorage
from agent_framework._workflows._executor import Executor
class StartExecutor(Executor):
@@ -18,7 +18,7 @@ from agent_framework import (
WorkflowStatusEvent,
handler,
)
from agent_framework._workflow._checkpoint import InMemoryCheckpointStorage
from agent_framework._workflows._checkpoint import InMemoryCheckpointStorage
class _FakeAgentExec(Executor):
@@ -14,7 +14,7 @@ from agent_framework import (
WorkflowContext,
handler,
)
from agent_framework._workflow._edge import (
from agent_framework._workflows._edge import (
Edge,
FanInEdgeGroup,
FanOutEdgeGroup,
@@ -23,7 +23,7 @@ from agent_framework._workflow._edge import (
SwitchCaseEdgeGroupCase,
SwitchCaseEdgeGroupDefault,
)
from agent_framework._workflow._edge_runner import create_edge_runner
from agent_framework._workflows._edge_runner import create_edge_runner
from agent_framework.observability import EdgeGroupDeliveryStatus
# Add for test
@@ -627,7 +627,7 @@ async def test_source_edge_group_with_selection_func_send_message() -> None:
data = MockMessage(data="test")
message = Message(data=data, source_id=source.id)
with patch("agent_framework._workflow._edge_runner.EdgeRunner._execute_on_target") as mock_send:
with patch("agent_framework._workflows._edge_runner.EdgeRunner._execute_on_target") as mock_send:
success = await edge_runner.send_message(message, shared_state, ctx)
assert success is True
@@ -680,7 +680,7 @@ async def test_source_edge_group_with_selection_func_send_message_with_target()
data = MockMessage(data="test")
message = Message(data=data, source_id=source.id, target_id=target1.id)
with patch("agent_framework._workflow._edge_runner.EdgeRunner._execute_on_target") as mock_send:
with patch("agent_framework._workflows._edge_runner.EdgeRunner._execute_on_target") as mock_send:
success = await edge_runner.send_message(message, shared_state, ctx)
assert success is True
@@ -913,7 +913,7 @@ async def test_target_edge_group_send_message_buffer() -> None:
data = MockMessage(data="test")
with patch("agent_framework._workflow._edge_runner.EdgeRunner._execute_on_target") as mock_send:
with patch("agent_framework._workflows._edge_runner.EdgeRunner._execute_on_target") as mock_send:
success = await edge_runner.send_message(
Message(data=data, source_id=source1.id),
shared_state,
@@ -1262,7 +1262,7 @@ async def test_switch_case_edge_group_send_message() -> None:
data = MockMessage(data=-1)
message = Message(data=data, source_id=source.id)
with patch("agent_framework._workflow._edge_runner.EdgeRunner._execute_on_target") as mock_send:
with patch("agent_framework._workflows._edge_runner.EdgeRunner._execute_on_target") as mock_send:
success = await edge_runner.send_message(message, shared_state, ctx)
assert success is True
@@ -1271,7 +1271,7 @@ async def test_switch_case_edge_group_send_message() -> None:
# Default condition should
data = MockMessage(data=1)
message = Message(data=data, source_id=source.id)
with patch("agent_framework._workflow._edge_runner.EdgeRunner._execute_on_target") as mock_send:
with patch("agent_framework._workflows._edge_runner.EdgeRunner._execute_on_target") as mock_send:
success = await edge_runner.send_message(message, shared_state, ctx)
assert success is True
@@ -22,8 +22,8 @@ from agent_framework import (
WorkflowStatusEvent,
handler,
)
from agent_framework._workflow._executor import AgentExecutorResponse, Executor
from agent_framework._workflow._workflow_context import WorkflowContext
from agent_framework._workflows._executor import AgentExecutorResponse, Executor
from agent_framework._workflows._workflow_context import WorkflowContext
class _SimpleAgent(BaseAgent):
@@ -33,8 +33,8 @@ from agent_framework import (
WorkflowStatusEvent,
handler,
)
from agent_framework._workflow._checkpoint import InMemoryCheckpointStorage
from agent_framework._workflow._magentic import (
from agent_framework._workflows._checkpoint import InMemoryCheckpointStorage
from agent_framework._workflows._magentic import (
MagenticAgentExecutor,
MagenticContext,
MagenticOrchestratorExecutor,
@@ -533,7 +533,7 @@ async def _collect_agent_responses_setup(participant_obj: object):
captured: list[ChatMessage] = []
async def sink(event) -> None: # type: ignore[no-untyped-def]
from agent_framework._workflow._magentic import MagenticAgentMessageEvent
from agent_framework._workflows._magentic import MagenticAgentMessageEvent
if isinstance(event, MagenticAgentMessageEvent) and event.message is not None:
captured.append(event.message)
@@ -7,17 +7,21 @@ from typing import Any
import pytest
from agent_framework._workflow._checkpoint import CheckpointStorage, WorkflowCheckpoint
from agent_framework._workflow._events import RequestInfoEvent, WorkflowEvent
from agent_framework._workflow._executor import (
from agent_framework._workflows._checkpoint import CheckpointStorage, WorkflowCheckpoint
from agent_framework._workflows._events import RequestInfoEvent, WorkflowEvent
from agent_framework._workflows._executor import (
PendingRequestDetails,
RequestInfoExecutor,
RequestInfoMessage,
RequestResponse,
)
from agent_framework._workflow._runner_context import CheckpointState, Message, _encode_checkpoint_value # type: ignore
from agent_framework._workflow._shared_state import SharedState
from agent_framework._workflow._workflow_context import WorkflowContext
from agent_framework._workflows._runner_context import ( # type: ignore
CheckpointState,
Message,
_encode_checkpoint_value,
)
from agent_framework._workflows._shared_state import SharedState
from agent_framework._workflows._workflow_context import WorkflowContext
PENDING_STATE_KEY = RequestInfoExecutor._PENDING_SHARED_STATE_KEY # pyright: ignore[reportPrivateUsage]
@@ -16,10 +16,10 @@ from agent_framework import (
WorkflowStatusEvent,
handler,
)
from agent_framework._workflow._edge import SingleEdgeGroup
from agent_framework._workflow._runner import Runner
from agent_framework._workflow._runner_context import InProcRunnerContext, Message, RunnerContext
from agent_framework._workflow._shared_state import SharedState
from agent_framework._workflows._edge import SingleEdgeGroup
from agent_framework._workflows._runner import Runner
from agent_framework._workflows._runner_context import InProcRunnerContext, Message, RunnerContext
from agent_framework._workflows._shared_state import SharedState
@dataclass
@@ -21,7 +21,7 @@ from agent_framework import (
WorkflowStatusEvent,
handler,
)
from agent_framework._workflow._checkpoint import InMemoryCheckpointStorage
from agent_framework._workflows._checkpoint import InMemoryCheckpointStorage
class _EchoAgent(BaseAgent):
@@ -6,7 +6,7 @@ from typing import Any
import pytest
from agent_framework import Executor, WorkflowBuilder, WorkflowContext, handler
from agent_framework._workflow._edge import (
from agent_framework._workflows._edge import (
Case,
Default,
Edge,
@@ -17,7 +17,7 @@ from agent_framework._workflow._edge import (
SwitchCaseEdgeGroupCase,
SwitchCaseEdgeGroupDefault,
)
from agent_framework._workflow._workflow_executor import (
from agent_framework._workflows._workflow_executor import (
WorkflowExecutor,
)
@@ -3,8 +3,8 @@
from dataclasses import dataclass
from typing import Any, Generic, TypeVar, Union
from agent_framework._workflow import RequestInfoMessage, RequestResponse
from agent_framework._workflow._typing_utils import is_instance_of
from agent_framework._workflows import RequestInfoMessage, RequestResponse
from agent_framework._workflows._typing_utils import is_instance_of
def test_basic_types() -> None:
@@ -18,7 +18,7 @@ from agent_framework import (
handler,
validate_workflow_graph,
)
from agent_framework._workflow._edge import SingleEdgeGroup
from agent_framework._workflows._edge import SingleEdgeGroup
class StringExecutor(Executor):
@@ -21,15 +21,15 @@ from agent_framework import (
if TYPE_CHECKING:
from _pytest.logging import LogCaptureFixture
from agent_framework._workflow._runner_context import InProcRunnerContext
from agent_framework._workflows._runner_context import InProcRunnerContext
@asynccontextmanager
async def make_context(
executor_id: str = "exec",
) -> AsyncIterator[tuple[WorkflowContext[object], "InProcRunnerContext"]]:
from agent_framework._workflow._runner_context import InProcRunnerContext
from agent_framework._workflow._shared_state import SharedState
from agent_framework._workflows._runner_context import InProcRunnerContext
from agent_framework._workflows._shared_state import SharedState
runner_ctx = InProcRunnerContext()
shared_state = SharedState()
@@ -7,11 +7,11 @@ from opentelemetry import trace
from opentelemetry.sdk.trace.export.in_memory_span_exporter import InMemorySpanExporter
from agent_framework import WorkflowBuilder
from agent_framework._workflow._executor import Executor, handler
from agent_framework._workflow._runner_context import InProcRunnerContext, Message
from agent_framework._workflow._shared_state import SharedState
from agent_framework._workflow._workflow import Workflow
from agent_framework._workflow._workflow_context import WorkflowContext
from agent_framework._workflows._executor import Executor, handler
from agent_framework._workflows._runner_context import InProcRunnerContext, Message
from agent_framework._workflows._shared_state import SharedState
from agent_framework._workflows._workflow import Workflow
from agent_framework._workflows._workflow_context import WorkflowContext
from agent_framework.observability import (
OtelAttr,
create_processing_span,
@@ -5,7 +5,7 @@ from typing import cast
from agent_framework._agents import ChatAgent
from agent_framework._types import AgentRunResponse, ChatMessage, Role
from agent_framework._workflow import (
from agent_framework._workflows import (
AgentExecutor,
AgentExecutorRequest,
AgentExecutorResponse,