diff --git a/libs/langgraph/langgraph/pregel/_loop.py b/libs/langgraph/langgraph/pregel/_loop.py index 9c6c44d20..3583b6ff1 100644 --- a/libs/langgraph/langgraph/pregel/_loop.py +++ b/libs/langgraph/langgraph/pregel/_loop.py @@ -904,7 +904,11 @@ class PregelLoop: ) } ] - self._emit("updates", lambda: iter(interrupts)) + stream_modes = self.stream.modes if self.stream else [] + if "updates" in stream_modes: + self._emit("updates", lambda: iter(interrupts)) + elif "values" in stream_modes: + self._emit("values", lambda: iter(interrupts)) elif writes[0][0] != ERROR: self._emit( "updates", diff --git a/libs/langgraph/tests/test_pregel.py b/libs/langgraph/tests/test_pregel.py index c01163794..b9d2b641c 100644 --- a/libs/langgraph/tests/test_pregel.py +++ b/libs/langgraph/tests/test_pregel.py @@ -8430,3 +8430,22 @@ def test_null_resume_disallowed_with_multiple_interrupts( "text_1": "resume for prompt: original text 1", "text_2": "resume for prompt: original text 2", } + + +def test_interrupt_stream_mode_values(): + """Test that interrupts are surfaced when steam_mode='values'""" + + class State(TypedDict): + human_input: str + + def human_input_node(state: State) -> Command: + human_input = interrupt("interrupt") + return Command(update={"human_input": human_input}) + + builder = StateGraph(State) + builder.add_node(human_input_node) + builder.add_edge(START, "human_input_node") + app = builder.compile() + + result = [*app.stream(State(), stream_mode="values")] + assert "__interrupt__" in result[-1]