Skip to content

LangGraph (TypeScript)

TypeScript 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

Terminal window
npm install @langchain/langgraph

Version

v1.3.5 · June 2026 · Node 18+

Best for

Cycles, conditional routing, multi-agent coordination, streaming servers.

  • v1.3.5 (June 2026) — Patch release; stability and dependency updates. @langchain/langgraph@1.3.5 confirmed latest stable via npm registry (2026-06-05). All key symbols (StateGraph, START, END, MemorySaver, interrupt, Command, MessagesZodState, STREAM_EVENTS_V3_MODES, createGraphRunStream) confirmed present; export count: 82 — unchanged from 1.3.4.
  • v1.3.4 (June 2026) — Patch release; stability and dependency updates. All key symbols (StateGraph, START, END, MemorySaver, interrupt, Command, MessagesZodState, STREAM_EVENTS_V3_MODES, createGraphRunStream) confirmed present in installed @langchain/langgraph@1.3.4 (/tmp/npm-0603). Export count: 82 — unchanged from 1.3.3.
  • v1.3.3 (June 2026) — Patch release; stability and dependency updates. All key symbols (StateGraph, START, END, MemorySaver, interrupt, Command, MessagesZodState, STREAM_EVENTS_V3_MODES, createGraphRunStream) confirmed present in installed @langchain/langgraph@1.3.3 (/tmp/npm-0602). Export count: 82 — unchanged from 1.3.2.
  • v1.3.2 (May 2026) — Patch release; stability and dependency updates. All key symbols (StateGraph, START, END, MemorySaver, interrupt, Command, MessagesZodState, STREAM_EVENTS_V3_MODES, createGraphRunStream) confirmed present in installed @langchain/langgraph@1.3.2 (.routine-envs/check-0519-node).
  • v1.3.1 (May 2026) — Patch release; stability and dependency updates.
  • v1.3.0 features:
  • 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.
  • Stream transformerscreateLifecycleTransformer, createMessagesTransformer, createSubgraphDiscoveryTransformer, createValuesTransformer for composing stream pipelines.
  • Schema utilitiesisSerializableSchema, isStandardSchema type guards; getJsonSchemaFromSchema, getSchemaDefaultGetter for schema-to-JSON-Schema conversion.
  • pushMessage — convenience helper for appending a message to a messages-state channel.
  • All 1.2.x features retained: standard JSON Schema (Zod 4, Valibot, ArkType), 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 →


DateVersionChanges
2026-06-051.3.5Version bumped 1.3.4 → 1.3.5 (one patch release); “What’s new” heading updated to v1.3.5; patch bullet added; comprehensive guide header updated; revision history entry added. @langchain/langgraph@1.3.5 confirmed latest stable via npm registry (2026-06-05). Export count: 82 — PASS.
2026-06-031.3.4Version bumped 1.3.3 → 1.3.4 (one patch release); “What’s new” updated; revision history entry added. All key symbols (StateGraph, START, END, MemorySaver, interrupt, Command, MessagesZodState, STREAM_EVENTS_V3_MODES, createGraphRunStream) verified against installed @langchain/langgraph@1.3.4 (/tmp/npm-0603). Export count: 82 — PASS.
2026-06-021.3.3Version bumped 1.3.2 → 1.3.3 (one patch release); “What’s new” updated; comprehensive guide header updated; revision history entry added. All key symbols verified against installed @langchain/langgraph@1.3.3 (/tmp/npm-0602). Export count: 82 — PASS.
2026-05-191.3.2Version bumped 1.3.0 → 1.3.2 (two patch releases: 1.3.1, 1.3.2); “What’s new” updated; comprehensive guide header updated; revision history entry added. All key symbols verified against installed @langchain/langgraph@1.3.2 (.routine-envs/check-0519-node).
2026-05-051.3.0Version 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-211.2.9Index redesigned with Zero → Hero + Jump-to-topic grid.
April 19, 20261.2.9Standard JSON Schema; new type utilities; toolkit package.
November 20251.0.2Initial TypeScript guide.

Note: Python implementation lives at LangGraph (Python).