From 3f43e0d94597d2da8f8504cd02f83febde814450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mihai=20Capot=C4=83?= Date: Mon, 22 Jul 2024 15:55:19 -0700 Subject: [PATCH] Fix StateGraph.add_edge end_key check 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. --- libs/langgraph/langgraph/graph/state.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/langgraph/langgraph/graph/state.py b/libs/langgraph/langgraph/graph/state.py index 96ad8e513..bfc60b09e 100644 --- a/libs/langgraph/langgraph/graph/state.py +++ b/libs/langgraph/langgraph/graph/state.py @@ -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")