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

@trakr/monitor

v0.1.1

Published

Observability SDK for AI agent workflows — automatic Anthropic and OpenAI instrumentation

Readme

@trakr/monitor

Observability for AI agent workflows. Automatically captures Anthropic and OpenAI calls — cost, tokens, latency, and tool use — and sends them to your Trakr dashboard.

Requirements

  • Node.js 18+
  • A Trakr API key (tk_live_... from Settings → API Keys)
  • Optional: @anthropic-ai/sdk and/or openai in your app (not bundled; install only what you use)

Install

npm install @trakr/monitor
# or
pnpm add @trakr/monitor
# or
yarn add @trakr/monitor

Provider SDKs for auto-instrumentation (install in your app):

npm install @anthropic-ai/sdk   # Anthropic
npm install openai              # OpenAI

Quick start

Call init() once before any LLM calls:

import Trakr from '@trakr/monitor';

Trakr.init({ apiKey: process.env.TRAKR_API_KEY });

// Anthropic / OpenAI calls are traced automatically

Or rely on the environment variable:

Trakr.init(); // reads TRAKR_API_KEY

ESM apps: If you import Anthropic or OpenAI, use await Trakr.initAsync() so patches apply to the same module graph:

await Trakr.initAsync({ apiKey: process.env.TRAKR_API_KEY });

Automatic instrumentation

After init, existing client usage stays the same:

import Anthropic from '@anthropic-ai/sdk';

const client = new Anthropic();

await client.messages.create({
  model: 'claude-sonnet-4-6',
  max_tokens: 1024,
  messages: [{ role: 'user', content: 'Hello' }],
});

No wrappers or callbacks required. The SDK never throws on ingest failures and does not block your request path (events batch asynchronously).

Manual workflow runs

Group multi-step work under a named run in the dashboard:

const run = Trakr.startRun('invoice-extractor', {
  metadata: { invoice_id: 'INV-001' },
});

try {
  const result = await extractInvoice(document);
  await run.end({ status: 'success' });
  return result;
} catch (error) {
  await run.end({
    status: 'error',
    errorMessage: error instanceof Error ? error.message : String(error),
  });
  throw error;
}

Scripts and serverless

Long-running servers flush on a timer. For short-lived processes, flush before exit:

await Trakr.flush();

Configuration

| Option | Default | Description | |--------|---------|-------------| | apiKey | TRAKR_API_KEY env | SDK API key (tk_live_...) | | endpoint | https://app.trakr.run/api/ingest | Ingest URL override | | batchSize | 10 | Events per upload batch | | flushIntervalMs | 2000 | Max time between uploads | | loopDetectionThreshold | 5 | Consecutive identical tool calls before loop_detected | | disabled | false | Disable all instrumentation | | debug | false | Log SDK activity to console |

API

Trakr.init(options?: TrakrInitOptions): void;
Trakr.initAsync(options?: TrakrInitOptions): Promise<void>;
Trakr.startRun(workflowName: string, options?): Run;
Trakr.flush(): Promise<void>;
Trakr.disable(): void;
Trakr.version: string;

run.end({ status: 'success' | 'error', errorMessage?: string }): Promise<void>;
run.setMetadata(key, value): void;

Documentation

Support

Questions or issues: [email protected]

License

MIT