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

ag-ui-langgraph

v0.4.0

Published

AG-UI protocol adapter for LangGraph — TypeScript implementation aligned with Python ag-ui-langgraph

Readme

ag-ui-langgraph

TypeScript AG-UI adapter for LangGraph compiled graphs. The package mirrors the official Python ag_ui_langgraph integration pattern:

LangGraph compiled graph -> graph.streamEvents({ version: "v2" }) -> AG-UI events

Quick Start

import { LangGraphAgent } from "ag-ui-langgraph";
import { createReactAgent } from "@langchain/langgraph/prebuilt";
import { createAgentEndpoint } from "ag-ui-hono";

const graph = createReactAgent({ llm: model, tools });
const agent = new LangGraphAgent({ name: "assistant", graph });

const app = createAgentEndpoint((input) => agent.clone().run(input));

clone() should be used per request so stream-local state such as in-progress messages, tool calls, reasoning blocks, and active steps is isolated.

Public API

class LangGraphAgent {
  constructor(config: LangGraphAgentConfig);
  clone(): LangGraphAgent;
  run(input: RunAgentInput): AsyncGenerator<BaseEvent>;
}

interface LangGraphAgentConfig {
  name: string;
  graph: LocalCompiledGraph;
  description?: string;
  config?: Record<string, unknown>;
  eventExtensions?: LangGraphEventExtension[];
}

Convenience factories are also exported:

  • createReactAgent(config) builds a LangGraph prebuilt React agent and wraps it.
  • createSupervisor(config) builds a real @langchain/langgraph-supervisor topology from named sub-agents, compiles it, and wraps it.

Event Translation

| LangGraph event | AG-UI event(s) | |---|---| | on_chat_model_stream text | TEXT_MESSAGE_START, TEXT_MESSAGE_CONTENT | | on_chat_model_stream tool chunks | TOOL_CALL_START, TOOL_CALL_ARGS | | on_chat_model_end | TEXT_MESSAGE_END or TOOL_CALL_END | | on_tool_end | TOOL_CALL_RESULT and fallback tool-call lifecycle | | on_custom_event manual emitters | text/tool/state events plus CUSTOM | | on_chain_end state output | STATE_SNAPSHOT when state changes | | node metadata changes | STEP_STARTED, STEP_FINISHED | | reasoning content blocks | REASONING_* events | | every LangGraph event | RAW event with JSON-safe payload |

Event Extensions

ag-ui-langgraph does not assign business ownership, agent identity, or visualization semantics. Use event extensions to add application-defined metadata to standard AG-UI events before they are yielded or encoded:

import { mergeEventExtra, type LangGraphEventExtension } from "ag-ui-langgraph";

const visualization: LangGraphEventExtension = {
  name: "my-app.visualization",
  beforeDispatchEvent(event, context) {
    mergeEventExtra(event, {
      visualization: {
        node: context.langgraph.nodeName,
      },
    });
  },
};

const agent = new LangGraphAgent({
  name: "assistant",
  graph,
  eventExtensions: [visualization],
});

mergeEventExtra(event, extra) performs only a shallow merge into event.extra; the package does not interpret keys inside extra.

Python Alignment Notes

Implemented alignment points include checkpoint-aware stream preparation, interrupt short-circuiting, Command resume, regeneration/time-travel fallback, schema-key filtering, state/message snapshots, subgraph stream options, frontend tool pause/resume semantics, ag-ui/copilotkit state exposure, A2UI schema context separation, orphan tool-message repair, predict-state snapshot suppression, and provider-specific reasoning extraction.

Testing

pnpm --filter ag-ui-langgraph run test
pnpm --filter ag-ui-langgraph run typecheck

The package test suite covers conversion utilities, reasoning extraction, JSON-safe serialization, schema filtering, checkpoint/interrupt behavior, state merge behavior, and LangGraph event translation.

Publishing

The npm package is emitted from dist:

pnpm --filter ag-ui-langgraph run typecheck
pnpm --filter ag-ui-langgraph run test
pnpm --filter ag-ui-langgraph run build
pnpm --filter ag-ui-langgraph run publish:check-name
pnpm --filter ag-ui-langgraph run publish:dry

publish:dry runs npm pack --dry-run; the real publish step is intentionally left to the package owner.