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

@anjor-labs/sdk

v0.1.0

Published

JavaScript/TypeScript SDK for the Anjor observability platform

Downloads

72

Readme

@anjor-labs/sdk

JavaScript/TypeScript SDK for the Anjor observability platform. Lets AI agents running in Node.js post tool-call and LLM-call events to the Anjor collector with zero overhead on the agent critical path.

Installation

npm install @anjor-labs/sdk

Requires Node 18+ (uses the built-in fetch and crypto APIs — no runtime dependencies).

Prerequisites

The Anjor collector must be running locally before events will be stored:

anjor start --watch-transcripts
# collector now listening at http://localhost:7843

Quick start

import { anjor } from '@anjor-labs/sdk'

// Create a client — each instance gets its own session + trace IDs
const client = anjor({
  project: 'my-agent',
  agentId:  'worker-1',
})

// --- Tracing a tool call ---------------------------------------------------
// Wrap any async function. On success, a tool_call event is posted.
// On failure, a tool_call event with status: 'error' is posted, then the
// error is rethrown so your agent handles it normally.

const results = await client.traceTool(
  'web_search',                         // tool name shown in the dashboard
  () => mySearchFunction('query'),      // the actual call
  { inputPayload: { query: 'hello' } }  // optional — logged as input
)

// --- Tracing an LLM call ---------------------------------------------------
// Works with OpenAI and Anthropic response shapes out of the box.
// Token usage is extracted automatically and stored.

import Anthropic from '@anthropic-ai/sdk'
const anthropic = new Anthropic()

const message = await client.traceCall(
  'anthropic',                          // provider label shown in dashboard
  () =>
    anthropic.messages.create({
      model: 'claude-opus-4-5',
      max_tokens: 1024,
      messages: [{ role: 'user', content: 'Hello!' }],
    })
)

// Works the same way with OpenAI:
import OpenAI from 'openai'
const openai = new OpenAI()

const completion = await client.traceCall(
  'openai',
  () =>
    openai.chat.completions.create({
      model: 'gpt-4o',
      messages: [{ role: 'user', content: 'Hello!' }],
    })
)

Configuration

| Option | Type | Default | Description | |---|---|---|---| | collectorUrl | string | "http://localhost:7843" | URL of the running Anjor collector | | project | string | "" | Tag all events with this project name (shows in dashboard project filter) | | agentId | string | "default" | Identifier for this agent instance |

Fire-and-forget guarantee

@anjor-labs/sdk never throws into your agent code as a result of observability work. If the collector is not running, if the network is unavailable, or if event serialisation fails, the error is silently swallowed. Your agent always gets back the result it expects from traceTool / traceCall.

This mirrors the anjor.patch() contract in the Python SDK.

Token extraction

traceCall automatically detects the response shape and maps tokens to Anjor's fields:

| Provider | Input field | Output field | Cache read | Cache write | |---|---|---|---|---| | OpenAI | usage.prompt_tokens | usage.completion_tokens | — | — | | Anthropic | usage.input_tokens | usage.output_tokens | usage.cache_read_input_tokens | usage.cache_creation_input_tokens |

TypeScript

Full type definitions are included. The package is written in strict TypeScript and ships .d.ts files — no @types/ package needed.

import type { AnjorConfig, ToolCallEvent, LLMCallEvent } from '@anjor-labs/sdk'