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/langgraphindexStateGraphInit
Type●Since v0.3

StateGraphInit

Initialization options for StateGraph. Accepts any combination of schema types for state/input/output.

Supports both state and stateSchema as aliases for backward compatibility. If only input is provided (no state/stateSchema), input is used as the state schema.

Copy
StateGraphInit

Properties

property
context: C

User provided context

property
input: I
property
interrupt: InterruptType

Interrupts the execution of a graph node.

This function can be used to pause execution of a node, and return the value of the resume input when the graph is re-invoked using Command. Multiple interrupts can be called within a single node, and each will be handled sequentially.

When an interrupt is called:

  1. If there's a resume value available (from a previous Command), it returns that value.
  2. Otherwise, it throws a GraphInterrupt with the provided value
  3. The graph can be resumed by passing a Command with a resume value

Because the interrupt function propagates by throwing a special GraphInterrupt error, you should avoid using try/catch blocks around the interrupt function, or if you do, ensure that the GraphInterrupt error is thrown again within your catch block.

property
nodes: N[]

The nodes in the graph, mapping node names to their PregelNode instances

property
output: O
property
state: SD

Primary key for state schema

property
writer: WriterType

Callback to send custom data chunks via the custom stream mode

deprecatedproperty
stateSchema: SD
View source on GitHub