diff --git a/api/core/workflow/graph_engine/event_management/event_manager.py b/api/core/workflow/graph_engine/event_management/event_manager.py index d34f4e032b..6f37193070 100644 --- a/api/core/workflow/graph_engine/event_management/event_manager.py +++ b/api/core/workflow/graph_engine/event_management/event_manager.py @@ -9,7 +9,7 @@ from typing import final from core.workflow.graph_events import GraphEngineEvent -from ..layers.base import Layer +from ..layers.base import GraphEngineLayer @final @@ -104,10 +104,10 @@ class EventManager: """Initialize the event manager.""" self._events: list[GraphEngineEvent] = [] self._lock = ReadWriteLock() - self._layers: list[Layer] = [] + self._layers: list[GraphEngineLayer] = [] self._execution_complete = threading.Event() - def set_layers(self, layers: list[Layer]) -> None: + def set_layers(self, layers: list[GraphEngineLayer]) -> None: """ Set the layers to notify on event collection. diff --git a/api/core/workflow/graph_engine/graph_engine.py b/api/core/workflow/graph_engine/graph_engine.py index 833cee0ffe..7fd2825020 100644 --- a/api/core/workflow/graph_engine/graph_engine.py +++ b/api/core/workflow/graph_engine/graph_engine.py @@ -33,7 +33,7 @@ from .entities.commands import AbortCommand from .error_handling import ErrorHandler from .event_management import EventHandler, EventManager from .graph_traversal import EdgeProcessor, SkipPropagator -from .layers.base import Layer +from .layers.base import GraphEngineLayer from .orchestration import Dispatcher, ExecutionCoordinator from .protocols.command_channel import CommandChannel from .response_coordinator import ResponseStreamCoordinator @@ -221,7 +221,7 @@ class GraphEngine: # === Extensibility === # Layers allow plugins to extend engine functionality - self._layers: list[Layer] = [] + self._layers: list[GraphEngineLayer] = [] # === Validation === # Ensure all nodes share the same GraphRuntimeState instance @@ -234,7 +234,7 @@ class GraphEngine: if id(node.graph_runtime_state) != expected_state_id: raise ValueError(f"GraphRuntimeState consistency violation: Node '{node.id}' has a different instance") - def layer(self, layer: Layer) -> "GraphEngine": + def layer(self, layer: GraphEngineLayer) -> "GraphEngine": """Add a layer for extending functionality.""" self._layers.append(layer) return self diff --git a/api/core/workflow/graph_engine/layers/__init__.py b/api/core/workflow/graph_engine/layers/__init__.py index 4749c74044..0a29a52993 100644 --- a/api/core/workflow/graph_engine/layers/__init__.py +++ b/api/core/workflow/graph_engine/layers/__init__.py @@ -5,12 +5,12 @@ This module provides the layer infrastructure for extending GraphEngine function with middleware-like components that can observe events and interact with execution. """ -from .base import Layer +from .base import GraphEngineLayer from .debug_logging import DebugLoggingLayer from .execution_limits import ExecutionLimitsLayer __all__ = [ "DebugLoggingLayer", "ExecutionLimitsLayer", - "Layer", + "GraphEngineLayer", ] diff --git a/api/core/workflow/graph_engine/layers/base.py b/api/core/workflow/graph_engine/layers/base.py index febdc3de6d..9899d46016 100644 --- a/api/core/workflow/graph_engine/layers/base.py +++ b/api/core/workflow/graph_engine/layers/base.py @@ -12,7 +12,7 @@ from core.workflow.graph_engine.protocols.command_channel import CommandChannel from core.workflow.graph_events import GraphEngineEvent -class Layer(ABC): +class GraphEngineLayer(ABC): """ Abstract base class for GraphEngine layers. diff --git a/api/core/workflow/graph_engine/layers/debug_logging.py b/api/core/workflow/graph_engine/layers/debug_logging.py index 42bacfa474..ddfdfa0edd 100644 --- a/api/core/workflow/graph_engine/layers/debug_logging.py +++ b/api/core/workflow/graph_engine/layers/debug_logging.py @@ -33,11 +33,11 @@ from core.workflow.graph_events import ( NodeRunSucceededEvent, ) -from .base import Layer +from .base import GraphEngineLayer @final -class DebugLoggingLayer(Layer): +class DebugLoggingLayer(GraphEngineLayer): """ A layer that provides comprehensive logging of GraphEngine execution. diff --git a/api/core/workflow/graph_engine/layers/execution_limits.py b/api/core/workflow/graph_engine/layers/execution_limits.py index 6cc0c1305a..d74dc9b082 100644 --- a/api/core/workflow/graph_engine/layers/execution_limits.py +++ b/api/core/workflow/graph_engine/layers/execution_limits.py @@ -16,7 +16,7 @@ from typing import final from typing_extensions import override from core.workflow.graph_engine.entities.commands import AbortCommand, CommandType -from core.workflow.graph_engine.layers import Layer +from core.workflow.graph_engine.layers import GraphEngineLayer from core.workflow.graph_events import ( GraphEngineEvent, NodeRunStartedEvent, @@ -32,7 +32,7 @@ class LimitType(Enum): @final -class ExecutionLimitsLayer(Layer): +class ExecutionLimitsLayer(GraphEngineLayer): """ Layer that enforces execution limits for workflows.