No custom messages in stream_mode='custom' in agent called by Supervisor #825

Closed
opened 2026-02-20 17:41:57 -05:00 by yindo · 2 comments
Owner

Originally created by @adil2604 on GitHub (Jul 21, 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 langchain_openai import ChatOpenAI
from langgraph.prebuilt import create_react_agent
from langgraph_supervisor import create_supervisor
from langgraph.config import get_stream_writer

def book_hotel(hotel_name: str):
    """Book a hotel"""
    writer = get_stream_writer()
    writer("Booking hotel")
    return f"Successfully booked a stay at {hotel_name}."

def book_flight(from_airport: str, to_airport: str):
    """Book a flight"""
    writer = get_stream_writer()
    writer("Booking flight")
    return f"Successfully booked a flight from {from_airport} to {to_airport}."

flight_assistant = create_react_agent(
    model=ChatOpenAI(model='gpt-4.1-mini'),
    tools=[book_flight],
    prompt="You are a flight booking assistant",
    name="flight_assistant"
)

hotel_assistant = create_react_agent(
    model=ChatOpenAI(model='gpt-4.1-mini'),
    tools=[book_hotel],
    prompt="You are a hotel booking assistant",
    name="hotel_assistant"
)

supervisor = create_supervisor(
    agents=[flight_assistant, hotel_assistant],
    model=ChatOpenAI(model="gpt-4o"),
    prompt=(
        "You manage a hotel booking assistant and a"
        "flight booking assistant. Assign work to them."
    )
).compile()

for chunk in supervisor.stream(
    {
        "messages": [
            {
                "role": "user",
                "content": "book a flight from BOS to JFK and a stay at McKittrick Hotel"
            }
        ]
    },
    stream_mode=['debug', 'custom']
):
    print(chunk)
    print("\n")

Error Message and Stack Trace (if applicable)


Description

I wanted to receive real time updates from the tools, but if the agent is called by the supervisor, then there are no custom messages in the streaming
When I call agent directly, there are custom data in streaming

System Info

System Information

OS: Darwin
OS Version: Darwin Kernel Version 24.3.0: Thu Jan 2 20:31:46 PST 2025; root:xnu-11215.81.4~4/RELEASE_ARM64_T8132
Python Version: 3.11.4 (main, Jul 5 2023, 08:40:20) [Clang 14.0.6 ]

Package Information

langchain_core: 0.3.69
langchain: 0.1.20
langchain_community: 0.0.38
langsmith: 0.3.45
langchain_anthropic: 0.1.13
langchain_chroma: 0.1.4
langchain_google_vertexai: 1.0.4
langchain_openai: 0.3.27
langchain_robocorp: 0.0.8
langchain_text_splitters: 0.0.2
langgraph_api: 0.2.51
langgraph_cli: 0.3.3
langgraph_license: Installed. No version info available.
langgraph_runtime: Installed. No version info available.
langgraph_runtime_inmem: 0.2.1
langgraph_sdk: 0.1.70
langgraph_supervisor: 0.0.27

Optional packages not installed

langserve

Originally created by @adil2604 on GitHub (Jul 21, 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 langchain_openai import ChatOpenAI from langgraph.prebuilt import create_react_agent from langgraph_supervisor import create_supervisor from langgraph.config import get_stream_writer def book_hotel(hotel_name: str): """Book a hotel""" writer = get_stream_writer() writer("Booking hotel") return f"Successfully booked a stay at {hotel_name}." def book_flight(from_airport: str, to_airport: str): """Book a flight""" writer = get_stream_writer() writer("Booking flight") return f"Successfully booked a flight from {from_airport} to {to_airport}." flight_assistant = create_react_agent( model=ChatOpenAI(model='gpt-4.1-mini'), tools=[book_flight], prompt="You are a flight booking assistant", name="flight_assistant" ) hotel_assistant = create_react_agent( model=ChatOpenAI(model='gpt-4.1-mini'), tools=[book_hotel], prompt="You are a hotel booking assistant", name="hotel_assistant" ) supervisor = create_supervisor( agents=[flight_assistant, hotel_assistant], model=ChatOpenAI(model="gpt-4o"), prompt=( "You manage a hotel booking assistant and a" "flight booking assistant. Assign work to them." ) ).compile() for chunk in supervisor.stream( { "messages": [ { "role": "user", "content": "book a flight from BOS to JFK and a stay at McKittrick Hotel" } ] }, stream_mode=['debug', 'custom'] ): print(chunk) print("\n") ``` ### Error Message and Stack Trace (if applicable) ```shell ``` ### Description I wanted to receive real time updates from the tools, but if the agent is called by the supervisor, then there are no custom messages in the streaming When I call agent directly, there are custom data in streaming ### System Info System Information ------------------ > OS: Darwin > OS Version: Darwin Kernel Version 24.3.0: Thu Jan 2 20:31:46 PST 2025; root:xnu-11215.81.4~4/RELEASE_ARM64_T8132 > Python Version: 3.11.4 (main, Jul 5 2023, 08:40:20) [Clang 14.0.6 ] Package Information ------------------- > langchain_core: 0.3.69 > langchain: 0.1.20 > langchain_community: 0.0.38 > langsmith: 0.3.45 > langchain_anthropic: 0.1.13 > langchain_chroma: 0.1.4 > langchain_google_vertexai: 1.0.4 > langchain_openai: 0.3.27 > langchain_robocorp: 0.0.8 > langchain_text_splitters: 0.0.2 > langgraph_api: 0.2.51 > langgraph_cli: 0.3.3 > langgraph_license: Installed. No version info available. > langgraph_runtime: Installed. No version info available. > langgraph_runtime_inmem: 0.2.1 > langgraph_sdk: 0.1.70 > langgraph_supervisor: 0.0.27 Optional packages not installed ------------------------------- > langserve
yindo added the bugpending labels 2026-02-20 17:41:57 -05:00
yindo closed this issue 2026-02-20 17:41:57 -05:00
Author
Owner

@shivampkumar commented on GitHub (Jul 29, 2025):

I Started facing the same after making the following upgrades:

langgraph=^0.4.10 -> langgraph = "^0.6.0"
langgraph-supervisor = "^0.0.27" -> langgraph-supervisor = "^0.0.29"

@shivampkumar commented on GitHub (Jul 29, 2025): I Started facing the same after making the following upgrades: langgraph=^0.4.10 -> langgraph = "^0.6.0" langgraph-supervisor = "^0.0.27" -> langgraph-supervisor = "^0.0.29"
Author
Owner

@adil2604 commented on GitHub (Jul 31, 2025):

Resolved

Need set to subgraphs=True flag while streaming

async for message in router_workflow.astream(
    state,
    config,
    stream_mode=["updates", "custom"],
    subgraphs=True,
):
    logger.info(f"Message: {message}")
@adil2604 commented on GitHub (Jul 31, 2025): Resolved Need set to `subgraphs=True` flag while streaming ``` async for message in router_workflow.astream( state, config, stream_mode=["updates", "custom"], subgraphs=True, ): logger.info(f"Message: {message}") ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#825