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

@breadcrumb-sdk/core

v0.0.10

Published

Trace your AI agents and pipelines with Breadcrumb. **[Documentation](https://breadcrumb.sh/docs)**

Readme

@breadcrumb-sdk/core

Trace your AI agents and pipelines with Breadcrumb. Documentation

Install

npm install @breadcrumb-sdk/core

Quick start

import { init } from "@breadcrumb-sdk/core";

const bc = init({
  apiKey: "bc_...",
  baseUrl: "https://your-breadcrumb-instance.com",
  environment: "production",
});

const answer = await bc.trace("answer-question", async (root) => {
  root.set({ input: "What is TypeScript?" });

  const docs = await bc.span("retrieve", async (span) => {
    span.set({ metadata: { source: "docs", top_k: 5 } });
    return await fetchDocs(query);
  }, { type: "retrieval" });

  const result = await bc.span("generate", async (span) => {
    const output = await callLlm(docs);
    span.set({
      input: docs.join("\n"),
      output: output.text,
      model: "claude-opus-4-6",
      provider: "anthropic",
      input_tokens: output.inputTokens,
      output_tokens: output.outputTokens,
    });
    return output.text;
  }, { type: "llm" });

  root.set({ output: result });
  return result;
});

API

init(options)

Call once at startup. Returns a bc instance you use to create traces and spans.

const bc = init({
  apiKey: string,
  baseUrl: string,
  environment?: string,    // e.g. "production", "staging", "development"
  batching?: false | {
    flushInterval?: number,  // ms between sends (default: 5000)
    maxBatchSize?: number,   // spans per send (default: 100)
  }
})

Set environment once at init time to attach it to every root trace created by this SDK instance. This powers environment filtering in the Breadcrumb UI.

Set batching: false to send each span as it finishes. The default batches them. Either way, everything is flushed before the process exits.


bc.trace(name, fn)

Starts a new top-level trace. Everything you call inside fn that uses bc.span() will be nested under it in the UI.

await bc.trace("my-agent", async (span) => {
  span.set({ input: userMessage });
  // ... your agent logic
});

Always creates a fresh trace — if you call bc.trace() inside another bc.trace(), you get two separate traces, not a nested one. Use bc.span() for nesting.

The span closes automatically when fn returns. If fn throws, the span is marked as failed and the error is rethrown.


bc.span(name, fn, options?)

Adds a step inside the currently running trace. Spans nest automatically — a span inside a span inside a trace shows as a tree in the UI.

If called outside any trace, it starts its own trace.

const result = await bc.span(
  "classify",
  async (span) => {
    span.set({ model: "gpt-4o", provider: "openai" });
    return await classify(input);
  },
  { type: "llm" }
);

Options:

| Option | Values | |--------|--------| | type | "llm" "tool" "retrieval" "step" |


span.set(data)

Attach data to a span. Call it any time while the span is open.

span.set({
  input: "What is TypeScript?",        // shown in the UI
  output: "A typed superset of JS.",   // shown in the UI
  model: "claude-opus-4-6",
  provider: "anthropic",
  input_tokens: 312,
  output_tokens: 58,
  input_cost_usd: 0.00093,
  output_cost_usd: 0.00087,
  metadata: {
    score: 0.95,
    region: "eu-central-1",
  },
});

All fields are optional. null and undefined are ignored.

For input, passing a Message[] array renders the conversation with role labels in the UI — the same way AI SDK spans appear:

import type { Message } from "@breadcrumb-sdk/core";

span.set({
  input: [
    { role: "system", content: "You are a helpful assistant." },
    { role: "user", content: "What is TypeScript?" },
  ] satisfies Message[],
  output: "TypeScript is a typed superset of JavaScript.",
});

| Field | Type | Description | |-------|------|-------------| | input | string \| Message[] \| object | Input passed to this step | | output | string \| object | Output produced by this step | | model | string | Model name, e.g. "gpt-4o" | | provider | string | Provider, e.g. "openai" | | input_tokens | number | Input token count | | output_tokens | number | Output token count | | input_cost_usd | number | Input cost in USD | | output_cost_usd | number | Output cost in USD | | metadata | Record<string, string \| number \| boolean> | Any extra data |

License

AGPL-3.0 — see LICENSE for details.