@langchain/langgraph
1.7.5 · 17 Nov 2026MIT5.2M / weekRepositoryHomepagenpmAtom feed
1.7.5 is the newest release of 1.x.
In short
2 new1 fixed1 internal
Release note
Minor Changes
Add type utilities for authoring graph nodes and conditional edges
New exported type utilities for improved TypeScript ergonomics:
ExtractStateType<Schema>- Extract the State type from any supported schema (StateSchema, AnnotationRoot, or Zod object)ExtractUpdateType<Schema>- Extract the Update type (partial state for node returns) from any supported schemaGraphNode<Schema, Context?, Nodes?>- Strongly-typed utility for defining graph node functions with full inference for state, runtime context, and optional type-safe routing via CommandConditionalEdgeRouter<Schema, Context?, Nodes?>- Type for conditional edge routing functions passed toaddConditionalEdges
These utilities enable defining nodes outside the StateGraph builder while maintaining full type safety:
import { StateSchema, GraphNode, ConditionalEdgeRouter, END, } from "@langchain/langgraph"; import { z } from "zod/v4"; const AgentState = new StateSchema({ messages: MessagesValue, step: z.number().default(0), }); interface MyContext { userId: string; } // Fully typed node function const processNode: GraphNode<typeof AgentState> = (state, runtime) => { return { step: state.step + 1 }; }; // Type-safe routing with Command const routerNode: GraphNode< typeof AgentState, MyContext, "agent" | "tool" > = (state) => new Command({ goto: state.needsTool ? "tool" : "agent" }); // Conditional edge router const router: ConditionalEdgeRouter< typeof AgentState, MyContext, "continue" > = (state) => (state.done ? END : "continue");StateSchema,ReducedValue, andUntrackedValueStateSchema provides a new API for defining graph state that works with any Standard Schema-compliant validation library (Zod, Valibot, ArkType, and others).
Standard Schema support
LangGraph now supports [Standard Schema](https://standardschema.dev/), an open specification implemented by Zod 4, Valibot, ArkType, and other schema libraries. This means you can use your preferred validation library without lock-in:
```typescript
import { z } from "zod"; // or valibot, arktype, etc.
import {
StateSchema,
ReducedValue,
MessagesValue,
} from "@langchain/langgraph";
const AgentState = new StateSchema({
messages: MessagesValue,
currentStep: z.string(),
count: z.number().default(0),
history: new ReducedValue(
z.array(z.string()).default(() => []),
{
inputSchema: z.string(),
reducer: (current, next) => [...current, next],
}
),
});
// Type-safe state and update types
type State = typeof AgentState.State;
type Update = typeof AgentState.Update;
const graph = new StateGraph(AgentState)
.addNode("agent", (state) => ({ count: state.count + 1 }))
.addEdge(START, "agent")
.addEdge("agent", END)
.compile();
```New exports
- **`StateSchema`** - Define state with any Standard Schema-compliant library - **`ReducedValue`** - Define fields with custom reducer functions for accumulating state - **`UntrackedValue`** - Define transient fields that are not persisted to checkpoints - **`MessagesValue`** - Pre-built message list channel with add/remove semantics
Patch Changes
Perform reference equality check on reducers before throwing "Channel already exists with a different type" error
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.