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

@heroui/agent

v1.0.0-beta.2

Published

Embed a hosted HeroUI Agent that turns application data into interactive UI.

Readme

hero

HeroUI Agents SDK

Embed a hosted generative-UI agent in your React app with @heroui/agent. Declare typed client tools that read your data — the hosted runtime plans the answer, runs calculations in a sandbox, and streams back charts, tables, and metrics.

Installation

npm install @heroui/agent@beta

Import the stylesheet once:

@import "@heroui/agent/css";

Usage

import {HeroUIAgent} from "@heroui/agent/next";

export function AppAgent() {
  return (
    <HeroUIAgent
      agentId={process.env.NEXT_PUBLIC_HEROUI_AGENT_ID!}
      getAuthToken={async (context) => {
        const response = await fetch("/api/heroui-agent/auth-token", {
          method: "POST",
          headers: {"Content-Type": "application/json"},
          body: JSON.stringify(context),
        });

        if (!response.ok) throw new Error("Agent authentication failed");

        return response.json();
      }}
    />
  );
}

Mint the short-lived browser credential on your server — never expose the project API key to the client:

import {createAuthToken} from "@heroui/agent/server";

export async function POST(request: Request) {
  const {anonymousId, agentId} = await request.json();

  return Response.json(
    await createAuthToken({
      apiKey: process.env.HEROUI_AGENT_API_KEY!,
      identity: {id: anonymousId, type: "anonymous"},
      agentId,
    }),
  );
}

Overview

@heroui/agent provides a unified SDK for embedding HeroUI Agents into web applications.

Entrypoints

| Entrypoint | Description | Links | | -------------------------------------------- | -------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | | @heroui/agent | React embed, hooks, and client tools | npmDocs | | @heroui/agent/next | Next.js App Router entry | Docs | | @heroui/agent/server | Server helpers for minting auth tokens | Docs | | @heroui/agent/css | Agent stylesheet | — | | @heroui/agent/contracts | Shared protocol types and schemas | — |

Package Details

@heroui/agent

The core React SDK for embedding a hosted agent.

Features

  • Generative UI — Charts, tables, metrics, and forms streamed from a validated component union
  • Client tools — Typed browser functions that run with the signed-in user's session
  • Dashboard-driven appearance — Theme, launcher, greeting, subtitle, and composer without a redeploy
  • Anonymous → identified — Merge guest history when the user signs in
  • Edge-safe contracts — Protocol types with no Node built-ins

Installation

npm install @heroui/agent@beta

@heroui/agent/next

Next.js App Router entry that mirrors the root export.

import {HeroUIAgent} from "@heroui/agent/next";

@heroui/agent/server

Server-only helpers for exchanging a project API key for a short-lived browser credential.

import {createAuthToken} from "@heroui/agent/server";

Styles

@import "@heroui/agent/css";

Optional Pro theme variants (brutalism, glass, mouve) ship from @heroui-pro/react:

import "@heroui/agent/css";
import "@heroui-pro/react/agent-themes/glass";

Contracts

Shared protocol version, message types, and schemas used by the SDK and hosted API.

import {HEROUI_AGENT_PROTOCOL_VERSION} from "@heroui/agent/contracts";

Client Tools

Client tools let the agent call into your application — fetch data, change filters, create records:

import {HeroUIAgent, createToolHelper} from "@heroui/agent";
import {z} from "zod";

const tool = createToolHelper<{apiClient: ApiClient}>();

const tools = [
  tool({
    name: "search_users",
    description: "Search for users by name or email",
    parameters: z.object({query: z.string()}),
    execute: ({query}, context) => context.apiClient.searchUsers(query),
  }),
];

<HeroUIAgent
  agentId={process.env.NEXT_PUBLIC_HEROUI_AGENT_ID!}
  getAuthToken={getAuthToken}
  context={{apiClient}}
  tools={tools}
/>;

Only tool names, descriptions, and JSON schemas reach the hosted agent. Implementations and context never leave the browser.

Learn more

Documentation

Projects and API keys are managed in the Agents dashboard.

What runs where

The HeroUI API authenticates the visitor once, verifies conversation ownership, and returns a one-use connection ticket. The browser then keeps a resumable WebSocket directly to the conversation's Cloudflare Durable Object. That object owns the transcript, streams from the model provider, and starts MCP or an offline, per-call-scoped sandbox only when a tool actually needs one. Before the composer clears, the SDK durably stores the submitted turn and attachment blobs in an identity-and-conversation-scoped IndexedDB outbox. It removes that entry only after the Durable Object acknowledges committed admission, and reconciles the same turnId after a reload. InstantDB is updated asynchronously for dashboard monitoring and never sits in front of a response stream.

| In the browser | At the HeroUI edge runtime | | ------------------------------------------- | -------------------------------------------- | | Panel, theme, composer, generated UI | Conversation Durable Object and model stream | | Client tools, running as the signed-in user | Server tools, lazy MCP and offline Python | | Pre-admission IndexedDB turn outbox | SDK transcript and resumable stream storage | | A short-lived HeroUI browser credential | Hashed tickets, credit lease, Queue outbox |

Compatibility

  • React 19+
  • Next.js 15+ for @heroui/agent/next
  • Chrome/Edge 120+, Firefox 121+, Safari 17.2+
  • ESM only

This SDK speaks protocol version 6. The hosted API returns 426 Upgrade Required when a beta SDK is no longer compatible.

Support

License

MIT — see LICENSE.


Built by HeroUI