CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-langchain--langgraph

Low-level orchestration framework for building stateful, multi-actor applications with LLMs

Overview
Eval results
Files

imports.mddocs/api/

Core Imports Reference

Complete reference of all available imports from LangGraph organized by module and category.

Main Module: @langchain/langgraph

Graph Classes

import {
  StateGraph,
  Graph,
  CompiledStateGraph,
  CompiledGraph,
  MessageGraph
} from "@langchain/langgraph";
  • StateGraph - High-level graph with automatic state management
  • Graph - Low-level graph for manual control
  • CompiledStateGraph - Compiled executable from StateGraph
  • CompiledGraph - Compiled executable from Graph
  • MessageGraph - Legacy graph specialized for messages (use StateGraph with MessagesAnnotation instead)

Annotation System

import {
  Annotation,
  AnnotationRoot,
  MessagesAnnotation,
  type StateType,
  type UpdateType,
  type NodeType,
  type SingleReducer,
  type Messages
} from "@langchain/langgraph";
  • Annotation - Factory for creating typed state annotations
  • AnnotationRoot - Root state annotation wrapper
  • MessagesAnnotation - Prebuilt annotation for message-based workflows
  • StateType - Extract state type from annotation
  • UpdateType - Extract update type from annotation
  • NodeType - Node function type
  • SingleReducer - Reducer function type
  • Messages - Message input type

State Reducers

import {
  messagesStateReducer,
  addMessages,
  pushMessage
} from "@langchain/langgraph";
  • messagesStateReducer - Intelligent message merging reducer
  • addMessages - Alias for messagesStateReducer
  • pushMessage - Manually push message to stream

Constants

import {
  START,
  END,
  INTERRUPT,
  REMOVE_ALL_MESSAGES
} from "@langchain/langgraph";
  • START ("__start__") - Graph entry point
  • END ("__end__") - Graph exit point
  • INTERRUPT ("__interrupt__") - Interrupt marker
  • REMOVE_ALL_MESSAGES ("__remove_all__") - Clear all messages constant

Control Flow

import {
  Send,
  Command,
  interrupt
} from "@langchain/langgraph";
  • Send - Send message/packet to specific node
  • Command - Combine state updates with routing
  • interrupt - Interrupt execution for human input

Channels

import {
  BaseChannel,
  LastValue,
  AnyValue,
  Topic,
  BinaryOperatorAggregate,
  type BinaryOperator,
  EphemeralValue,
  NamedBarrierValue,
  DynamicBarrierValue,
  type WaitForNames
} from "@langchain/langgraph";
  • BaseChannel - Abstract base for channels
  • LastValue - Store last value, error on concurrent writes
  • AnyValue - Store last value, allow concurrent writes
  • Topic - Accumulate messages as array
  • BinaryOperatorAggregate - Apply reducer function
  • EphemeralValue - Clear after each step
  • NamedBarrierValue - Wait for specific named values (fan-in)
  • DynamicBarrierValue - Dynamic map-reduce patterns

Execution

import {
  Pregel,
  type PregelOptions,
  type StateSnapshot,
  type StreamMode
} from "@langchain/langgraph";
  • Pregel - Core execution engine
  • PregelOptions - Execution configuration
  • StateSnapshot - State snapshot with metadata
  • StreamMode - Stream output modes

Persistence

import {
  MemorySaver,
  BaseCheckpointSaver,
  type Checkpoint,
  type CheckpointMetadata,
  type CheckpointTuple,
  BaseStore,
  InMemoryStore
} from "@langchain/langgraph";
  • MemorySaver - In-memory checkpoint storage
  • BaseCheckpointSaver - Abstract checkpoint saver interface
  • Checkpoint - Checkpoint data structure
  • CheckpointMetadata - Checkpoint metadata
  • CheckpointTuple - Complete checkpoint with config
  • BaseStore - Abstract long-term storage interface
  • InMemoryStore - In-memory store implementation

Functional API

import {
  entrypoint,
  task,
  getPreviousState,
  writer,
  getStore,
  getWriter,
  getConfig
} from "@langchain/langgraph";
  • entrypoint - Define workflow entry points
  • task - Define reusable tasks
  • getPreviousState - Access previous checkpoint state
  • writer - Write custom stream data
  • getStore - Access store from context
  • getWriter - Access writer from context
  • getConfig - Access runtime config

Runtime Types

import {
  type LangGraphRunnableConfig,
  type RetryPolicy,
  type CachePolicy
} from "@langchain/langgraph";
  • LangGraphRunnableConfig - Extended config for LangGraph
  • RetryPolicy - Retry configuration
  • CachePolicy - Cache configuration

Error Classes

import {
  BaseLangGraphError,
  GraphRecursionError,
  GraphValueError,
  GraphInterrupt,
  NodeInterrupt,
  GraphBubbleUp,
  ParentCommand,
  EmptyInputError,
  EmptyChannelError,
  InvalidUpdateError,
  UnreachableNodeError,
  RemoteException,
  isGraphInterrupt,
  isGraphBubbleUp,
  isParentCommand,
  isInterrupted,
  isCommand
} from "@langchain/langgraph";
  • BaseLangGraphError - Base error class
  • GraphRecursionError - Recursion limit exceeded
  • GraphValueError - Invalid graph value
  • GraphInterrupt - Execution interrupted
  • NodeInterrupt - Node-raised interrupt
  • GraphBubbleUp - Error that bubbles up
  • ParentCommand - Command to parent graph
  • EmptyInputError - Missing required input
  • EmptyChannelError - Empty channel read
  • InvalidUpdateError - Invalid state update
  • UnreachableNodeError - Unreachable node detected
  • RemoteException - Remote graph error

Zod Integration

import {
  MessagesZodState,
  MessagesZodMeta
} from "@langchain/langgraph";

Module: @langchain/langgraph/channels

Advanced channel imports for low-level control.

import {
  BaseChannel,
  LastValue,
  AnyValue,
  Topic,
  BinaryOperatorAggregate,
  EphemeralValue,
  NamedBarrierValue,
  DynamicBarrierValue,
  LastValueAfterFinish,
  NamedBarrierValueAfterFinish,
  DynamicBarrierValueAfterFinish,
  createCheckpoint,
  emptyChannels,
  isBaseChannel
} from "@langchain/langgraph/channels";
  • LastValueAfterFinish - LastValue with deferred availability
  • NamedBarrierValueAfterFinish - NamedBarrier with deferred availability
  • DynamicBarrierValueAfterFinish - DynamicBarrier with deferred availability
  • createCheckpoint - Create checkpoint from channels
  • emptyChannels - Initialize empty channels
  • isBaseChannel - Type guard for channels

Module: @langchain/langgraph/pregel

Low-level Pregel execution engine.

import {
  Channel,
  Pregel,
  PregelNode
} from "@langchain/langgraph/pregel";
  • Channel - Utility class for channel operations
  • Pregel - Core execution engine (also available from main module)
  • PregelNode - Node definition in Pregel graph

Module: @langchain/langgraph/prebuilt

Prebuilt agent patterns and utilities.

import {
  createReactAgent,
  createReactAgentAnnotation,
  createAgentExecutor,
  createFunctionCallingExecutor,
  ToolNode,
  ToolExecutor,
  toolsCondition,
  withAgentName
} from "@langchain/langgraph/prebuilt";
  • createReactAgent - Create ReAct-style agent
  • createReactAgentAnnotation - Typed annotation for ReAct agents
  • createAgentExecutor - Legacy agent executor (deprecated)
  • createFunctionCallingExecutor - Function-calling agent
  • ToolNode - Node for executing tools
  • ToolExecutor - Executor for tool invocations (legacy)
  • toolsCondition - Routing condition for tools
  • withAgentName - Add agent name to messages

Module: @langchain/langgraph/remote

Client for remote LangGraph APIs.

import {
  RemoteGraph
} from "@langchain/langgraph/remote";
  • RemoteGraph - Client for remote graph execution

Module: @langchain/langgraph/zod

Zod schema integration and validation.

import {
  withLangGraph,
  SchemaMetaRegistry,
  schemaMetaRegistry,
  registry
} from "@langchain/langgraph/zod";
  • withLangGraph - Attach LangGraph metadata to Zod schemas
  • SchemaMetaRegistry - Schema metadata registry class
  • schemaMetaRegistry - Default registry instance
  • registry - Alias for schemaMetaRegistry

Module: @langchain/langgraph/zod/schema

Schema extraction utilities.

import {
  getStateTypeSchema,
  getInputTypeSchema,
  getOutputTypeSchema,
  getUpdateTypeSchema,
  getConfigTypeSchema
} from "@langchain/langgraph/zod/schema";
  • getStateTypeSchema - Extract state schema from graph
  • getInputTypeSchema - Extract input schema from graph
  • getOutputTypeSchema - Extract output schema from graph
  • getUpdateTypeSchema - Extract update schema from graph
  • getConfigTypeSchema - Extract config schema from graph

CommonJS Imports

For CommonJS projects:

const {
  StateGraph,
  Graph,
  MessageGraph,
  Annotation,
  MessagesAnnotation,
  messagesStateReducer,
  addMessages,
  pushMessage,
  START,
  END,
  INTERRUPT,
  REMOVE_ALL_MESSAGES,
  Send,
  Command,
  interrupt,
  BaseChannel,
  LastValue,
  AnyValue,
  Topic,
  BinaryOperatorAggregate,
  Pregel,
  MemorySaver,
  BaseCheckpointSaver,
  BaseStore,
  InMemoryStore,
  entrypoint,
  task,
  getPreviousState,
  writer,
  GraphRecursionError,
  GraphValueError,
  GraphInterrupt,
  NodeInterrupt
} = require("@langchain/langgraph");

const {
  createReactAgent,
  ToolNode,
  toolsCondition
} = require("@langchain/langgraph/prebuilt");

const {
  RemoteGraph
} = require("@langchain/langgraph/remote");

Import Organization by Use Case

Building Basic Graphs

import {
  StateGraph,
  Annotation,
  START,
  END
} from "@langchain/langgraph";

Building Message-Based Workflows

import {
  StateGraph,
  MessagesAnnotation,
  messagesStateReducer,
  START,
  END
} from "@langchain/langgraph";

Adding Persistence

import {
  StateGraph,
  MemorySaver
} from "@langchain/langgraph";

Building Agents

import {
  createReactAgent,
  ToolNode,
  toolsCondition
} from "@langchain/langgraph/prebuilt";

import {
  MessagesAnnotation
} from "@langchain/langgraph";

Dynamic Routing

import {
  StateGraph,
  Send,
  Command
} from "@langchain/langgraph";

Human-in-the-Loop

import {
  StateGraph,
  interrupt,
  Command,
  isInterrupted,
  INTERRUPT
} from "@langchain/langgraph";

Using Functional API

import {
  entrypoint,
  task,
  getPreviousState,
  writer,
  getStore
} from "@langchain/langgraph";

Remote Graphs

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

Zod Integration

import {
  StateGraph
} from "@langchain/langgraph";

import {
  getStateTypeSchema,
  getInputTypeSchema,
  getOutputTypeSchema
} from "@langchain/langgraph/zod/schema";

Error Handling

import {
  GraphRecursionError,
  GraphInterrupt,
  InvalidUpdateError,
  isGraphInterrupt,
  isInterrupted
} from "@langchain/langgraph";

Next Steps

Complete API References

  • Graph Construction - Complete StateGraph and Graph API (Quick Reference)
  • Execution & Streaming - Complete Pregel and streaming API
  • Channels - Complete channel types and state primitives (Quick Reference)
  • Control Flow - Complete Send, Command, and interrupts API
  • Persistence - Complete checkpoints, stores, and caching API (Quick Reference)
  • Functional API - Complete task() and entrypoint() API
  • Prebuilt Agents - Complete prebuilt agent patterns API
  • Remote Graphs - Complete RemoteGraph client API
  • Types & Errors - Complete type definitions and error classes
  • Zod Integration - Complete Zod schema integration API

Install with Tessl CLI

npx tessl i tessl/npm-langchain--langgraph@1.0.1

docs

api

channels.md

control-flow-api.md

execution-api.md

functional-api.md

graph-api.md

graph-construction-full.md

imports.md

persistence-api.md

persistence-full.md

prebuilt.md

remote.md

state-management.md

types.md

zod.md

index.md

tile.json