Skip to main content

Class: NodeExecutor

Defined in: packages/agentos/src/orchestration/runtime/NodeExecutor.ts:194

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

Constructor

new NodeExecutor(deps): NodeExecutor

Defined in: packages/agentos/src/orchestration/runtime/NodeExecutor.ts:199

Parameters

deps

NodeExecutorDeps

External service adapters. All fields are optional; missing services cause graceful degradation rather than hard failures.

Returns

NodeExecutor

Methods

execute()

execute(node, state): Promise<NodeExecutionResult>

Defined in: packages/agentos/src/orchestration/runtime/NodeExecutor.ts:220

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>

Current (partial) graph state threaded from the runtime.

Returns

Promise<NodeExecutionResult>

A NodeExecutionResult describing the outcome.