LangChain useStream

Comparison with `react-langgraph`

How `@assistant-ui/react-langchain` differs from `@assistant-ui/react-langgraph`.

Both packages connect assistant-ui to LangGraph backends. They are independent adapters for different upstream libraries — one is not a successor to the other.

Aspect@assistant-ui/react-langgraph@assistant-ui/react-langchain
Wraps@langchain/langgraph-sdk (raw SDK)@langchain/react (useStream hook)
AgeSept 2024 onwardApril 2026 onward
Version0.13.x0.0.x
Lines of source~7,500~600
Built onuseExternalStoreRuntimeuseExternalStoreRuntime
create-assistant-ui template-t langgraph ships this packageNo template yet

Feature coverage

Featurereact-langgraphreact-langchain
Stream messagesuseLangGraphRuntimeuseStreamRuntime
Interrupt stateuseLangGraphInterruptStateuseLangChainInterruptState
Send raw state update / resume commanduseLangGraphSendCommanduseLangChainSubmit
Read arbitrary custom state keyuseLangChainState<T>(key)
Per-message metadata (messages-tuple)useLangGraphMessageMetadata❌ not exposed
Generative UI messages (LangSmith)useLangGraphUIMessages❌ not exposed
Subgraph / namespaced stream events✅ via eventHandlers❌ not exposed
End-to-end cancellation primitiveunstable_createLangGraphStream❌ not exposed
Message accumulator utilityLangGraphMessageAccumulator❌ not exposed
Cloud thread persistencecloud optioncloud option

react-langchain is the newer, thinner wrapper — it delegates to the upstream useStream hook rather than re-implementing the stream plumbing. That is why its footprint is smaller and its surface area is narrower today. Features that exist in react-langgraph but not react-langchain are absent because they have not yet been ported, not because they are deprecated.

Choosing between them

Use @assistant-ui/react-langgraph when:

  • You are scaffolding via npx create-assistant-ui -t langgraph.
  • You want the broader feature set today (subgraph events, UI messages, message metadata, cancellation).
  • You prefer integrating with @langchain/langgraph-sdk directly.

Use @assistant-ui/react-langchain when:

  • Your app already depends on @langchain/react and uses useStream elsewhere.
  • You want to read custom state keys (todos, files, plans, ...) with useLangChainState<T>(key) without reconstructing them from tool-call streams.
  • You prefer a thin wrapper that stays pinned to upstream behavior.

Hook name mapping

If you are moving code between the two adapters, most hooks have a counterpart — but note the feature gaps above.

react-langgraphreact-langchainNotes
useLangGraphRuntimeuseStreamRuntimeOptions extend upstream UseStreamOptions; no stream / create / load to write.
useLangGraphInterruptStateuseLangChainInterruptStateSame return shape: { value?: unknown } | undefined.
useLangGraphSendCommanduseLangChainSubmitsubmit(values, { command }) replaces the dedicated hook.
useLangGraphSend(use runtime.thread.append)No direct equivalent; send turns through the runtime.
useLangGraphMessageMetadata(not available)Open an issue if you rely on this.
useLangGraphUIMessages(not available)Open an issue if you rely on this.
(none)useLangChainState<T>(key)New — reads any custom state key reactively.