Skip to content

feat(sdk): add vue, svelte, angular implementation of useStream hook#2001

Open
Christian Bromann (christian-bromann) wants to merge 7 commits intomainfrom
cb/sdk-packages
Open

feat(sdk): add vue, svelte, angular implementation of useStream hook#2001
Christian Bromann (christian-bromann) wants to merge 7 commits intomainfrom
cb/sdk-packages

Conversation

@christian-bromann

This PR introduces first-class Vue, Svelte, and Angular integrations for the LangGraph useStream hook — bringing the same streaming chat experience previously available only in React to three additional frontend frameworks. It also restructures the SDK internals to extract a framework-agnostic UI core, splits the React integration into its own dedicated package, and adds a client-side submission queue system.

New Packages

Package Framework Reactivity Model Peer Dependencies
@langchain/react React 18/19 Hooks (useState, useSyncExternalStore) react, react-dom
@langchain/vue Vue 3+ Composition API (ref, computed, watch) vue
@langchain/svelte Svelte 4/5 Stores (writable, derived) / Runes svelte
@langchain/angular Angular 18-20 Signals (signal, computed, effect) @angular/core

All four packages expose a unified useStream API adapted to each framework's idiomatic reactivity system, providing:

  • Real-time streaming of LangGraph agent state via SSE
  • Optimistic updates for instant UI feedback
  • Interrupt handling for human-in-the-loop workflows
  • Thread management including history, branching, and thread switching
  • Subagent tracking for multi-agent graphs
  • Tool call lifecycle tracking
  • Submission queue for batching rapid user inputs (new feature)
  • Custom transport support via FetchStreamTransport or user-defined implementations

SDK Core Refactoring (@langchain/langgraph-sdk)

The React-specific streaming implementation has been extracted from the core SDK into the new @langchain/react package. In its place, the core SDK now exports a framework-agnostic UI module (@langchain/langgraph-sdk/ui) containing shared primitives:

  • StreamManager — Core stream lifecycle and event processing
  • MessageTupleManager — Message state normalization between dict and class formats
  • SubmitQueue — Client-side queue that drains submissions sequentially when the agent is idle, with configurable error handling ("continue" / "stop")
  • FetchStreamTransport — Pluggable SSE transport abstraction using the Fetch API
  • extractInterrupts — Unified interrupt extraction from stream state and thread state
  • getBranchContext / getMessagesMetadataMap — Thread history branching utilities
  • SubagentManager — Tracking and management of nested agent runs

The existing @langchain/langgraph-sdk/react entrypoint remains backward-compatible — it re-exports from @langchain/react with a thin wrapper that preserves the existing message dictionary format.

Removed

  • @langchain/langgraph-sdk-validation — The standalone validation package has been removed. Its test coverage has been absorbed into each framework package's own test suite, providing more targeted and framework-specific validation.

Example Applications

Three new example apps demonstrate the integration for each framework:

  • examples/ui-angular/ — Angular standalone component with signals-based chat
  • examples/ui-svelte/ — Svelte 5 app with runes-based chat
  • examples/ui-vue/ — Vue 3 Composition API chat

All examples follow the same pattern: a simple chat UI backed by a single-node StateGraph agent, showcasing message streaming with optimistic updates.

Testing

Each framework package includes comprehensive browser-based integration tests using Vitest Browser Mode with WebDriverIO:

  • Runtime tests — Message submission, streaming, interrupts, branching, queue management, thread switching, stop/cancel, subgraph streaming, metadata, custom transport, and message removal
  • Type tests (*.test-d.ts) — Extensive type-level tests for useStream, createAgent, createDeepAgent, and LangGraph schema inference, ensuring correct generic type resolution across all framework adapters
  • Visual regression — Screenshot-based snapshot tests for UI state verification

The core SDK also adds unit tests for the new SubmitQueue (libs/sdk/src/ui/queue.test.ts).

@changeset-bot
Copy link

changeset-bot bot commented Feb 25, 2026

⚠️ No Changeset found

Latest commit: e503afc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 25, 2026

Open in StackBlitz

@langchain/langgraph-checkpoint

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph-checkpoint@2001

@langchain/langgraph-checkpoint-mongodb

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph-checkpoint-mongodb@2001

@langchain/langgraph-checkpoint-postgres

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph-checkpoint-postgres@2001

@langchain/langgraph-checkpoint-redis

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph-checkpoint-redis@2001

@langchain/langgraph-checkpoint-sqlite

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph-checkpoint-sqlite@2001

@langchain/langgraph-checkpoint-validation

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph-checkpoint-validation@2001

create-langgraph

npm i https://pkg.pr.new/langchain-ai/langgraphjs/create-langgraph@2001

@langchain/langgraph-api

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph-api@2001

@langchain/langgraph-cli

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph-cli@2001

@langchain/langgraph

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph@2001

@langchain/langgraph-cua

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph-cua@2001

@langchain/langgraph-supervisor

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph-supervisor@2001

@langchain/langgraph-swarm

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph-swarm@2001

@langchain/langgraph-ui

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph-ui@2001

@langchain/langgraph-sdk

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph-sdk@2001

@langchain/angular

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/angular@2001

@langchain/react

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/react@2001

@langchain/svelte

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/svelte@2001

@langchain/vue

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/vue@2001

commit: 5ffc2f7

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't be return this.queue = this.queue.then(() => this.enqueue(action, options));?
return is missing

Update vitest

Add missing eslint

Remove tsc build for svelte and vue

Clean up possible changes

use pnpm

split off custom react package

add vue tests

add tests for svelte

adding angular tests

land remaining tests and remove validation package

add readme

port missing features

migrate to message instances

proper type tests

more tests

test fixes in angular

format

fix lint and build

support for switchThread

feat: support for submit queue

format

tool calls as class instances

type fixes

lint fixes

cr

cr

format

add missing export

revert fix

fix

document queuing in readme

Update libs/sdk/src/ui/transport.ts

Co-authored-by: pawel-twardziak <pawel.twardziak.dev@gmail.com>

proper server side queuing

add queuing docs

linting and formatting

format

cr

actually transform into message instances

feat: onError per submit call

format

format

lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants