Allow same-name channels and nodes in StateGraph (#4944)

This commit is contained in:
Nuno Campos
2025-06-03 16:15:07 -07:00
committed by GitHub
-4
View File
@@ -369,8 +369,6 @@ class StateGraph(Generic[StateT, InputT]):
If a dict is provided, the keys will be used as the target node names and the values will be used as the labels for the edges.
If a tuple is provided, the values will be used as the target node names.
NOTE: this is only used for graph rendering and doesn't have any effect on the graph execution.
Raises:
ValueError: If the key is already being used as a state key.
Example:
```python
@@ -410,8 +408,6 @@ class StateGraph(Generic[StateT, InputT]):
raise ValueError(
"Node name must be provided if action is not a function"
)
if node in self.channels:
raise ValueError(f"'{node}' is already being used as a state key")
if self.compiled:
logger.warning(
"Adding a node to a graph that has already been compiled. This will "