Packages

@langchain/langgraph

1.7.5 · 17 Nov 2026MIT5.2M / weekRepositoryHomepagenpmAtom feed

Your version

1.4.0

10 Jun 2026Where it was published

1.7.5 is the newest release of 1.x.

In short

6 new3 faster2 fixed1 internal

Release note

Minor Changes

  • Add cooperative, between-superstep graph draining via RunControl.

    A new RunControl (exported from @langchain/langgraph) exposes
    requestDrain(reason) plus read-only drainRequested / drainReason. Pass it
    through the new control option on invoke / stream / streamEvents (and the
    functional API). It is surfaced on runtime.control, so nodes can read it or call
    requestDrain() themselves, and it is propagated into subgraphs.

    When a drain is requested, the Pregel loop checks the flag at the top of each
    superstep (after the previous step's writes are applied and checkpointed): if more
    tasks remain it saves the checkpoint and throws the new GraphDrained error (also
    under durability: "exit"), so the run can be resumed later from the same config.
    If the graph naturally finishes on that tick it returns normally and the caller can
    inspect control.drainRequested. A drain requested inside a subgraph bubbles up and
    stops the parent at its next boundary. Draining never cancels work that is already
    running — pair it with an AbortSignal if you need a hard upper bound.

  • Add DeltaChannel and the writes-history saver API (beta).

    DeltaChannel is a reducer channel that stores only a sentinel in checkpoint
    blobs instead of the full accumulated value, reconstructing state on read by
    replaying ancestor writes through a batch reducer. This avoids re-serializing
    the entire accumulated value at every step (e.g. long message histories).

    • DeltaChannel(reducer, { snapshotFrequency }) in @langchain/langgraph
      count-based snapshot cadence (default snapshotFrequency=1000) plus a
      system bound DELTA_MAX_SUPERSTEPS_SINCE_SNAPSHOT (default 5000, env
      LANGGRAPH_DELTA_MAX_SUPERSTEPS_SINCE_SNAPSHOT).

    • messagesDeltaReducer — a batching-invariant messages reducer that coerces
      raw object/string writes, for use with DeltaChannel.

    • BaseCheckpointSaver.getDeltaChannelHistory({ config, channels }) (beta)
      walks the parent chain returning per-channel { writes, seed? }, with a
      direct-storage override in MemorySaver.

    • counters_since_delta_snapshot added to CheckpointMetadata; DeltaSnapshot
      serialization support in the JSON+ serializer.

    Reconstruction is wired through the Pregel read/execution paths (initialization,
    getState, updateState, local reads) and exit durability accumulates and
    anchors delta writes so threads remain reconstructible without forcing
    snapshots.

  • langgraph: Add node-level error handlers

    StateGraph.addNode(name, fn, { errorHandler }) now accepts a first-class
    node-level error handler. The handler runs ONLY after the failing node's
    retryPolicy is exhausted, so retry and handling stay decoupled. It receives a
    typed NodeError { node, error } and the typed node input state, can return a
    state update, and can route to a recovery branch via new Command({ goto })
    (saga / compensation flows).

    Failure provenance is checkpointed (via a reserved ERROR_SOURCE_NODE write) so
    handlers observe the same context after a checkpoint resume. Uncaught node
    errors without a handler still abort the run as before, and GraphBubbleUp
    errors (such as interrupt()) are never swallowed by a handler.

    StateGraph.setNodeDefaults({ errorHandler }) now also accepts a graph-wide
    default handler. It is materialized at compile() as a single shared handler
    and invoked for every regular node that does not set its own errorHandler. A
    per-node handler always takes precedence, the default never catches a failure
    raised by an error-handler node itself (handler failures fail the run), and the
    default is not inherited by subgraphs.

    Ports the Python feature from langchain-ai/langgraph#7233.

  • Add node-level timeouts.

    A timeout option is now supported on StateGraph.addNode, the functional API
    (task/entrypoint), and the Send constructor. Pass a number of milliseconds
    for a hard wall-clock cap, or a TimeoutPolicy for finer control:

    import { TimeoutPolicy } from "@langchain/langgraph";
    
    // hard wall-clock cap on each attempt
    builder.addNode("agent", agentFn, { timeout: 60_000 });
    
    // full control
    builder.addNode("agent", agentFn, {
      timeout: {
        runTimeout: 60_000, // hard wall-clock cap, never refreshed
        idleTimeout: 10_000, // cap on time without observable progress
        refreshOn: "auto", // "auto" | "heartbeat"
      },
    });
    
    // per-task override
    new Send("agent", state, { timeout: { idleTimeout: 5_000 } });

    When a timeout fires, a NodeTimeoutError (carrying node, kind
    ("run"/"idle"), timeout, elapsed, runTimeout, idleTimeout) is raised,
    the attempt's buffered writes are dropped, and the node's AbortSignal is
    aborted. idleTimeout is refreshed by observable progress (writes, custom
    stream-writer calls, child-task scheduling, callback events) or an explicit
    runtime.heartbeat() call. The timer resets per retry attempt, and
    NodeTimeoutError is retryable under the default retry policy.

    Ports langchain-ai/langgraph#7599, #7646, and #7659.

  • Add StateGraph.setNodeDefaults() for setting graph-wide node policy defaults (retryPolicy, cachePolicy). Per-node values passed to addNode always take precedence, and defaults are resolved at compile() time so call order does not matter. Defaults are not inherited by subgraphs. Ports Python's set_node_defaults() (langchain-ai/langgraph#7747).

Patch Changes

  • core: Time travel replay/fork for graphs with interrupts and subgraphs

    Ports Python fixes for stale RESUME writes during replay, wrong subgraph checkpoint loading during time travel, missing fork checkpoints on replay, and direct-to-subgraph time travel.

  • schema: Expose StateSchema JSON schemas for Studio introspection

    Route StateSchema runtime definitions through getJsonSchema() and
    getInputJsonSchema() so LangGraph Studio receives state, input, and
    context schemas when graphs use the StateSchema primitive.

    Fixes #2466

  • core: Skip debug checkpoint snapshots when not streaming them

    Avoid building full-state mapDebugCheckpoint payloads on every tick when
    no consumer subscribed to checkpoints or debug stream modes. v3
    companion checkpoint envelopes are unchanged (they come from values metadata).

  • core: Index pending writes for O(1) task-prep lookups

    Build a PendingWritesIndex once per _prepareNextTasks call so resume and
    skip-done-task checks avoid repeated linear scans over checkpointPendingWrites.

  • core: Optimize applyWrites, interrupt seen, and channel errors

    Reduce allocations in _applyWrites, fix O(N²) interrupt versions_seen updates,
    skip stack traces on EmptyChannelError control flow, and cache task lists in
    the pregel loop and runner.

  • remote: Add RemoteGraph v3 streaming support

    Expose the v3 streamEvents surface for RemoteGraph by adapting remote SDK thread streams to the local GraphRunStream shape.

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.