Files
wehub-resource-sync e30e75b5d4
Changesets / Create Version PR (push) Waiting to run
Code Quality / Oxlint + Oxfmt (push) Waiting to run
Code Quality / Template Sync (push) Waiting to run
Code Quality / Build Changed Packages (push) Waiting to run
Code Quality / Test Changed Packages (push) Waiting to run
Deploy Expo Example / Deploy Production (push) Waiting to run
Deploy Ink Example / Deploy Production (push) Waiting to run
Python Tests / pytest (assistant-stream, 3.10) (push) Waiting to run
Python Tests / pytest (assistant-stream, 3.12) (push) Waiting to run
Python Tests / pytest (assistant-ui-sync-server-api, 3.10) (push) Waiting to run
Python Tests / pytest (assistant-ui-sync-server-api, 3.12) (push) Waiting to run
Deploy Shadcn Registry / Deploy Production (push) Waiting to run
Template Metrics / LOC + Bundle Size (push) Waiting to run
chore: import upstream snapshot with attribution
2026-07-13 13:40:13 +08:00
..

LangChain useStream Example

Demonstrates @assistant-ui/react-langchain, which wraps useStream from @langchain/react and exposes it as an assistant-ui runtime.

assistant-ui also ships @assistant-ui/react-langgraph, which integrates with @langchain/langgraph-sdk directly and currently has a broader feature set. Pick the adapter that matches your upstream choice. See the comparison.

Quick Start

pnpm install

Environment Variables

Create .env.local:

NEXT_PUBLIC_LANGGRAPH_API_URL=http://localhost:2024
NEXT_PUBLIC_LANGGRAPH_ASSISTANT_ID=your_graph_id

Start a local LangGraph server via LangGraph Studio pointing at your graph, or use LangSmith for a hosted deployment.

Run

pnpm dev

Open http://localhost:3000.

Key Features

  • useStreamRuntime — thin wrapper around useStream from @langchain/react.
  • useLangChainState<T>(key) — reads arbitrary custom state keys (demo uses state.todos in TodosPanel).
  • No hand-written stream generator, no create / load / getCheckpointId glue.

Files of interest

  • app/MyRuntimeProvider.tsx — entire runtime setup in ~15 lines.
  • components/TodosPanel.tsx — demonstrates useLangChainState<Todo[]>("todos", []).