diff --git a/libs/langgraph/langgraph/pregel/loop.py b/libs/langgraph/langgraph/pregel/loop.py index 452103c9e..45b8798af 100644 --- a/libs/langgraph/langgraph/pregel/loop.py +++ b/libs/langgraph/langgraph/pregel/loop.py @@ -197,6 +197,7 @@ class PregelLoop: specs: Mapping[str, Union[BaseChannel, ManagedValueSpec]], output_keys: Union[str, Sequence[str]], stream_keys: Union[str, Sequence[str]], + check_subgraphs: bool = True, debug: bool = False, ) -> None: self.stream = stream @@ -222,7 +223,7 @@ class PregelLoop: self.config = patch_configurable( self.config, {"checkpoint_ns": "", "checkpoint_id": None} ) - if self.is_nested and self.checkpointer is not None: + if check_subgraphs and self.is_nested and self.checkpointer is not None: if self.config["configurable"]["checkpoint_ns"] in _SEEN_CHECKPOINT_NS: raise MultipleSubgraphsError else: @@ -641,6 +642,7 @@ class SyncPregelLoop(PregelLoop, ContextManager): specs: Mapping[str, Union[BaseChannel, ManagedValueSpec]], output_keys: Union[str, Sequence[str]] = EMPTY_SEQ, stream_keys: Union[str, Sequence[str]] = EMPTY_SEQ, + check_subgraphs: bool = True, debug: bool = False, ) -> None: super().__init__( @@ -653,6 +655,7 @@ class SyncPregelLoop(PregelLoop, ContextManager): specs=specs, output_keys=output_keys, stream_keys=stream_keys, + check_subgraphs=check_subgraphs, debug=debug, ) self.stack = ExitStack() @@ -762,6 +765,7 @@ class AsyncPregelLoop(PregelLoop, AsyncContextManager): specs: Mapping[str, Union[BaseChannel, ManagedValueSpec]], output_keys: Union[str, Sequence[str]] = EMPTY_SEQ, stream_keys: Union[str, Sequence[str]] = EMPTY_SEQ, + check_subgraphs: bool = True, debug: bool = False, ) -> None: super().__init__( @@ -774,6 +778,7 @@ class AsyncPregelLoop(PregelLoop, AsyncContextManager): specs=specs, output_keys=output_keys, stream_keys=stream_keys, + check_subgraphs=check_subgraphs, debug=debug, ) self.store = AsyncBatchedStore(self.store) if self.store else None diff --git a/libs/scheduler-kafka/langgraph/scheduler/kafka/orchestrator.py b/libs/scheduler-kafka/langgraph/scheduler/kafka/orchestrator.py index 097429bb6..a94a3bd0a 100644 --- a/libs/scheduler-kafka/langgraph/scheduler/kafka/orchestrator.py +++ b/libs/scheduler-kafka/langgraph/scheduler/kafka/orchestrator.py @@ -158,6 +158,7 @@ class AsyncKafkaOrchestrator(AbstractAsyncContextManager): specs=graph.channels, output_keys=graph.output_channels, stream_keys=graph.stream_channels, + check_subgraphs=False, ) as loop: if loop.tick( input_keys=graph.input_channels,