feat(fase4): add NodeExecutor architecture with basic nodes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Claude AI
2026-01-29 11:10:21 +00:00
parent 64b186314f
commit 835c4aa387
3 changed files with 120 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
from abc import ABC, abstractmethod
from typing import Optional, Any
from app.context import FlowContext
class NodeExecutor(ABC):
"""Base class for all node executors"""
@abstractmethod
async def execute(
self,
config: dict,
context: FlowContext,
session: Any
) -> Optional[str]:
"""
Execute the node logic.
Returns: branch name for routing (e.g., "default", "true", "false")
or "wait" to pause execution
"""
pass
class NodeRegistry:
"""Registry of all available node executors"""
_executors: dict = {}
@classmethod
def register(cls, node_type: str, executor: NodeExecutor):
cls._executors[node_type] = executor
@classmethod
def get(cls, node_type: str) -> Optional[NodeExecutor]:
return cls._executors.get(node_type)