Skip to main content

Module node

Module node 

Source
Expand description

Node abstractions: the unit of computation in the graph.

A node is an async computation that:

  1. Receives a NodeContext — an immutable snapshot of the shared state as of the start of the current super-step, plus run configuration and interrupt/resume helpers.
  2. Returns a NodeOutput — a partial state update (never the whole state) plus an optional Command for dynamic routing.

Because nodes only ever see the snapshot from the super-step start, nodes running in the same super-step can never observe each other’s writes — the barrier is what makes shared-state parallelism safe.

Any async closure Fn(NodeContext) -> impl Future<Output = Result<NodeOutput>> automatically implements Node via a blanket impl.

Structs§

Command
Dynamic routing + resume directive, unifying state transition and control flow (the LangGraph Command).
NodeConfig
Per-run, per-node configuration handed to every node invocation.
NodeContext
The input to every node invocation.
NodeOutput
The output of a node: partial state updates plus optional dynamic routing.

Traits§

Node
The node trait: an async unit of computation over shared state.