npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@langchain/angular

v1.0.2

Published

Angular integration for LangGraph & LangChain

Readme

@langchain/angular

Angular SDK for building AI-powered applications with Deep Agents, LangChain and LangGraph.

The package ships a Signals-first API built on top of the v2 streaming protocol. injectStream returns a small, always-on root handle (values, messages, isLoading, error, …) and pushes anything namespaced (subagents, subgraphs, media, submission queue, per-message metadata) behind ref-counted inject* selectors so components only pay for data they actually consume.

Upgrading from 0.x? See docs/v1-migration.md for the complete matrix of option, return-shape, and transport changes.

Installation

npm install @langchain/angular @langchain/core

Peer dependencies: @angular/core (^18.0.0 – ^21.0.0), @langchain/core (^1.1.27).

Quick start

import { Component } from "@angular/core";
import { injectStream } from "@langchain/angular";

@Component({
  standalone: true,
  template: `
    <div>
      @for (msg of stream.messages(); track msg.id ?? $index) {
        <div>{{ str(msg.content) }}</div>
      }

      <button
        [disabled]="stream.isLoading()"
        (click)="onSubmit()"
      >
        Send
      </button>
    </div>
  `,
})
export class ChatComponent {
  readonly stream = injectStream({
    assistantId: "agent",
    apiUrl: "http://localhost:2024",
  });

  str(v: unknown) {
    return typeof v === "string" ? v : JSON.stringify(v);
  }

  onSubmit() {
    void this.stream.submit({
      messages: [{ type: "human", content: "Hello!" }],
    });
  }
}

injectStream must be called from an Angular injection context — the host's DestroyRef owns the stream, so navigating away destroys the controller automatically.

Features at a glance

  • Signals everywhere. Messages, values, tool calls, interrupts, loading/error state — all Angular Signal<T>s you call as functions in templates.
  • One call, two transports. Same option bag targets either the LangGraph Platform (SSE by default, transport: "websocket" opt-in) or a custom backend through an AgentServerAdapter.
  • Ref-counted selectors. injectMessages, injectValues, injectToolCalls, media selectors, submission queue — the first consumer opens a subscription, the last one's DestroyRef closes it. Components pay only for what they render.
  • Human-in-the-loop. Interrupts are first-class signals; resume or fork a specific pending interrupt with one call.
  • Headless tools. Register browser-side tool implementations; the runtime dispatches matching interrupts and auto-resumes with the return value.
  • Subagent & subgraph discovery. Lightweight snapshots at the root; scoped content (messages, tool calls, state) via the same selectors, targeted at a snapshot or namespace.
  • Forking without history preload. Per-message metadata + submit({ forkFrom }) replaces the legacy branch / fetchStateHistory trio.
  • DI-native. provideStream for subtree sharing, provideStreamDefaults for app-wide config, StreamService for class-based wrappers.
  • Typed end-to-end. Pass typeof agent as the first generic — state, tool args, and per-subagent state flow through to every selector.

Public stream types

Use StreamApi<T> when you need to name the return type of injectStream, useStream, provideStream, or StreamService in Angular code. It is the Angular-facing alias for the Signals-first handle.

UseStreamResult<T> is also exported as a React-compatible alias for the same shape. Prefer it only in shared utilities that are designed to accept stream handles from multiple framework packages.

Documentation

In-depth guides live under docs/:

Playground

For complete end-to-end examples, visit the LangChain UI Playground.

License

MIT