fanout
nae.fanout ¶
Explicit parallel fan-out: a > fanout(b, c) > d is equivalent to
a > [b, c] > d. Returns a Branch (a single object), so it composes in a
chained > without relying on list semantics. Members may be chain tails
(e.g. fanout(b>c>d, e>f)).
The branches run concurrently; the join node (d) is deferred and runs once,
after every branch finishes.
Examples:
from nae import AgentNode, AgenticGraph, fanout
start = AgentNode(llm=llm, node_prompt="Restate the task.")
pros = AgentNode(llm=llm, node_prompt="List the pros.")
cons = AgentNode(llm=llm, node_prompt="List the cons.")
combine = AgentNode(llm=llm, node_prompt="Weigh the pros and cons.")
start > fanout(pros, cons) > combine
graph = AgenticGraph(start_node=start, end_nodes={combine})