Stateless executor that dispatches a GraphNode to the appropriate handler.

One NodeExecutor instance is typically shared across the lifetime of a GraphRuntime and reused for every node invocation within every run. All state is passed through GraphState and returned via NodeExecutionResult.

Example

const executor = new NodeExecutor({ toolOrchestrator, guardrailEngine });
const result = await executor.execute(node, graphState);
if (!result.success) console.error(result.error);

Constructors

Methods

Constructors

Methods

  • Execute node against the provided state, optionally racing against a timeout.

    If node.timeout is set, execution races against a timer that resolves with a success: false result after the specified number of milliseconds.

    For human nodes with an onTimeout directive, the timeout result is modified:

    • 'accept' — auto-accept on timeout.
    • 'reject' — auto-reject on timeout.
    • 'error' — standard timeout error (default behaviour for all node types).

    Parameters

    • node: GraphNode

      Immutable node descriptor from the compiled graph IR.

    • state: Partial<GraphState<unknown, unknown, unknown>>

      Current (partial) graph state threaded from the runtime.

    Returns Promise<NodeExecutionResult>

    A NodeExecutionResult describing the outcome.