Streaming Custom Messages from Subgraph Tools JS frontend LangGraph Backend

Hi,

I am struggling to pass Subgraph = True equivalent in my use case.
I am using agent-chat-ui from LangGraph in Frontend and Langgraph Supervisor pattern in Backend Python based.

Since Supervisor is actually a subgraph pattern, I am struggling to stream any custom messages from SubGraph/Agent tool calls.

Use Case. Shareing progress, updates from tool nodes as they execute to chat stream.

Any one tried this before. I checked direct agent custom streaming using writer and works in direct agent tool calls but does not work with subgraph tools.

2 Likes

Hi @ShaileshD

Are you trying to use a javascript frontend to invoke a python Langgraph backend, in which case

    for await (const event of this.client.runs.stream(
      this.thread.thread_id,
      this.assistant.assistant_id,
      {
        input,
        config: {configurable: {"access_token": accessToken}},
        streamMode: 'messages',
        multitaskStrategy: "interrupt",
        streamSubgraphs: true,
        signal: this.controllerForStream.signal,
      }
    )) {
      const data = event.data as Record<string, unknown & { content: { text: string }[] } & any>;

      console.log(`stream event: ${event}`)
}

worked for me
in on

    "@langchain/langgraph-sdk": "^0.0.99",