Interface NodeExecutor

All Known Implementing Classes:
CodeExecutor, CsvExecutor, DatabaseExecutor, EmailSendExecutor, EmbeddingExecutor, ExecuteCommandExecutor, FileTriggerExecutor, FilterExecutor, HttpRequestExecutor, IfExecutor, LlmChatExecutor, LoopExecutor, ManualTriggerExecutor, MergeExecutor, ParallelExecutor, RagExecutor, RateLimitExecutor, RetryExecutor, ScheduleTriggerExecutor, SetExecutor, SlackExecutor, SortExecutor, SubworkflowExecutor, SwitchExecutor, TextClassifierExecutor, TryCatchExecutor, WebhookTriggerExecutor

public interface NodeExecutor
Core interface for defining workflow node execution logic.

Each node type in a workflow (e.g., "httpRequest", "if", "code") must have a corresponding implementation of this interface registered in the NodeExecutorRegistry. The execution engine invokes execute(Node, Map, ExecutionService.ExecutionContext) when the workflow flow reaches the node.

Contract

  1. Input: Receives execution context and aggregated data from previous nodes.
  2. Output: Returns a Map of data that becomes the input for subsequent nodes.
  3. State: Implementations should be stateless regarding workflow instance data. Use the context to access shared state if absolutely necessary.
  4. Errors: Should throw NodeExecutionException for anticipated failures to allow the engine to handle retries or error flows.

Thread Safety

Implementations must be thread-safe as a single instance is shared across all executing workflows. Avoid mutable instance fields.

  • Method Details

    • execute

      Map<String,Object> execute(ai.nervemind.common.domain.Node node, Map<String,Object> input, ExecutionService.ExecutionContext context)
      Executes the business logic for this node type.
      Parameters:
      node - The node definition containing parameters and configuration. Use Node.parameters() to access user settings.
      input - Combined output from all upstream nodes that connected to this node. For simple flows, this contains the direct predecessor's output. For merge nodes, it contains combined data.
      context - Verification context providing access to workflow-scoped services, logger, and execution metadata.
      Returns:
      A Map containing the results of this node's execution. Keys in this map become available variables for downstream nodes.
      Note: Returning null is treated as an empty map.
      Throws:
      RuntimeException - If execution fails. The engine will catch this and determine whether to retry or fail the workflow based on policy.
    • getNodeType

      String getNodeType()
      Unique identifier for the node type this executor handles. This must match the 'type' field in the JSON definition of the node.
      Returns:
      The unique type string (e.g., "httpRequest", "llmChat").