Install
npm install @langchain/langgraphTypeScript port of LangGraph. Same graph-based mental model as the Python version — explicit state, durable checkpoints, conditional routing — with type-safe streaming, ReducedValue/UntrackedValue types, and the @langgraphjs/toolkit prebuilt agent package.
Install
npm install @langchain/langgraphVersion
v1.3.0 · May 2026 · Node 18+
Best for
Cycles, conditional routing, multi-agent coordination, streaming servers.
MessagesZodState / MessagesZodMeta — Zod-based companion to MessagesAnnotation. Use MessagesZodState when you want full Zod type inference on your messages state instead of the Annotation-based API.STREAM_EVENTS_V3_MODES — constant listing all valid v3 streaming modes ("values", "updates", "messages", "tools", "custom", "tasks"). Use this to validate or enumerate mode strings at runtime.createGraphRunStream / GraphRunStream / SubgraphRunStream — new lower-level functional streaming API. Complements the existing .stream() method on compiled graphs with explicit stream lifecycle control.createLifecycleTransformer, createMessagesTransformer, createSubgraphDiscoveryTransformer, createValuesTransformer for composing stream pipelines.isSerializableSchema, isStandardSchema type guards; getJsonSchemaFromSchema, getSchemaDefaultGetter for schema-to-JSON-Schema conversion.pushMessage — convenience helper for appending a message to a messages-state channel.ReducedValue/UntrackedValue types, @langgraphjs/toolkit.import { StateGraph, START, END, MemorySaver } from '@langchain/langgraph';import { BaseMessage } from '@langchain/core/messages';
type State = { messages: BaseMessage[] };
const graph = new StateGraph<State>({ channels: { messages: { reducer: (a, b) => [...a, ...b] } } }) .addNode('respond', async (state) => ({ messages: [/* ... */] })) .addEdge(START, 'respond') .addEdge('respond', END) .compile({ checkpointer: new MemorySaver() });
const result = await graph.invoke( { messages: [] }, { configurable: { thread_id: 'session-1' } });console.log(result);Ready? Start Zero → Hero Step 1 →
| Date | Version | Changes |
|---|---|---|
| 2026-05-05 | 1.3.0 | Version bumped 1.2.9 → 1.3.0; “What’s new” updated for 1.3.0 (MessagesZodState/Meta, STREAM_EVENTS_V3_MODES, createGraphRunStream, stream transformers, schema utilities, pushMessage). All new symbols verified against installed @langchain/langgraph@1.3.0 (.routine-envs/check-0505-node). Comprehensive guide header and revision history updated. |
| 2026-04-21 | 1.2.9 | Index redesigned with Zero → Hero + Jump-to-topic grid. |
| April 19, 2026 | 1.2.9 | Standard JSON Schema; new type utilities; toolkit package. |
| November 2025 | 1.0.2 | Initial TypeScript guide. |
Note: Python implementation lives at LangGraph (Python).