[PR #5836] fix(langgraph): support emitting messages from subgraphs when messages mode explicitly requested #4675

Closed
opened 2026-02-20 17:50:34 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langchain-ai/langgraph/pull/5836

State: closed
Merged: Yes


Reproduces: https://github.com/langchain-ai/langgraph/issues/5249#issuecomment-3156519635
Caused after this change: https://github.com/langchain-ai/langgraph/pull/4843

Fix to allow emitting messages from subgraphs if the subgraphs explicitly used a stream mode "messages".


def node_in_parent(...):
   # subgraph was called as a function.
   # messages are explicitly requested.
   for event in subgraph.stream(..., stream_mode="messages"):
      # something is done with `event`
   return ...

# subgraphs = False!
parent_graph.invoke(..., subgraphs=False)

The code above should continue to work correctly regardless of the value of subgraphs as streaming messages was requested explicitly in the parent node!

**Original Pull Request:** https://github.com/langchain-ai/langgraph/pull/5836 **State:** closed **Merged:** Yes --- Reproduces: https://github.com/langchain-ai/langgraph/issues/5249#issuecomment-3156519635 Caused after this change: https://github.com/langchain-ai/langgraph/pull/4843 Fix to allow emitting messages from subgraphs if the subgraphs explicitly used a stream mode "messages". ```python def node_in_parent(...): # subgraph was called as a function. # messages are explicitly requested. for event in subgraph.stream(..., stream_mode="messages"): # something is done with `event` return ... # subgraphs = False! parent_graph.invoke(..., subgraphs=False) ``` The code above should continue to work correctly regardless of the value of subgraphs as streaming messages was requested explicitly in the parent node!
yindo added the pull-request label 2026-02-20 17:50:34 -05:00
yindo closed this issue 2026-02-20 17:50:34 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#4675