# Type Alias NodeHandler

NodeHandler: (
state: Readonly<GraphState>,
ctx?: NodeContext,
) => Promise<NodeReturn>

Handler function for a graph node. Receives current state and an optional per-run context, returns either:

- `Partial<GraphState>` (legacy, common case) — merged via reducers
- `Command` — `update` portion is merged via reducers
- `Interrupt` — pauses the graph; emits checkpoint with interrupt metadata

The `ctx` parameter is optional — pre-#1895 handlers that take only `state` remain valid (additive widening).

#### Type Declaration

- - (state: Readonly<GraphState>, ctx?: NodeContext): Promise<NodeReturn>

  - #### Parameters

    - state: Readonly<GraphState>
    - `Optional` ctx: NodeContext

    #### Returns Promise<NodeReturn>

- Defined in packages/nexus-agents/src/orchestration/graph/graph-types.ts:194