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/langgraph

@langchain/langgraph

Description

🦜🕸️LangGraph.js

Docs Version
Downloads Open Issues

[!NOTE] Looking for the Python version? See the Python repo and the Python docs.

LangGraph — used by Replit, Uber, LinkedIn, GitLab and more — is a low-level orchestration framework for building controllable agents. While langchain provides integrations and composable components to streamline LLM application development, the LangGraph library enables agent orchestration — offering customizable architectures, long-term memory, and human-in-the-loop to reliably handle complex tasks.

npm install @langchain/langgraph @langchain/core

To learn more about how to use LangGraph, check out the docs. We show a simple example below of how to create a ReAct agent.

// npm install @langchain-anthropic
import { createReactAgent, tool } from "langchain";
import { ChatAnthropic } from "@langchain/anthropic";

import { z } from "zod";

const search = tool(
  async ({ query }) => {
    if (
      query.toLowerCase().includes("sf") ||
      query.toLowerCase().includes("san francisco")
    ) {
      return "It's 60 degrees and foggy.";
    }
    return "It's 90 degrees and sunny.";
  },
  {
    name: "search",
    description: "Call to surf the web.",
    schema: z.object({
      query: z.string().describe("The query to use in your search."),
    }),
  }
);

const model = new ChatAnthropic({
  model: "claude-3-7-sonnet-latest",
});

const agent = createReactAgent({
  llm: model,
  tools: [search],
});

const result = await agent.invoke({
  messages: [
    {
      role: "user",
      content: "what is the weather in sf",
    },
  ],
});

Full-stack Quickstart

Get started quickly by building a full-stack LangGraph application using the create-agent-chat-app CLI:

npx create-agent-chat-app@latest

The CLI sets up a chat interface and helps you configure your application, including:

  • 🧠 Choice of 4 prebuilt agents (ReAct, Memory, Research, Retrieval)
  • 🌐 Frontend framework (Next.js or Vite)
  • 📦 Package manager (npm, yarn, or pnpm)

Why use LangGraph?

LangGraph is built for developers who want to build powerful, adaptable AI agents. Developers choose LangGraph for:

  • Reliability and controllability. Steer agent actions with moderation checks and human-in-the-loop approvals. LangGraph persists context for long-running workflows, keeping your agents on course.
  • Low-level and extensible. Build custom agents with fully descriptive, low-level primitives – free from rigid abstractions that limit customization. Design scalable multi-agent systems, with each agent serving a specific role tailored to your use case.
  • First-class streaming support. With token-by-token streaming and streaming of intermediate steps, LangGraph gives users clear visibility into agent reasoning and actions as they unfold in real time.

LangGraph is trusted in production and powering agents for companies like:

  • Klarna: Customer support bot for 85 million active users
  • Elastic: Security AI assistant for threat detection
  • Uber: Automated unit test generation
  • Replit: Code generation
  • And many more (see list here)

LangGraph’s ecosystem

While LangGraph can be used standalone, it also integrates seamlessly with any LangChain product, giving developers a full suite of tools for building agents. To improve your LLM application development, pair LangGraph with:

  • LangSmith — Helpful for agent evals and observability. Debug poor-performing LLM app runs, evaluate agent trajectories, gain visibility in production, and improve performance over time.
  • LangGraph Platform — Deploy and scale agents effortlessly with a purpose-built deployment platform for long running, stateful workflows. Discover, reuse, configure, and share agents across teams — and iterate quickly with visual prototyping in LangGraph Studio.

Pairing with LangGraph Platform

While LangGraph is our open-source agent orchestration framework, enterprises that need scalable agent deployment can benefit from LangGraph Platform.

LangGraph Platform can help engineering teams:

  • Accelerate agent development: Quickly create agent UXs with configurable templates and LangGraph Studio for visualizing and debugging agent interactions.
  • Deploy seamlessly: We handle the complexity of deploying your agent. LangGraph Platform includes robust APIs for memory, threads, and cron jobs plus auto-scaling task queues & servers.
  • Centralize agent management & reusability: Discover, reuse, and manage agents across the organization. Business users can also modify agents without coding.

Additional resources

  • LangChain Forum: Connect with the community and share all of your technical questions, ideas, and feedback.
  • LangChain Academy: Learn the basics of LangGraph in our free, structured course.
  • Tutorials: Simple walkthroughs with guided examples on getting started with LangGraph.
  • Templates: Pre-built reference apps for common agentic workflows (e.g. ReAct agent, memory, retrieval etc.) that can be cloned and adapted.
  • How-to Guides: Quick, actionable code snippets for topics such as streaming, adding memory & persistence, and design patterns (e.g. branching, subgraphs, etc.).
  • API Reference: Detailed reference on core classes, methods, how to use the graph and checkpointing APIs, and higher-level prebuilt components.
  • Built with LangGraph: Hear how industry leaders use LangGraph to ship powerful, production-ready AI applications.

Acknowledgements

LangGraph is inspired by Pregel and Apache Beam. The public interface draws inspiration from NetworkX. LangGraph is built by LangChain Inc, the creators of LangChain, but can be used without LangChain.

Classes

Class

LastValueAfterFinish

Stores the last value received, but only made available after finish().

Class

BinaryOperatorAggregate

Stores the result of applying a binary operator to the current value and each new value.

Class

LanggraphZodMetaRegistry

A Zod v4-compatible meta registry that extends the base registry.

Class

SchemaMetaRegistry

A registry for storing and managing metadata associated with schemas.

Class

AsyncBatchedStore

Abstract base class for persistent key-value stores.

Class

BaseCheckpointSaver

Class

BaseLangGraphError

Class

BaseStore

Abstract base class for persistent key-value stores.

Class

BinaryOperatorAggregate

Stores the result of applying a binary operator to the current value and each new value.

Class

Command

One or more commands to update the graph's state and send messages to nodes.

Class

CompiledStateGraph

Final result from building and compiling a StateGraph.

Class

EmptyChannelError

Class

EmptyInputError

Class

Graph

Class

GraphBubbleUp

Class

GraphInterrupt

Class

GraphRecursionError

Class

GraphValueError

Class

InMemoryStore

In-memory key-value store with optional vector search.

Class

InvalidUpdateError

Class

MemorySaver

Class

NodeInterrupt

Raised by a node to interrupt execution.

Class

ParentCommand

Class

ReducedValue

Represents a state field whose value is computed and updated using a reducer function.

Class

RemoteException

Exception raised when an error occurs in the remote graph.

Class

Send

A message or packet to send to a specific node in the graph.

Class

StateGraph

A graph whose nodes communicate by reading and writing to a shared state.

Class

StateGraphInputError

Error thrown when invalid input is provided to a StateGraph.

Class

StateSchema

StateSchema provides a unified API for defining LangGraph state schemas.

Class

UnreachableNodeError

Class

UntrackedValue

Represents a state field whose value is transient and never checkpointed.

Class

Pregel

The Pregel class is the core runtime engine of LangGraph, implementing a message-passing graph computation model

Class

ToolNode

A node that runs the tools requested in the last AIMessage. It can be used

Class

Channel

Utility class for working with channels in the Pregel system.

Class

Pregel

The Pregel class is the core runtime engine of LangGraph, implementing a message-passing graph computation model

Class

RemoteGraph

The RemoteGraph class is a client implementation for calling remote

Class

AsyncBatchedStore

Abstract base class for persistent key-value stores.

Class

BaseCheckpointSaver

Class

BaseLangGraphError

Class

BaseStore

Abstract base class for persistent key-value stores.

Class

BinaryOperatorAggregate

Stores the result of applying a binary operator to the current value and each new value.

Class

Command

One or more commands to update the graph's state and send messages to nodes.

Class

CompiledStateGraph

Final result from building and compiling a StateGraph.

Class

EmptyChannelError

Class

EmptyInputError

Class

Graph

Class

GraphBubbleUp

Class

GraphInterrupt

Class

GraphRecursionError

Class

GraphValueError

Class

InMemoryStore

In-memory key-value store with optional vector search.

Class

InvalidUpdateError

Class

MemorySaver

Class

NodeInterrupt

Raised by a node to interrupt execution.

Class

ParentCommand

Class

Pregel

The Pregel class is the core runtime engine of LangGraph, implementing a message-passing graph computation model

Class

ReducedValue

Represents a state field whose value is computed and updated using a reducer function.

Class

RemoteException

Exception raised when an error occurs in the remote graph.

Class

Send

A message or packet to send to a specific node in the graph.

Class

StateGraph

A graph whose nodes communicate by reading and writing to a shared state.

Class

StateGraphInputError

Error thrown when invalid input is provided to a StateGraph.

Class

StateSchema

StateSchema provides a unified API for defining LangGraph state schemas.

Class

UnreachableNodeError

Class

UntrackedValue

Represents a state field whose value is transient and never checkpointed.

Class

MultipleSubgraphsError

deprecated
Class

ToolExecutor

deprecated
Class

MultipleSubgraphsError

deprecated

Functions

Function

createCheckpoint

Function

empty

Function

withLangGraph

Function

getConfigTypeSchema

Get the config schema for a graph.

Function

getInputTypeSchema

Get the input schema for a graph.

Function

getOutputTypeSchema

Get the output schema for a graph.

Function

getStateTypeSchema

Get the state schema for a graph.

Function

getUpdateTypeSchema

Get the update schema for a graph.

Function

entrypoint

Define a LangGraph workflow using the entrypoint function.

Function

getConfig

A helper utility function that returns the LangGraphRunnableConfig that was set when the graph was initialized.

Function

getCurrentTaskInput

A helper utility function that returns the input for the currently executing task

Function

getJsonSchemaFromSchema

Get the JSON schema from a SerializableSchema.

Function

getPreviousState

A helper utility function for use with the functional API that returns the previous

Function

getSchemaDefaultGetter

Detect if a schema has a default value by validating undefined.

Function

getStore

A helper utility function that returns the BaseStore that was set when the graph was initialized

Function

getSubgraphsSeenSet

Used for subgraph detection.

Function

getWriter

A helper utility function that returns the LangGraphRunnableConfig#writer if "custom" stream mode is enabled, otherwise undefined.

Function

interrupt

Interrupts the execution of a graph node.

Function

isCommand

A type guard to check if the given value is a Command.

Function

isGraphBubbleUp

Function

isGraphInterrupt

Function

isInterrupted

Checks if the given graph invoke / stream chunk contains interrupt.

Function

isParentCommand

Function

isSerializableSchema

Type guard to check if a given value is a SerializableSchema, i.e.

Function

isStandardSchema

Type guard to check if a given value is a Standard Schema V1 object.

Function

messagesStateReducer

Reducer function for combining two sets of messages in LangGraph's state system.

Function

pushMessage

Manually push a message to a message stream.

Function

task

Define a LangGraph task using the task function.

Function

writer

Function

addMessages

Reducer function for combining two sets of messages in LangGraph's state system.

Function

createReactAgentAnnotation

Function

toolsCondition

A conditional edge function that determines whether to route to a tools node or end the graph.

Function

addMessages

Reducer function for combining two sets of messages in LangGraph's state system.

Function

entrypoint

Define a LangGraph workflow using the entrypoint function.

Function

getJsonSchemaFromSchema

Get the JSON schema from a SerializableSchema.

Function

getSchemaDefaultGetter

Detect if a schema has a default value by validating undefined.

Function

getSubgraphsSeenSet

Used for subgraph detection.

Function

isCommand

A type guard to check if the given value is a Command.

Function

isGraphBubbleUp

Function

isGraphInterrupt

Function

isInterrupted

Checks if the given graph invoke / stream chunk contains interrupt.

Function

isParentCommand

Function

isSerializableSchema

Type guard to check if a given value is a SerializableSchema, i.e.

Function

isStandardSchema

Type guard to check if a given value is a Standard Schema V1 object.

Function

messagesStateReducer

Reducer function for combining two sets of messages in LangGraph's state system.

Function

task

Define a LangGraph task using the task function.

Function

createFunctionCallingExecutor

deprecated
Function

createReactAgent

deprecated
Function

withAgentName

deprecated

Attach formatted agent names to the messages passed to and from a language model.

Exports

Interfaces

Types

Module

channels

Module

index

Module

prebuilt

Module

pregel

Module

remote

Module

web

Interface

AnyValue

Stores the last value received, assumes that if multiple values are received, they are all equal.

Interface

DynamicBarrierValue

A channel that switches between two states

Interface

EphemeralValue

Stores the value received in the step immediately preceding, clears after.

Interface

NamedBarrierValue

A channel that waits until all named values are received before making the value available.

Interface

Topic

A configurable PubSub Topic.

Interface

WaitForNames

Interface

SchemaMeta

Interface

AnnotationRoot

Should not be instantiated directly. See Annotation.

Interface

AnyValue

Stores the last value received, assumes that if multiple values are received, they are all equal.

Interface

Checkpoint

Interface

CheckpointTuple

Interface

CompiledGraph

The Pregel class is the core runtime engine of LangGraph, implementing a message-passing graph computation model

Interface

ConditionalEdgeRouterTypes

Type bag for ConditionalEdgeRouter that accepts schema types.

Interface

DynamicBarrierValue

A channel that switches between two states

Interface

EphemeralValue

Stores the value received in the step immediately preceding, clears after.

Interface

GetOperation

Operation to retrieve an item by namespace and ID.

Interface

GraphNodeTypes

Type bag for GraphNode that accepts schema types.

Interface

Item

Represents a stored item with metadata.

Interface

LangGraphRunnableConfig

Interface

ListNamespacesOperation

Operation to list and filter namespaces in the store.

Interface

MatchCondition

Interface

NamedBarrierValue

A channel that waits until all named values are received before making the value available.

Interface

PregelNode

Interface

PregelOptions

Configuration options for executing a Pregel graph.

Interface

PutOperation

Operation to store, update, or delete an item.

Interface

Runtime

Interface

SearchOperation

Operation to search for items within a namespace prefix.

Interface

StateDefinition

Interface

StateGraphArgs

Interface

StateSnapshot

Interface

TaskOptions

Options for the task function

Interface

Topic

A configurable PubSub Topic.

Interface

UntrackedValueInit

Initialization options for UntrackedValue.

Interface

WaitForNames

Interface

ActionRequest

Represents a request for human action within the graph execution.

Interface

HumanInterrupt

Represents an interrupt triggered by the graph that requires human intervention.

Interface

HumanInterruptConfig

Configuration interface that defines what actions are allowed for a human interrupt.

Interface

ToolInvocationInterface

Interface for invoking a tool

Interface

PregelOptions

Configuration options for executing a Pregel graph.

Interface

AnnotationRoot

Should not be instantiated directly. See Annotation.

Interface

AnyValue

Stores the last value received, assumes that if multiple values are received, they are all equal.

Interface

Checkpoint

Interface

CheckpointTuple

Interface

CompiledGraph

The Pregel class is the core runtime engine of LangGraph, implementing a message-passing graph computation model

Interface

ConditionalEdgeRouterTypes

Type bag for ConditionalEdgeRouter that accepts schema types.

Interface

DynamicBarrierValue

A channel that switches between two states

Interface

EphemeralValue

Stores the value received in the step immediately preceding, clears after.

Interface

GetOperation

Operation to retrieve an item by namespace and ID.

Interface

GraphNodeTypes

Type bag for GraphNode that accepts schema types.

Interface

Item

Represents a stored item with metadata.

Interface

LangGraphRunnableConfig

Interface

ListNamespacesOperation

Operation to list and filter namespaces in the store.

Interface

MatchCondition

Interface

NamedBarrierValue

A channel that waits until all named values are received before making the value available.

Interface

PregelNode

Interface

PregelOptions

Configuration options for executing a Pregel graph.

Interface

PutOperation

Operation to store, update, or delete an item.

Interface

Runtime

Interface

SearchOperation

Operation to search for items within a namespace prefix.

Interface

StateDefinition

Interface

StateGraphArgs

Interface

StateSnapshot

Interface

TaskOptions

Options for the task function

Interface

Topic

A configurable PubSub Topic.

Interface

UntrackedValueInit

Initialization options for UntrackedValue.

Interface

WaitForNames

Interface

AgentState

deprecated
Interface

ToolExecutorArgs

deprecated
Type

BinaryOperator

Type

UpdateType

Type

BaseLangGraphErrorFields

Type

BinaryOperator

Type

CheckpointMetadata

Additional details about the checkpoint, including the source, step, writes, and parents.

Type

CommandParams

Type

ConditionalEdgeRouter

Type for conditional edge routing functions.

Type

EntrypointOptions

Options for the entrypoint function

Type

ExtractStateType

Extract the State type from any supported schema type.

Type

ExtractUpdateType

Extract the Update type from any supported schema type.

Type

GetStateOptions

Options for getting the state of the graph.

Type

GraphNode

Strongly-typed utility for authoring graph nodes outside of the StateGraph builder,

Type

GraphNodeReturnValue

Return value type for GraphNode functions.

Type

InferStateSchemaUpdate

Infer the Update type from a StateSchemaFields.

Type

InferStateSchemaValue

Infer the State type from a StateSchemaFields.

Type

Interrupt

Type

Messages

Type that represents an acceptable input for the messages state reducer.

Type

MultipleChannelSubscriptionOptions

Options for subscribing to multiple channels.

Type

NamespaceMatchType

Type

NameSpacePath

Type

NodeType

Type

Operation

Type

OperationResults

Type

ReducedValueInit

Initialization options for ReducedValue.

Type

RetryPolicy

Type

SingleChannelSubscriptionOptions

Options for subscribing to a single channel.

Type

SingleReducer

Type

StateGraphInit

Initialization options for StateGraph.

Type

StateSchemaField

Valid field types for StateSchema.

Type

StateSchemaFields

Init object for StateSchema constructor.

Type

StateType

Type

StreamMode

Selects the type of output you'll receive when streaming from the graph. See Streaming for more details.

Type

StreamOutputMap

Type

UpdateType

Type

AgentNameMode

Type

HumanResponse

The response provided by a human to an interrupt, which is returned when graph execution resumes.

Type

ToolNodeOptions

Type

PregelInputType

Type

PregelOutputType

Type

RemoteGraphParams

Type

BaseLangGraphErrorFields

Type

BinaryOperator

Type

CheckpointMetadata

Additional details about the checkpoint, including the source, step, writes, and parents.

Type

CommandParams

Type

ConditionalEdgeRouter

Type for conditional edge routing functions.

Type

EntrypointOptions

Options for the entrypoint function

Type

ExtractStateType

Extract the State type from any supported schema type.

Type

ExtractUpdateType

Extract the Update type from any supported schema type.

Type

GetStateOptions

Options for getting the state of the graph.

Type

GraphNode

Strongly-typed utility for authoring graph nodes outside of the StateGraph builder,

Type

GraphNodeReturnValue

Return value type for GraphNode functions.

Type

InferStateSchemaUpdate

Infer the Update type from a StateSchemaFields.

Type

InferStateSchemaValue

Infer the State type from a StateSchemaFields.

Type

Interrupt

Type

Messages

Type that represents an acceptable input for the messages state reducer.

Type

MultipleChannelSubscriptionOptions

Options for subscribing to multiple channels.

Type

NamespaceMatchType

Type

NameSpacePath

Type

NodeType

Type

Operation

Type

OperationResults

Type

ReducedValueInit

Initialization options for ReducedValue.

Type

RetryPolicy

Type

SingleChannelSubscriptionOptions

Options for subscribing to a single channel.

Type

SingleReducer

Type

StateGraphInit

Initialization options for StateGraph.

Type

StateSchemaField

Valid field types for StateSchema.

Type

StateSchemaFields

Init object for StateSchema constructor.

Type

StateType

Type

StreamMode

Selects the type of output you'll receive when streaming from the graph. See Streaming for more details.

Type

StreamOutputMap

Type

UpdateType

Type

CreateReactAgentParams

deprecated
Type

FunctionCallingExecutorState

deprecated