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

@agentmark-ai/sdk

v2.0.5

Published

SDK for communicating with the Agentmark hosted platform

Readme

AgentMark SDK

The SDK for tracing LLM calls, running experiments, and integrating with AgentMark Cloud. Built on OpenTelemetry.

Installation

npm install @agentmark-ai/sdk

Quick Start

import { AgentMarkSDK, span } from "@agentmark-ai/sdk";

// Initialize the SDK with your API key
const sdk = new AgentMarkSDK({
  apiKey: process.env.AGENTMARK_API_KEY!,
  appId: process.env.AGENTMARK_APP_ID!,
});

// Start the OpenTelemetry tracer
sdk.initTracing();

// Wrap any LLM call in a span
const { result, traceId } = await span(
  { name: "customer-support", userId: "user-123" },
  async (ctx) => {
    // Your LLM call here — works with any SDK
    const response = await generateText({ /* ... */ });

    // Create child spans for sub-operations
    await ctx.span({ name: "save-to-db" }, async () => {
      await db.saveResponse(response);
    });

    return response;
  }
);

console.log(`Trace: ${traceId}`);

API

AgentMarkSDK

Main SDK class for initialization and cloud integration.

const sdk = new AgentMarkSDK({
  apiKey: string;    // Your AgentMark API key
  appId: string;     // Your AgentMark app ID
  baseUrl?: string;  // Custom API URL (default: https://api.agentmark.co)
  mask?: MaskFunction; // Redact sensitive data before spans are exported
});

Methods:

  • sdk.initTracing(options?) — Start the OpenTelemetry tracer. Options: { disableBatch?: boolean, registerGlobally?: boolean }.
  • sdk.getApiLoader() — Get an ApiLoader instance for loading prompts from AgentMark Cloud.
  • sdk.score(props) — Submit an evaluation score for a trace.
  • sdk.runExperiment(options) — Run a dataset through a task with evaluators, score thresholds, and a regression gate. Use experimentResultToJUnit to emit a JUnit report for CI.

span(options, fn)

Create a root span. Returns { result, traceId }.

const { result, traceId } = await span(
  {
    name: "my-span",           // Required
    userId: "user-123",       // Optional: associate with a user
    sessionId: "session-456", // Optional: group related traces
    sessionName: "chat",      // Optional: human-readable session name
    metadata: { env: "prod" }, // Optional: key-value metadata
  },
  async (ctx) => {
    // ctx.traceId — the trace ID
    // ctx.spanId — the root span ID
    // ctx.setAttribute(key, value) — set span attributes
    // ctx.addEvent(name, attributes?) — add span events
    // ctx.span(options, fn) — create child spans
    return await doWork();
  }
);

ctx.span(options, fn)

Create a child span within a trace. Available on the SpanContext passed to span() and nested span() callbacks.

await span({ name: "request" }, async (ctx) => {
  const user = await ctx.span({ name: "fetch-user" }, async (spanCtx) => {
    return await db.getUser(id);
  });

  await ctx.span({ name: "generate-response" }, async (spanCtx) => {
    return await llm.generate({ user });
  });
});

ApiLoader

Re-exported from @agentmark-ai/loader-api for convenience. Load prompts from AgentMark Cloud or a local dev server.

// Cloud loader (via SDK)
const loader = sdk.getApiLoader();

// Or create directly
import { ApiLoader } from "@agentmark-ai/sdk";

const cloudLoader = ApiLoader.cloud({
  apiKey: "...",
  appId: "...",
});

const localLoader = ApiLoader.local({
  port: 9418,
});

Also exported

  • trace(options, fn) — alias for span(); use it for root spans when the name reads better.
  • observe(fn, options?) / SpanKind — wrap a function so every call is traced.
  • streamWithSpan(...) — trace streaming LLM responses.
  • createPiiMasker(config) — build a mask function that redacts emails, phone numbers, and other PII before spans leave the process. See PII masking.
  • createWebhookRunner(options) — handle cloud-dispatched prompt and experiment runs in your own infrastructure.

Documentation

Full documentation at docs.agentmark.co.

License

AGPL-3.0-or-later