LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangGraph
  • Web
  • Channels
  • Pregel
  • Prebuilt
  • Remote
LangGraph SDK
  • Client
  • Auth
  • React
  • Logging
  • React Ui
  • Server
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
  • Store
LangGraph Checkpoint Redis
  • Shallow
  • Store
LangGraph Checkpoint SQLite
LangGraph Checkpoint Validation
  • Cli
LangGraph API
LangGraph CLI
LangGraph CUA
  • Utils
LangGraph Supervisor
LangGraph Swarm
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangGraph
WebChannelsPregelPrebuiltRemote
LangGraph SDK
ClientAuthReactLoggingReact UiServer
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
Store
LangGraph Checkpoint Redis
ShallowStore
LangGraph Checkpoint SQLite
LangGraph Checkpoint Validation
Cli
LangGraph API
LangGraph CLI
LangGraph CUA
Utils
LangGraph Supervisor
LangGraph Swarm
Language
Theme
JavaScript@langchain/langgraphindexpushMessage
Function●Since v0.3

pushMessage

Manually push a message to a message stream.

This is useful when you need to push a manually created message before the node has finished executing.

When a message is pushed, it will be automatically persisted to the state after the node has finished executing. To disable persisting, set options.stateKey to null.

Copy
pushMessage(
  message: BaseMessage<MessageStructure<MessageToolSet>, MessageType> | BaseMessageLike,
  options: RunnableConfig<Record<string, any>>  __type
): BaseMessage<MessageStructure<MessageToolSet>, MessageType>

Parameters

NameTypeDescription
message*BaseMessage<MessageStructure<MessageToolSet>, MessageType> | BaseMessageLike

The message to push. The message must have an ID set, otherwise an error will be thrown.

optionsRunnableConfig<Record<string, any>> & __type

RunnableConfig / Runtime coming from node context.

View source on GitHub