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

agentwatch-sdk

v0.1.9

Published

TypeScript SDK for AgentWatch — observability for multi-agent AI systems

Downloads

26

Readme

AgentWatch TypeScript SDK

TypeScript/JavaScript SDK for AgentWatch — observability for multi-agent AI systems.

Zero runtime dependencies. Works with Node.js 18+ using native fetch.

Installation

npm install agentwatch-sdk
# or
pnpm add agentwatch-sdk
# or
yarn add agentwatch-sdk

Quick Start

import {
  init,
  recordTrace,
  shutdown,
  createInteractionTrace,
  createSpanRecord,
  createAgentNode,
  SpanKind,
} from "agentwatch-sdk";

// Initialize the SDK
init({
  publicKey: "aw_pub_...",
  secretKey: "aw_sec_...",
  endpoint: "http://localhost:8080",
});

// Record a trace
recordTrace(
  createInteractionTrace({
    framework: "custom",
    agents: [
      createAgentNode({ name: "planner", framework: "custom" }),
      createAgentNode({ name: "executor", framework: "custom" }),
    ],
    spans: [
      createSpanRecord({
        name: "agent.planner",
        kind: SpanKind.AGENT,
        inputData: "Plan a trip to Paris",
        outputData: "Here is the itinerary...",
      }),
      createSpanRecord({
        name: "llm.gpt-4o",
        kind: SpanKind.LLM,
        inputData: "System: You are a travel planner...",
        outputData: "I recommend visiting...",
      }),
    ],
  }),
);

// Flush and shut down before process exit
await shutdown();

Configuration

| Option | Env Variable | Default | Description | |--------|-------------|---------|-------------| | publicKey | AGENTWATCH_PUBLIC_KEY | "" | AgentWatch public key | | secretKey | AGENTWATCH_SECRET_KEY | "" | AgentWatch secret key | | endpoint | AGENTWATCH_ENDPOINT | http://localhost:8080 | Backend URL | | flushIntervalMs | — | 500 | Flush interval (ms) | | flushBatchSize | — | 100 | Max traces per flush | | redactionPatterns | — | [] | Regex patterns for PII redaction |

Payload Redaction

Redact sensitive data before it leaves your process:

import { init, REDACT_EMAIL, REDACT_SSN, REDACT_API_KEY } from "agentwatch-sdk";

init({
  redactionPatterns: [REDACT_EMAIL, REDACT_SSN, REDACT_API_KEY],
});

Matching text in span input/output is replaced with [REDACTED] before export.

API Reference

Top-level Functions

  • init(options?) — Initialize the SDK and start the flush loop
  • shutdown() — Async. Flush remaining data and stop the engine
  • recordTrace(trace) — Enqueue a trace for export
  • getEngine() — Get the active engine instance (or null)

Factory Functions

  • createInteractionTrace(overrides?) — Create a trace with defaults
  • createSpanRecord(overrides?) — Create a span with defaults
  • createAgentNode({ name, framework, ...overrides }) — Create an agent node
  • createAgentInteraction({ traceId, fromAgent, toAgent, interactionType, ...overrides }) — Create an interaction

Enums

  • SpanKindAGENT, LLM, TOOL, HANDOFF, GUARDRAIL
  • InteractionTypeHANDOFF, STATE_TRANSFER, DELEGATION

Helpers

  • getAgentCount(trace) — Number of agents in a trace
  • hasError(trace) — Whether any span has error status
  • getDurationMs(trace) — Trace duration in ms (or null)
  • truncatePayload(text) — Truncate to 10,000 chars with suffix

Classes

  • AgentWatchEngine — Core engine (buffer + flush + retry)
  • AgentWatchExporter — OTLP JSON builder + HTTP exporter
  • RedactionConfig — Regex-based payload redaction

License

Apache-2.0