Add a conditional edge from the starting node to any number of destination nodes.
add_conditional_edges(
self,
source: str,
path: Callable[..., Hashable | Sequence[Hashable]] | Callable[..., Awaitable[Hashable | Sequence[Hashable]]] | Runnable[Any, Hashable | Sequence[Hashable]],
path_map: dict[Hashable, str] | list[str] | None = None
) -> SelfWithout type hints on the path function's return value (e.g., -> Literal["foo", "__end__"]:)
or a path_map, the graph visualization assumes the edge could transition to any node in the graph.
| Name | Type | Description |
|---|---|---|
source* | str | The starting node. This conditional edge will run when exiting this node. |
path* | Callable[..., Hashable | Sequence[Hashable]] | Callable[..., Awaitable[Hashable | Sequence[Hashable]]] | Runnable[Any, Hashable | Sequence[Hashable]] | The callable that determines the next node or nodes. If not specifying If it returns |
path_map | dict[Hashable, str] | list[str] | None | Default: NoneOptional mapping of paths to node names. If omitted the paths returned by |