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/langgraphremoteRemoteGraph
Class●Since v0.3

RemoteGraph

Copy
class RemoteGraph

Bases

Runnable<PregelInputType, PregelOutputType, PregelOptions<Nn, Cc, ContextType>>

Used in Docs

  • How to interact with a deployment using RemoteGraph

Constructors

Properties

Methods

Inherited fromRunnable(langchain_core)

Attributes

AInputTypeAOutputTypeAinput_schemaAoutput_schema
View source on GitHub
A
config_specs

Methods

Mget_nameMget_input_schemaMget_input_jsonschemaMget_output_schemaMget_output_jsonschemaMconfig_schemaMget_config_jsonschemaMget_graphMget_promptsMainvokeMbatch_as_completedMabatchMabatch_as_completedMastreamMastream_logMastream_eventsMatransformMbindMwith_configMwith_listenersMwith_alistenersMwith_typesMwith_retryMmapMwith_fallbacksMas_tool

Example

Copy
import { RemoteGraph } from "@langchain/langgraph/remote";

// Can also pass a LangGraph SDK client instance directly
const remoteGraph = new RemoteGraph({
  graphId: process.env.LANGGRAPH_REMOTE_GRAPH_ID!,
  apiKey: process.env.LANGGRAPH_REMOTE_GRAPH_API_KEY,
  url: process.env.LANGGRAPH_REMOTE_GRAPH_API_URL,
});

const input = {
  messages: [
    {
      role: "human",
      content: "Hello world!",
    },
  ],
};

const config = {
  configurable: { thread_id: "threadId1" },
};

await remoteGraph.invoke(input, config);
constructor
constructor
property
client: Client
property
config: RunnableConfig<Record<string, any>>

The default configuration for graph execution, can be overridden on a per-invocation basis

property
graphId: string
property
interruptAfter: "*" | keyof Nn[]

Optional array of node names or "all" to interrupt after executing these nodes. Used for implementing human-in-the-loop workflows.

property
interruptBefore: "*" | keyof Nn[]

Optional array of node names or "all" to interrupt before executing these nodes. Used for implementing human-in-the-loop workflows.

property
lc_kwargs: SerializedFields
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_runnable: boolean
property
lc_serializable: boolean
property
lg_is_pregel: boolean
property
name: string

The name of the task, analogous to the node name in StateGraph.

property
streamResumable: boolean
property
lc_aliases
property
lc_attributes
property
lc_id
property
lc_secrets
property
lc_serializable_keys
method
_batchWithConfig
method
_callWithConfig
method
_createStateSnapshot
method
_getCheckpoint
method
_getConfig
method
_getDrawableNodes
method
_getOptionsList
method
_sanitizeConfig
method
_separateRunnableConfigFromCallOptions
method
_streamIterator→ AsyncGenerator<any>

Default streaming implementation. Subclasses should override this method if they support streaming output.

method
_streamLog
method
_transformStreamWithConfig
method
assign
method
asTool
method
batch→ Promise<OperationResults<Op>>

Execute multiple operations in a single batch. This is more efficient than executing operations individually.

method
getGraphAsync→ Promise<Graph>

Returns a drawable representation of the computation graph.

method
getName
method
getState→ Promise<StateSnapshot>

Gets the current state of the graph. Requires a checkpointer to be configured.

method
getStateHistory→ AsyncIterableIterator<StateSnapshot>

Gets the history of graph states. Requires a checkpointer to be configured. Useful for:

  • Debugging execution history
  • Implementing time travel
  • Analyzing graph behavior
method
getSubgraphsAsync→ AsyncGenerator<[string, Pregel<any, any, StrRecord<string, any>, any, any, any, any, unknown, CommandInstance<unknown, Record<string, unknown>, string>, any>]>

Gets all subgraphs within this graph asynchronously. A subgraph is a Pregel instance that is nested within a node of this graph.

method
invoke→ Promise<ExtractStateType<O, O>>

Run the graph with a single input and config.

method
pick
method
pipe→ PregelNode<RunInput, Exclude<NewRunOutput, Error>>

Create a new runnable sequence that runs each individual runnable in series, piping the output of one runnable into another runnable or runnable-like.

method
stream→ Promise<IterableReadableStream<StreamOutputMap<TStreamMode, TSubgraphs, ExtractUpdateType<I, ExtractStateType<I, I>>, ExtractStateType<O, O>, "__start__" | N, NodeReturnType, InferWriterType<WriterType>, TEncoding>>>

Streams the execution of the graph, emitting state updates as they occur. This is the primary method for observing graph execution in real-time.

Stream modes:

  • "values": Emits complete state after each step
  • "updates": Emits only state changes after each step
  • "debug": Emits detailed debug information
  • "messages": Emits messages from within nodes
  • "custom": Emits custom events from within nodes
  • "checkpoints": Emits checkpoints from within nodes
  • "tasks": Emits tasks from within nodes
method
streamEvents→ IterableReadableStream<StreamEvent>
method
streamLog
method
toJSON→ __type
method
toJSONNotImplemented
method
transform
method
updateState→ Promise<RunnableConfig<Record<string, any>>>

Updates the state of the graph with new values. Requires a checkpointer to be configured.

This method can be used for:

  • Implementing human-in-the-loop workflows
  • Modifying graph state during breakpoints
  • Integrating external inputs into the graph
method
withConfig→ CompiledStateGraph<S, U, N, I, O, C, NodeReturnType, InterruptType, WriterType>

Creates a new instance of the Pregel graph with updated configuration. This method follows the immutable pattern - instead of modifying the current instance, it returns a new instance with the merged configuration.

method
withFallbacks
method
withListeners
method
withRetry
method
isRunnable
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.

deprecatedmethod
getGraph→ Graph

Returns a drawable representation of the computation graph.

deprecatedmethod
getSubgraphs→ Generator<[string, Pregel<any, any, StrRecord<string, any>, any, any, any, any, unknown, CommandInstance<unknown, Record<string, unknown>, string>, any>]>

Gets all subgraphs within this graph. A subgraph is a Pregel instance that is nested within a node of this graph.

The RemoteGraph class is a client implementation for calling remote APIs that implement the LangGraph Server API specification.

For example, the RemoteGraph class can be used to call APIs from deployments on LangSmith Deployment.

RemoteGraph behaves the same way as a StateGraph and can be used directly as a node in another StateGraph.