Skip to content

Commit

Permalink
Fix StateGraph.add_edge end_key check
Browse files Browse the repository at this point in the history
It looks like a typo to me: `END` should be `START`.

`END` should be accepted as `end_key` and it is accepted with the `super` call path.
  • Loading branch information
mihaic committed Jul 22, 2024
1 parent ab80c11 commit 3f43e0d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libs/langgraph/langgraph/graph/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,8 @@ def add_edge(self, start_key: Union[str, list[str]], end_key: str) -> None:
raise ValueError("END cannot be a start node")
if start not in self.nodes:
raise ValueError(f"Need to add_node `{start}` first")
if end_key == END:
raise ValueError("END cannot be an end node")
if end_key == START:
raise ValueError("START cannot be an end node")
if end_key not in self.nodes:
raise ValueError(f"Need to add_node `{end_key}` first")

Expand Down

0 comments on commit 3f43e0d

Please sign in to comment.