LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangGraph
  • Web
  • Channels
  • Pregel
  • Prebuilt
  • Remote
  • Stream
LangGraph SDK
  • Client
  • Auth
  • React
  • Logging
  • React Ui
  • Server
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
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
WebChannelsPregelPrebuiltRemoteStream
LangGraph SDK
ClientAuthReactLoggingReact UiServer
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
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/langgraphwebDeltaValue
Classā—Since v1.4

DeltaValue

Copy
class DeltaValue

Constructors

Properties

Methods

View source on GitHub

Example

constructor
constructor→ DeltaValue<Value, Input>
property
inputSchema: SerializableSchema<unknown, Value | Input>
property
InputType: Input
property
jsonSchemaExtra: Record<string, unknown>
property
reducer: DeltaReducer<Value, Input>
property
snapshotFrequency: number
property
valueSchema: SerializableSchema<unknown, Value>
property
ValueType: Value
method
isInstance→ value is DeltaValue<Value, Input>

Represents a state field backed by a DeltaChannel.

Unlike ReducedValue (which stores the full accumulated value in every checkpoint blob via BinaryOperatorAggregate), a DeltaValue field persists only per-step deltas (plus periodic snapshots) and reconstructs its state on read by replaying ancestor writes through a batch reducer. This avoids re-serializing large accumulators (e.g. long message histories) at every step.

Beta. The on-disk representation backing DeltaChannel may change in future releases.

Constructs a DeltaValue, pairing a value schema with a batch reducer (and an optional distinct input schema).

The schema used to validate reducer inputs. Defaults to valueSchema when not specified explicitly.

Represents the type that may be provided as input on each update.

Optional extra fields to merge into the generated JSON Schema.

The batch reducer that folds a list of incoming writes into the current accumulated value.

Snapshot cadence forwarded to the underlying DeltaChannel.

The schema that describes the type of value stored in state (after reduction). Its default (if any) seeds the channel's initial value.

Represents the value stored after all reductions.

Type guard to check if a value is a DeltaValue instance.

Copy
import { z } from "zod";
import { StateSchema, DeltaValue } from "@langchain/langgraph";

const State = new StateSchema({
  history: new DeltaValue(z.array(z.string()).default(() => []), {
    inputSchema: z.string(),
    reducer: (current, writes) => [...current, ...writes],
  }),
});