From 7ab5788f25684ffa26f480e6c23dbc52f767c1cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menezes?= <77670471+menezesandre@users.noreply.github.com> Date: Fri, 7 Nov 2025 13:01:25 +0000 Subject: [PATCH] fix(langgraph): Unexpected behavior for stream_mode sequences that are not lists (#6354) ## Issue The `stream_mode` argument type includes `Sequence`, but it doesn't correctly support non-list sequences. On the other hand, the `print_mode` argument works as expected. ### Example ```python from langgraph.pregel.main import Pregel pregel = Pregel(nodes={}, channels=None, input_channels=[], output_channels=[], auto_validate=False) stream_modes, *_ = pregel._defaults( config={"recursion_limit": 1}, stream_mode=("values", "messages"), print_mode=("values"), output_keys=None, interrupt_before=None, interrupt_after=None, durability=None, ) print(stream_modes) # Expected `{'values', 'messages'}`, got `{('values', 'messages'), 'values'}` ``` --- libs/langgraph/langgraph/pregel/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/langgraph/langgraph/pregel/main.py b/libs/langgraph/langgraph/pregel/main.py index 89ed674fa..09b3e6517 100644 --- a/libs/langgraph/langgraph/pregel/main.py +++ b/libs/langgraph/langgraph/pregel/main.py @@ -2354,7 +2354,7 @@ class Pregel( validate_keys(output_keys, self.channels) interrupt_before = interrupt_before or self.interrupt_before_nodes interrupt_after = interrupt_after or self.interrupt_after_nodes - if not isinstance(stream_mode, list): + if isinstance(stream_mode, str): stream_modes = {stream_mode} else: stream_modes = set(stream_mode)