message.name is always undefined in streamMode: ['messages'] #313

Open
opened 2026-02-15 18:15:49 -05:00 by yindo · 0 comments
Owner

Originally created by @Diluka on GitHub (Jul 25, 2025).

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangGraph.js documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangGraph.js rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangGraph (or the specific integration package).

Example Code

import { createReactAgent } from '@langchain/langgraph/prebuilt';
import { ChatOpenAI } from '@langchain/openai';
import 'dotenv/config';

const llm = new ChatOpenAI({
  model: 'gpt-4o-mini',
});

const agent = createReactAgent({
  name: 'Web Search Agent',
  llm,
  tools: [{ type: 'web_search_preview' }],
});

const stream = await agent.stream(
  {
    messages: ['What was a positive news story from today?'],
  },
  { streamMode: ['messages'] },
);

for await (const it of stream) {
  if (Array.isArray(it)) {
    const [type, [chunk]] = it;
    // console.log(type, chunk);
    console.log('agent name:', chunk.name);
  } else {
    // console.log(it);
    const { agent: { messages: [message] = [] } = {} } = it;
    console.log('agent name:', message.name);
  }
}

Error Message and Stack Trace (if applicable)

streamMode: ['messages']

agent name: undefined

streamMode: ['values'] (default)

agent name: Web Search Agent

Description

When streaming with streamMode: ['messages'], the name property on the agent message consistently returns undefined. However, using streamMode: ['values'] returns the correct agent name (e.g., "Web Search Agent"). I expected both modes to consistently include the agent's name in the message object.

System Info

{
  "imports": {
    "@langchain/core": "npm:@langchain/core@^0.3.66",
    "@langchain/langgraph": "npm:@langchain/langgraph@^0.3.11",
    "@langchain/openai": "npm:@langchain/openai@^0.6.3",
    "dotenv": "npm:dotenv@^17.2.1"
  }
}
Originally created by @Diluka on GitHub (Jul 25, 2025). ### Checked other resources - [x] I added a very descriptive title to this issue. - [x] I searched the LangGraph.js documentation with the integrated search. - [x] I used the GitHub search to find a similar question and didn't find it. - [x] I am sure that this is a bug in LangGraph.js rather than my code. - [x] The bug is not resolved by updating to the latest stable version of LangGraph (or the specific integration package). ### Example Code ```ts import { createReactAgent } from '@langchain/langgraph/prebuilt'; import { ChatOpenAI } from '@langchain/openai'; import 'dotenv/config'; const llm = new ChatOpenAI({ model: 'gpt-4o-mini', }); const agent = createReactAgent({ name: 'Web Search Agent', llm, tools: [{ type: 'web_search_preview' }], }); const stream = await agent.stream( { messages: ['What was a positive news story from today?'], }, { streamMode: ['messages'] }, ); for await (const it of stream) { if (Array.isArray(it)) { const [type, [chunk]] = it; // console.log(type, chunk); console.log('agent name:', chunk.name); } else { // console.log(it); const { agent: { messages: [message] = [] } = {} } = it; console.log('agent name:', message.name); } } ``` ### Error Message and Stack Trace (if applicable) ### streamMode: ['messages'] ```log agent name: undefined ``` ### streamMode: ['values'] (default) ```log agent name: Web Search Agent ``` ### Description When streaming with `streamMode: ['messages']`, the `name` property on the agent message consistently returns `undefined`. However, using `streamMode: ['values']` returns the correct agent name (e.g., `"Web Search Agent"`). I expected both modes to consistently include the agent's name in the message object. ### System Info ```deno.json { "imports": { "@langchain/core": "npm:@langchain/core@^0.3.66", "@langchain/langgraph": "npm:@langchain/langgraph@^0.3.11", "@langchain/openai": "npm:@langchain/openai@^0.6.3", "dotenv": "npm:dotenv@^17.2.1" } } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#313