From db61d294a675c0c5559af1e8832cf05fee241809 Mon Sep 17 00:00:00 2001 From: Tat Dat Duong Date: Wed, 9 Oct 2024 01:00:06 +0200 Subject: [PATCH] Code review --- libs/langgraph/langgraph/pregel/utils.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libs/langgraph/langgraph/pregel/utils.py b/libs/langgraph/langgraph/pregel/utils.py index 3f5fe54d1..bb98cf63b 100644 --- a/libs/langgraph/langgraph/pregel/utils.py +++ b/libs/langgraph/langgraph/pregel/utils.py @@ -26,11 +26,16 @@ def get_new_channel_versions( def find_subgraph_pregel(candidate: Runnable) -> Optional[Runnable]: + from langgraph.pregel import Pregel + candidates: list[Runnable] = [candidate] for c in candidates: - # Cannot do isinstance(c, Pregel) due to circular imports - if "Pregel" in [t.__name__ for t in type(c).__mro__]: + if ( + isinstance(c, Pregel) + # subgraphs that disabled checkpointing are not considered + and candidate.checkpointer is not False + ): return c elif isinstance(c, RunnableSequence) or isinstance(c, RunnableSeq): candidates.extend(c.steps)