LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangGraph
  • Web
  • Channels
  • Pregel
  • Prebuilt
  • Remote
  • Stream
LangGraph SDK
  • Client
  • Auth
  • React
  • Logging
  • React Ui
  • Server
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
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
WebChannelsPregelPrebuiltRemoteStream
LangGraph SDK
ClientAuthReactLoggingReact UiServer
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
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/langgraphwebGraphCallbackHandler
Class●Since v1.4

GraphCallbackHandler

Copy
class GraphCallbackHandler

Bases

BaseCallbackHandler

Constructors

Properties

Methods

Inherited fromBaseCallbackHandler(langchain_core)

Attributes

Araise_errorArun_inlineAignore_llmAignore_retry
View source on GitHub
A
ignore_chain
Aignore_agent
Aignore_retriever
Aignore_chat_model
Aignore_custom_event

Inherited fromLLMManagerMixin(langchain_core)

Methods

Mon_llm_new_tokenMon_llm_endMon_llm_errorMon_stream_event

Inherited fromChainManagerMixin(langchain_core)

Methods

Mon_chain_endMon_chain_errorMon_agent_actionMon_agent_finish

Inherited fromToolManagerMixin(langchain_core)

Methods

Mon_tool_endMon_tool_error

Inherited fromRetrieverManagerMixin(langchain_core)

Methods

Mon_retriever_errorMon_retriever_end

Inherited fromCallbackManagerMixin(langchain_core)

Methods

Mon_llm_startMon_chat_model_startMon_retriever_startMon_chain_startMon_tool_start

Inherited fromRunManagerMixin(langchain_core)

Methods

Mon_textMon_retryMon_custom_event

Example

constructor
constructor
property
[GRAPH_CALLBACK_HANDLER]: true
property
awaitHandlers: boolean
property
ignoreAgent: boolean
property
ignoreChain: boolean
property
ignoreCustomEvent: boolean
property
ignoreLLM: boolean
property
ignoreRetriever: boolean
property
lc_kwargs: SerializedFields
property
lc_serializable: boolean
property
name: string
property
raiseError: boolean
property
lc_aliases
property
lc_attributes
property
lc_id
property
lc_namespace: string[]

A path to the module that contains the class, eg. ["langchain", "llms"] Usually should be the same as the entrypoint the class is exported from.

property
lc_secrets
property
lc_serializable_keys
method
copy
method
handleAgentAction
method
handleAgentEnd
method
handleChainEnd
method
handleChainError
method
handleChainStart
method
handleChatModelStart
method
handleChatModelStreamEvent
method
handleCustomEvent
method
handleInterrupt→ void | Promise<void>

Called for root interrupts, before the terminal chain callback.

method
handleLLMEnd
method
handleLLMError
method
handleLLMNewToken
method
handleLLMStart
method
handleResume→ void | Promise<void>

Called before execution continues, including in resumed subgraphs.

method
handleRetrieverEnd
method
handleRetrieverError
method
handleRetrieverStart
method
handleText
method
handleToolEnd
method
handleToolError
method
handleToolEvent
method
handleToolStart
method
toJSON→ __type
method
toJSONNotImplemented
method
fromMethods
method
isInstance→ value is GraphCallbackHandler
method
lc_name→ string

The name of the serializable. Override to provide an alias or to preserve the serialized module name in minified environments.

Implemented as a static method to support loading logic.

Extend this class and pass an instance through callbacks to observe graph interrupts and resumes. Lifecycle methods are always awaited, including when other callbacks run in the background. Set raiseError to propagate errors.

Copy
class Observer extends GraphCallbackHandler {
  handleInterrupt(event: GraphInterruptEvent) {
    console.log(event.runId, event.interrupts);
  }
}
const observed = graph.withConfig({ callbacks: [new Observer()] });