Skip to content

Branch & Spread

nae.node.Branch

Branch(tails: list)

Group returned by node > [a, b, ...]; its members are branch tails, and its > wires the fan-in/join.

Hold the fan-out branches (tails) so the next > can join them.

Parameters:

Name Type Description Default
tails list

The branch nodes (each may be a chain tail such as b > c).

required

__gt__

__gt__(join)

Wire every branch tail into join (the fan-in).

Points each tail's child at join and marks join a deferred join so it runs once, after all branches complete (see graph.py). Returns join so the chain continues.

nae.node.Spread

Spread(worker: Node, field: str)

Map-reduce wrapper: worker.map(field) fans worker across state[field] via LangGraph Send, joining into the collector wired by > collector. Built specially in AgenticGraph._build_graph — a Spread has no graph identity of its own; the worker is the real node.

Capture the map-reduce intent from worker.map(field).

Parameters:

Name Type Description Default
worker Node

The node to run once per item of state[field].

required
field str

The state key whose items are fanned out (one Send each).

required

__gt__

__gt__(collector)

Wire the map's fan-in: all worker replies join into collector.

Records collector and marks it a deferred join so it runs exactly once, after every Send-fanned worker has finished. Returns collector.