UI messages from nested agents don't stream after interrupt/resume #1006

Closed
opened 2026-02-20 17:42:42 -05:00 by yindo · 1 comment
Owner

Originally created by @ava6969 on GitHub (Oct 11, 2025).

Checked other resources

  • This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/).
  • I added a clear and detailed title that summarizes the issue.
  • I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example).
  • I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue.

Example Code

from langgraph.graph import StateGraph
  from langgraph.types import interrupt
  from langchain_core.messages import HumanMessage
  from langgraph.graph.ui import push_ui_message
  from langchain.agents import create_agent
  from langchain_anthropic import ChatAnthropic

  # Sub-agent that pushes UI messages
  def create_sub_agent():
      model = ChatAnthropic(model="claude-3-5-sonnet-20241022")

      def push_ui_tool(state):
          # Push UI message to parent_message context
          ai_msg = state.get("parent_message")
          push_ui_message(
              "sub_agent_ui_message",
              {"data": "This should appear in frontend"},
              message=ai_msg
          )
          return {"messages": [HumanMessage(content="Sub-agent completed")]}

      return create_agent(
          model=model,
          tools=[],
          state_modifier=push_ui_tool
      )

  # Main agent with interrupt
  def main_agent_node(state):
      # Ask for approval - this creates an interrupt
      response = interrupt({
          "question": "Proceed with sub-agent?",
          "type": "approval"
      })

      # After resume, call sub-agent
      sub_agent = create_sub_agent()
      ai_msg = state["messages"][-1]  # Current AI message

      result = sub_agent.invoke({
          "messages": [HumanMessage(content="Execute sub-agent")],
          "parent_message": ai_msg
      })

      # Propagate UI messages from sub-agent
      return {
          "ui": result.get("ui", []),
          "messages": result["messages"]
      }

  # Build graph
  builder = StateGraph(dict)
  builder.add_node("main_agent", main_agent_node)
  builder.set_entry_point("main_agent")
  graph = builder.compile()

  # Execute
  result = graph.invoke({"messages": [HumanMessage(content="Start")]})
  # User approves interrupt
  result = graph.invoke(None, config={"configurable": {"thread_id": "test"}})

  # BUG: UI message from sub-agent doesn't appear in streamed updates
  # Frontend never receives "sub_agent_ui_message"

Error Message and Stack Trace (if applicable)

No error is raised, but UI messages are silently dropped.

  Expected behavior:
  - UI messages from nested agents should stream to client after interrupt/resume
  - Frontend should receive "sub_agent_ui_message" in values.ui array

  Actual behavior:
  - UI messages are created (visible in backend logs)
  - Propagated via Command(update={"ui": result.get("ui", [])})
  - But NOT streamed to LangGraph Studio/client
  - Frontend values.ui array doesn't contain the message

  Evidence from production:
  - Backend: push_ui_message() returns successfully with ID
  - Frontend: Message never appears in stream updates
  - Only happens AFTER interrupt/resume - pre-interrupt UI works fine

Description

When using interrupt() in the main agent, UI messages created by nested sub-agents after the resume don't stream to the client. The messages are created and propagated correctly in the state, but the streaming mechanism doesn't send them to the frontend.

Impact:

  • Real-time progress indicators from sub-agents don't work
  • UI components that depend on immediate message delivery fail
  • Forces workarounds like avoiding interrupts entirely

Environment:

  • LangGraph version: [your version]
  • Python version: [your version]
  • Using LangGraph Studio or custom client

System Info

System Information

OS: Linux
OS Version: #85-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 18 15:26:59 UTC 2025
Python Version: 3.12.3 (main, Aug 14 2025, 17:47:21) [GCC 13.3.0]

Package Information

langchain_core: 0.3.77
langchain: 1.0.0a10
langchain_community: 0.3.30
langsmith: 0.4.8
langchain_anthropic: 0.3.21
langchain_exa: 0.3.1
langchain_openai: 0.3.34
langchain_text_splitters: 0.3.11
langgraph_api: 0.4.38
langgraph_cli: 0.4.2
langgraph_license: Installed. No version info available.
langgraph_runtime: Installed. No version info available.
langgraph_runtime_inmem: 0.14.1
langgraph_sdk: 0.2.9
langgraph_supervisor: 0.0.29

Optional packages not installed

langserve

Other Dependencies

aiohttp<4.0.0,>=3.8.3: Installed. No version info available.
anthropic<1.0.0,>=0.69.0: Installed. No version info available.
blockbuster<2.0.0,>=1.5.24: Installed. No version info available.
click>=8.1.7: Installed. No version info available.
cloudpickle>=3.0.0: Installed. No version info available.
cryptography<45.0,>=42.0.0: Installed. No version info available.
dataclasses-json<0.7.0,>=0.6.7: Installed. No version info available.
exa-py<2.0.0,>=1.0.8: Installed. No version info available.
grpcio-tools<2.0.0,>=1.75.0: Installed. No version info available.
grpcio<2.0.0,>=1.75.0: Installed. No version info available.
httpx: 0.28.1
httpx-sse<1.0.0,>=0.4.0: Installed. No version info available.
httpx>=0.25.0: Installed. No version info available.
httpx>=0.25.2: Installed. No version info available.
jsonpatch<2.0.0,>=1.33.0: Installed. No version info available.
jsonschema-rs<0.30,>=0.20.0: Installed. No version info available.
langchain-anthropic;: Installed. No version info available.
langchain-aws;: Installed. No version info available.
langchain-azure-ai;: Installed. No version info available.
langchain-cohere;: Installed. No version info available.
langchain-community;: Installed. No version info available.
langchain-core<1.0.0,>=0.3.76: Installed. No version info available.
langchain-core<2.0.0,>=0.3.75: Installed. No version info available.
langchain-core<2.0.0,>=0.3.76: Installed. No version info available.
langchain-core<2.0.0,>=0.3.77: Installed. No version info available.
langchain-core>=0.3.40: Installed. No version info available.
langchain-core>=0.3.64: Installed. No version info available.
langchain-deepseek;: Installed. No version info available.
langchain-fireworks;: Installed. No version info available.
langchain-google-genai;: Installed. No version info available.
langchain-google-vertexai;: Installed. No version info available.
langchain-groq;: Installed. No version info available.
langchain-huggingface;: Installed. No version info available.
langchain-mistralai;: Installed. No version info available.
langchain-ollama;: Installed. No version info available.
langchain-openai;: Installed. No version info available.
langchain-perplexity;: Installed. No version info available.
langchain-text-splitters<2.0.0,>=0.3.11: Installed. No version info available.
langchain-together;: Installed. No version info available.
langchain-xai;: Installed. No version info available.
langchain<2.0.0,>=0.3.27: Installed. No version info available.
langgraph-api<0.5.0,>=0.3;: Installed. No version info available.
langgraph-checkpoint>=2.0.23: Installed. No version info available.
langgraph-checkpoint>=2.0.25: Installed. No version info available.
langgraph-runtime-inmem<0.15.0,>=0.14.0: Installed. No version info available.
langgraph-runtime-inmem>=0.7;: Installed. No version info available.
langgraph-sdk>=0.1.0;: Installed. No version info available.
langgraph-sdk>=0.2.0: Installed. No version info available.
langgraph<0.7.0,>=0.6.0: Installed. No version info available.
langgraph==1.0.0a4: Installed. No version info available.
langgraph>=0.2: Installed. No version info available.
langgraph>=0.4.0: Installed. No version info available.
langsmith-pyo3: Installed. No version info available.
langsmith<1.0.0,>=0.1.125: Installed. No version info available.
langsmith<1.0.0,>=0.3.45: Installed. No version info available.
langsmith>=0.3.45: Installed. No version info available.
numpy>=1.26.2;: Installed. No version info available.
numpy>=2.1.0;: Installed. No version info available.
openai-agents: Installed. No version info available.
openai<3.0.0,>=1.104.2: Installed. No version info available.
opentelemetry-api: 1.37.0
opentelemetry-api>=1.37.0: Installed. No version info available.
opentelemetry-exporter-otlp-proto-http: 1.37.0
opentelemetry-exporter-otlp-proto-http>=1.37.0: Installed. No version info available.
opentelemetry-sdk: 1.37.0
opentelemetry-sdk>=1.37.0: Installed. No version info available.
orjson: 3.11.0
orjson>=3.10.1: Installed. No version info available.
orjson>=3.9.7: Installed. No version info available.
packaging: 25.0
packaging<26.0.0,>=23.2.0: Installed. No version info available.
protobuf<7.0.0,>=6.32.1: Installed. No version info available.
pydantic: 2.11.9
pydantic-settings<3.0.0,>=2.10.1: Installed. No version info available.
pydantic<3.0.0,>=2.7.4: Installed. No version info available.
pyjwt>=2.9.0: Installed. No version info available.
pytest: 8.4.1
python-dotenv>=0.8.0;: Installed. No version info available.
PyYAML<7.0.0,>=5.3.0: Installed. No version info available.
requests: 2.32.5
requests-toolbelt: 1.0.0
requests<3.0.0,>=2.32.5: Installed. No version info available.
rich: Installed. No version info available.
SQLAlchemy<3.0.0,>=1.4.0: Installed. No version info available.
sse-starlette<2.2.0,>=2.1.0: Installed. No version info available.
sse-starlette>=2: Installed. No version info available.
starlette>=0.37: Installed. No version info available.
starlette>=0.38.6: Installed. No version info available.
structlog<26,>=24.1.0: Installed. No version info available.
structlog>23: Installed. No version info available.
tenacity!=8.4.0,<10.0.0,>=8.1.0: Installed. No version info available.
tenacity>=8.0.0: Installed. No version info available.
tiktoken<1.0.0,>=0.7.0: Installed. No version info available.
truststore>=0.1: Installed. No version info available.
typing-extensions<5.0.0,>=4.7.0: Installed. No version info available.
uvicorn>=0.26.0: Installed. No version info available.
watchfiles>=0.13: Installed. No version info available.
zstandard: 0.23.0

Originally created by @ava6969 on GitHub (Oct 11, 2025). ### Checked other resources - [x] This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/). - [x] I added a clear and detailed title that summarizes the issue. - [x] I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example). - [x] I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue. ### Example Code ```python from langgraph.graph import StateGraph from langgraph.types import interrupt from langchain_core.messages import HumanMessage from langgraph.graph.ui import push_ui_message from langchain.agents import create_agent from langchain_anthropic import ChatAnthropic # Sub-agent that pushes UI messages def create_sub_agent(): model = ChatAnthropic(model="claude-3-5-sonnet-20241022") def push_ui_tool(state): # Push UI message to parent_message context ai_msg = state.get("parent_message") push_ui_message( "sub_agent_ui_message", {"data": "This should appear in frontend"}, message=ai_msg ) return {"messages": [HumanMessage(content="Sub-agent completed")]} return create_agent( model=model, tools=[], state_modifier=push_ui_tool ) # Main agent with interrupt def main_agent_node(state): # Ask for approval - this creates an interrupt response = interrupt({ "question": "Proceed with sub-agent?", "type": "approval" }) # After resume, call sub-agent sub_agent = create_sub_agent() ai_msg = state["messages"][-1] # Current AI message result = sub_agent.invoke({ "messages": [HumanMessage(content="Execute sub-agent")], "parent_message": ai_msg }) # Propagate UI messages from sub-agent return { "ui": result.get("ui", []), "messages": result["messages"] } # Build graph builder = StateGraph(dict) builder.add_node("main_agent", main_agent_node) builder.set_entry_point("main_agent") graph = builder.compile() # Execute result = graph.invoke({"messages": [HumanMessage(content="Start")]}) # User approves interrupt result = graph.invoke(None, config={"configurable": {"thread_id": "test"}}) # BUG: UI message from sub-agent doesn't appear in streamed updates # Frontend never receives "sub_agent_ui_message" ``` ### Error Message and Stack Trace (if applicable) ```shell No error is raised, but UI messages are silently dropped. Expected behavior: - UI messages from nested agents should stream to client after interrupt/resume - Frontend should receive "sub_agent_ui_message" in values.ui array Actual behavior: - UI messages are created (visible in backend logs) - Propagated via Command(update={"ui": result.get("ui", [])}) - But NOT streamed to LangGraph Studio/client - Frontend values.ui array doesn't contain the message Evidence from production: - Backend: push_ui_message() returns successfully with ID - Frontend: Message never appears in stream updates - Only happens AFTER interrupt/resume - pre-interrupt UI works fine ``` ### Description When using interrupt() in the main agent, UI messages created by nested sub-agents after the resume don't stream to the client. The messages are created and propagated correctly in the state, but the streaming mechanism doesn't send them to the frontend. Impact: - Real-time progress indicators from sub-agents don't work - UI components that depend on immediate message delivery fail - Forces workarounds like avoiding interrupts entirely Environment: - LangGraph version: [your version] - Python version: [your version] - Using LangGraph Studio or custom client ### System Info System Information ------------------ > OS: Linux > OS Version: #85-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 18 15:26:59 UTC 2025 > Python Version: 3.12.3 (main, Aug 14 2025, 17:47:21) [GCC 13.3.0] Package Information ------------------- > langchain_core: 0.3.77 > langchain: 1.0.0a10 > langchain_community: 0.3.30 > langsmith: 0.4.8 > langchain_anthropic: 0.3.21 > langchain_exa: 0.3.1 > langchain_openai: 0.3.34 > langchain_text_splitters: 0.3.11 > langgraph_api: 0.4.38 > langgraph_cli: 0.4.2 > langgraph_license: Installed. No version info available. > langgraph_runtime: Installed. No version info available. > langgraph_runtime_inmem: 0.14.1 > langgraph_sdk: 0.2.9 > langgraph_supervisor: 0.0.29 Optional packages not installed ------------------------------- > langserve Other Dependencies ------------------ > aiohttp<4.0.0,>=3.8.3: Installed. No version info available. > anthropic<1.0.0,>=0.69.0: Installed. No version info available. > blockbuster<2.0.0,>=1.5.24: Installed. No version info available. > click>=8.1.7: Installed. No version info available. > cloudpickle>=3.0.0: Installed. No version info available. > cryptography<45.0,>=42.0.0: Installed. No version info available. > dataclasses-json<0.7.0,>=0.6.7: Installed. No version info available. > exa-py<2.0.0,>=1.0.8: Installed. No version info available. > grpcio-tools<2.0.0,>=1.75.0: Installed. No version info available. > grpcio<2.0.0,>=1.75.0: Installed. No version info available. > httpx: 0.28.1 > httpx-sse<1.0.0,>=0.4.0: Installed. No version info available. > httpx>=0.25.0: Installed. No version info available. > httpx>=0.25.2: Installed. No version info available. > jsonpatch<2.0.0,>=1.33.0: Installed. No version info available. > jsonschema-rs<0.30,>=0.20.0: Installed. No version info available. > langchain-anthropic;: Installed. No version info available. > langchain-aws;: Installed. No version info available. > langchain-azure-ai;: Installed. No version info available. > langchain-cohere;: Installed. No version info available. > langchain-community;: Installed. No version info available. > langchain-core<1.0.0,>=0.3.76: Installed. No version info available. > langchain-core<2.0.0,>=0.3.75: Installed. No version info available. > langchain-core<2.0.0,>=0.3.76: Installed. No version info available. > langchain-core<2.0.0,>=0.3.77: Installed. No version info available. > langchain-core>=0.3.40: Installed. No version info available. > langchain-core>=0.3.64: Installed. No version info available. > langchain-deepseek;: Installed. No version info available. > langchain-fireworks;: Installed. No version info available. > langchain-google-genai;: Installed. No version info available. > langchain-google-vertexai;: Installed. No version info available. > langchain-groq;: Installed. No version info available. > langchain-huggingface;: Installed. No version info available. > langchain-mistralai;: Installed. No version info available. > langchain-ollama;: Installed. No version info available. > langchain-openai;: Installed. No version info available. > langchain-perplexity;: Installed. No version info available. > langchain-text-splitters<2.0.0,>=0.3.11: Installed. No version info available. > langchain-together;: Installed. No version info available. > langchain-xai;: Installed. No version info available. > langchain<2.0.0,>=0.3.27: Installed. No version info available. > langgraph-api<0.5.0,>=0.3;: Installed. No version info available. > langgraph-checkpoint>=2.0.23: Installed. No version info available. > langgraph-checkpoint>=2.0.25: Installed. No version info available. > langgraph-runtime-inmem<0.15.0,>=0.14.0: Installed. No version info available. > langgraph-runtime-inmem>=0.7;: Installed. No version info available. > langgraph-sdk>=0.1.0;: Installed. No version info available. > langgraph-sdk>=0.2.0: Installed. No version info available. > langgraph<0.7.0,>=0.6.0: Installed. No version info available. > langgraph==1.0.0a4: Installed. No version info available. > langgraph>=0.2: Installed. No version info available. > langgraph>=0.4.0: Installed. No version info available. > langsmith-pyo3: Installed. No version info available. > langsmith<1.0.0,>=0.1.125: Installed. No version info available. > langsmith<1.0.0,>=0.3.45: Installed. No version info available. > langsmith>=0.3.45: Installed. No version info available. > numpy>=1.26.2;: Installed. No version info available. > numpy>=2.1.0;: Installed. No version info available. > openai-agents: Installed. No version info available. > openai<3.0.0,>=1.104.2: Installed. No version info available. > opentelemetry-api: 1.37.0 > opentelemetry-api>=1.37.0: Installed. No version info available. > opentelemetry-exporter-otlp-proto-http: 1.37.0 > opentelemetry-exporter-otlp-proto-http>=1.37.0: Installed. No version info available. > opentelemetry-sdk: 1.37.0 > opentelemetry-sdk>=1.37.0: Installed. No version info available. > orjson: 3.11.0 > orjson>=3.10.1: Installed. No version info available. > orjson>=3.9.7: Installed. No version info available. > packaging: 25.0 > packaging<26.0.0,>=23.2.0: Installed. No version info available. > protobuf<7.0.0,>=6.32.1: Installed. No version info available. > pydantic: 2.11.9 > pydantic-settings<3.0.0,>=2.10.1: Installed. No version info available. > pydantic<3.0.0,>=2.7.4: Installed. No version info available. > pyjwt>=2.9.0: Installed. No version info available. > pytest: 8.4.1 > python-dotenv>=0.8.0;: Installed. No version info available. > PyYAML<7.0.0,>=5.3.0: Installed. No version info available. > requests: 2.32.5 > requests-toolbelt: 1.0.0 > requests<3.0.0,>=2.32.5: Installed. No version info available. > rich: Installed. No version info available. > SQLAlchemy<3.0.0,>=1.4.0: Installed. No version info available. > sse-starlette<2.2.0,>=2.1.0: Installed. No version info available. > sse-starlette>=2: Installed. No version info available. > starlette>=0.37: Installed. No version info available. > starlette>=0.38.6: Installed. No version info available. > structlog<26,>=24.1.0: Installed. No version info available. > structlog>23: Installed. No version info available. > tenacity!=8.4.0,<10.0.0,>=8.1.0: Installed. No version info available. > tenacity>=8.0.0: Installed. No version info available. > tiktoken<1.0.0,>=0.7.0: Installed. No version info available. > truststore>=0.1: Installed. No version info available. > typing-extensions<5.0.0,>=4.7.0: Installed. No version info available. > uvicorn>=0.26.0: Installed. No version info available. > watchfiles>=0.13: Installed. No version info available. > zstandard: 0.23.0
yindo added the bugpending labels 2026-02-20 17:42:42 -05:00
yindo closed this issue 2026-02-20 17:42:42 -05:00
Author
Owner

@casparb commented on GitHub (Oct 14, 2025):

Hi @ava6969, a few things to note here:

  • create_agent() does not yet support generative UI, so your subgraph would have to be a regular StateGraph
  • If you're interrupting a subgraph, you need to compile your parent graph with a checkpointer: e.g. builder.compile(checkpointer=InMemorySaver())
  • There is no state_modifier property of create_agent(). Use system_prompt instead for static prompts, or middleware if you need a dynamic prompt
  • You'll have to define a custom state with ui if you want to use push_ui_message():
from typing_extensions import TypedDict
from typing_extensions import Annotated
from langchain.tools import InjectedState
from langgraph.graph.ui import push_ui_message, ui_message_reducer
from langgraph.graph.message import add_messages

class State(TypedDict):
    messages: Annotated[list, add_messages]
    ui: Annotated[list, ui_message_reducer]

# Sub-agent that pushes UI messages
def create_sub_agent():
    model = ChatOpenAI(model="gpt-4o-mini")

    def push_ui_tool(state):
        # Push UI message to parent_message context
        print("push_ui_tool")
        ai_msg = state.get("parent_message")
        push_ui_message(
            "sub_agent_ui_message",
            {"data": "This should appear in frontend"},
            message=ai_msg
        )
        return {"messages": [HumanMessage(content="Sub-agent completed")]}

    subgraph_builder = StateGraph(State)
    subgraph_builder.add_node("push_ui", push_ui_tool)
    subgraph_builder.set_entry_point("push_ui")
    subgraph = subgraph_builder.compile()

    return subgraph

Closing this! Let me know if you have any more questions.

@casparb commented on GitHub (Oct 14, 2025): Hi @ava6969, a few things to note here: - `create_agent()` does not yet support generative UI, so your subgraph would have to be a regular StateGraph - If you're interrupting a subgraph, you need to compile your parent graph with a checkpointer: e.g. `builder.compile(checkpointer=InMemorySaver())` - There is no state_modifier property of `create_agent()`. Use `system_prompt` instead for static prompts, or [middleware](https://docs.langchain.com/oss/python/langchain/middleware) if you need a dynamic prompt - You'll have to define a custom state with ui if you want to use `push_ui_message()`: ```python from typing_extensions import TypedDict from typing_extensions import Annotated from langchain.tools import InjectedState from langgraph.graph.ui import push_ui_message, ui_message_reducer from langgraph.graph.message import add_messages class State(TypedDict): messages: Annotated[list, add_messages] ui: Annotated[list, ui_message_reducer] # Sub-agent that pushes UI messages def create_sub_agent(): model = ChatOpenAI(model="gpt-4o-mini") def push_ui_tool(state): # Push UI message to parent_message context print("push_ui_tool") ai_msg = state.get("parent_message") push_ui_message( "sub_agent_ui_message", {"data": "This should appear in frontend"}, message=ai_msg ) return {"messages": [HumanMessage(content="Sub-agent completed")]} subgraph_builder = StateGraph(State) subgraph_builder.add_node("push_ui", push_ui_tool) subgraph_builder.set_entry_point("push_ui") subgraph = subgraph_builder.compile() return subgraph ``` Closing this! Let me know if you have any more questions.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#1006