LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangGraph
  • Web
  • Channels
  • Pregel
  • Prebuilt
  • Remote
React SDK
Vue SDK
Svelte SDK
Angular SDK
LangGraph SDK
  • Ui
  • Client
  • Auth
  • React
  • Logging
  • React Ui
  • Utils
  • Server
  • Stream
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
React SDK
Vue SDK
Svelte SDK
Angular SDK
LangGraph SDK
UiClientAuthReactLoggingReact UiUtilsServerStream
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/langgraphindexNativeStreamTransformeronRegister
Method●Since v0.3

onRegister

Optional hook invoked by StreamMux.addTransformer immediately after the transformer is attached to the mux. Receives a limited handle that exposes only StreamEmitter.push — enough for the transformer to emit synthesized ProtocolEvents on any namespace it chooses (e.g. a deepagents SubagentTransformer fabricating lifecycle/messages/values events under a ["tools:<tool_call_id>"] namespace when a task tool starts).

Transformers that do not synthesize events can omit this hook.

The StreamEmitter handle is only safe to call from within StreamTransformer.process. Emitting from an unrelated async context (e.g. after process has returned, from a setTimeout, etc.) races with the mux's close/fail cycle and may land events in an already-closed log.

Copy
onRegister(emitter: StreamEmitter)

Parameters

NameTypeDescription
emitter*StreamEmitter
View source on GitHub