LangGraph

A low-level JavaScript/TypeScript framework for building stateful, controllable LLM agents as graphs, with durable execution and human-in-the-loop.

Framework
npm
v1.5.2
3,370 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
90 /100 Excellent
Development Activity 100
Maintenance 100
Community 72
Maturity 48
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
81 /100 Excellent
Architecture 90
Code Quality 92
Innovation 85
Learning Curve 55

LangGraph is the JavaScript/TypeScript counterpart to LangChain’s Python LangGraph library — a low-level orchestration framework for building controllable, stateful agents. Rather than hiding control flow behind a fixed agent loop, LangGraph models an application as a graph of nodes and edges built on a Pregel-style bulk-synchronous-parallel execution engine, giving developers explicit control over branching, retries, cycles, and state propagation between steps.

The library is used in production by teams at Replit, Uber, LinkedIn, and GitLab for workflows that need to survive failures, pause for human review, and resume exactly where they left off. Its StateGraph API defines shared state as a set of channels (reducers that describe how each key merges new writes), while a separate functional API (entrypoint/task) offers a code-first alternative for teams that prefer writing plain async functions over declaring graphs explicitly.

LangGraph ships first-class support for durable execution via pluggable checkpointers (in-memory, Postgres, MongoDB, SQLite, Redis — each a separate package in the same monorepo), interrupt/resume primitives for human-in-the-loop review, and prebuilt agent constructors (createReactAgent, ToolNode) for teams that want a ready-made ReAct-style loop without hand-rolling the graph. It integrates with LangSmith for tracing and with LangGraph Platform for deployment, but works standalone without either.

The monorepo also contains framework-specific SDKs (React, Vue, Svelte, Angular) for building chat UIs backed by a LangGraph deployment, a CLI/dev-server package, and a higher-level langgraph-supervisor/langgraph-swarm set of multi-agent patterns — but the core @langchain/langgraph package covers the graph execution engine itself.

What You Get

  • A StateGraph builder API where shared state is defined as typed channels with explicit reducer semantics for how concurrent writes merge
  • A functional API (entrypoint, task) for defining durable, resumable workflows as plain async functions instead of explicit graphs
  • Pluggable checkpointer packages (memory, Postgres, MongoDB, SQLite, Redis) for durable execution that can pause and resume across process restarts
  • Interrupt/resume primitives (interrupt(), Command) for human-in-the-loop review of agent state mid-execution
  • Prebuilt agent constructors — createReactAgent and ToolNode — for a ready-made tool-calling agent loop without hand-building the graph
  • Streaming support for tokens, intermediate steps, and custom events via the stream/streamEvents APIs
  • A remote-graph client for invoking graphs hosted on a LangGraph Platform deployment from the same programming model used locally

Common Use Cases

  • Building multi-step LLM agents that need explicit branching, cycles, and retry logic rather than an opaque agent loop
  • Long-running or asynchronous agent workflows that must durably persist state and resume after a crash or restart
  • Human-in-the-loop review flows where an agent pauses for approval or edits before continuing (e.g. before executing a tool call)
  • Multi-agent systems where a supervisor or swarm pattern routes work between specialized sub-agents
  • Chat applications backed by a LangGraph deployment, using the companion React/Vue/Svelte/Angular SDKs for streaming UI updates

Under The Hood

Architecture

LangGraph’s execution model is a Pregel-style bulk-synchronous-parallel (BSP) engine: a PregelLoop (src/pregel/loop.ts) advances the graph in discrete “super-steps,” each of which runs all currently-triggered node tasks (computed in src/pregel/algo.ts, which resolves the next set of runnable tasks from channel versions and trigger conditions) via a PregelRunner (src/pregel/runner.ts) that manages retries, timeouts, and abort signals, then commits writes to channels (src/channels/*, e.g. LastValue, BinaryOperatorAggregate, Topic) before the next step begins. State itself is modeled as a set of named channels with explicit reduction semantics rather than a single mutable object, which is what lets concurrent branches merge deterministically. The StateGraph builder (src/graph/state.ts, ~2,200 lines) and the functional entrypoint/task API (src/func/) are two front-ends over the same underlying Pregel runtime, and prebuilt/react_agent_executor.ts composes them into a ready-made tool-calling agent. Interrupts are implemented as a control-flow exception (GraphInterrupt in src/errors.ts) that unwinds a super-step and is resumable via checkpoint replay, which is what backs the human-in-the-loop primitives.

Tech Stack

Written entirely in TypeScript (98% of the repo by bytes) as a pnpm/Turborepo monorepo with per-package builds compiled via an internal @langchain/build tool to dual ESM/CJS output with generated .d.ts/.d.cts types. The core @langchain/langgraph package depends on sibling workspace packages @langchain/langgraph-checkpoint (checkpointer interface) and @langchain/langgraph-sdk, plus @langchain/protocol and @standard-schema/spec, with @langchain/core and zod as peer dependencies. Separate checkpointer packages (-postgres, -mongodb, -sqlite, -redis) implement the same interface against each backing store, and separate SDK packages wrap the React/Vue/Svelte/Angular ecosystems for streaming chat UIs. The repo uses oxlint/oxfmt for linting and formatting and Vitest for testing.

Code Quality

The core package alone has 72 test files under src/, split by Vitest project into unit, browser (via Playwright, excluding node-only suites like tracing and cancellation), integration (*.int.test.ts, gated behind a Docker Compose file for external service dependencies), and benchmark (*.bench.test.ts) modes, plus TypeScript-level type tests (*.test-d.ts) run through Vitest’s typecheck integration. CI (.github/workflows/ci.yml) runs lint, format, build, and test as separate parallel jobs on every push/PR, with a dedicated workflow for verifying package exports and a browser-test workflow. Errors use a typed hierarchy (GraphInterrupt, GraphBubbleUp, GraphDrained in src/errors.ts) rather than bare exceptions, and public APIs are fully typed with exported .d.tss per entry point (main, /web, /channels, /pregel, /prebuilt, /remote, /stream, /zod).

What Makes It Unique

While most JS agent libraries wrap a single request/response loop around an LLM, LangGraph exposes the underlying execution model — a Pregel/BSP-style stepped graph with explicit channel-based state merging — as the primary abstraction, which is what enables its durable-execution and human-in-the-loop guarantees: any node can be paused and the entire computation resumed from a checkpoint, because state transitions are explicit and versioned rather than implicit function-call state. The dual API surface (declarative StateGraph vs. code-first entrypoint/task functional API) over one shared runtime is also a distinguishing design choice, letting teams pick the authoring style without giving up checkpointing or interrupts.

Used by 14 apps in this directory

TypeScript
99%
Other

NocoBase

Low Code Platforms · No Code Platforms

24,686

Open-source AI + no-code platform that lets coding agents and people collaborate to build business systems fast on proven infrastructure.

View details
94
Repo Health
81
Technical
63
Dependency
Built with
TypeScript 99%
Updated 5 days ago
TypeScript
98%
Other

Novu

Developer Tools

40,195

Open-source communication infrastructure that connects your products and AI agents to every channel your users live on — Inbox, Email, SMS, Push, Chat, and more.

View details
93
Repo Health
80
Technical
64
Dependency
Built with
TypeScript 98%
Updated 5 days ago
TypeScript
98%
Other

Novu

Developer Tools

40,195

Open-source communication infrastructure that connects your products and AI agents to every channel your users live on — Inbox, Email, SMS, Push, Chat, and more.

View details
93
Repo Health
80
Technical
64
Dependency
Built with
TypeScript 98%
Updated 5 days ago
TypeScript
81%
AGPL 3.0

Postiz

Automation · Social Media

37,683

The agentic social media scheduler — AI-powered content creation, 33-platform posting, and team workflows, all self-hosted.

View details
92
Repo Health
70
Technical
63
Dependency
Built with
TypeScript 81%
JavaScript 11%
Updated 6 days ago
TypeScript
96%
Other

Refly

AI Development · Automation · No Code Platforms

7,537

Build deterministic, versioned agent skills from natural language—run them anywhere from Claude Code to Slack.

View details
68
Repo Health
76
Technical
63
Dependency
Built with
TypeScript 96%
Updated 1 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers