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

@agentreceipt/sdk

v0.2.0

Published

TypeScript SDK for AgentReceipt, capture immutable audit trails of AI agent actions

Readme

@agentreceipt/sdk

TypeScript SDK for AgentReceipt. Capture immutable audit trails of every action your AI agent takes.

Installation

npm install @agentreceipt/sdk

Environment variable

Set AGENTRECEIPT_API_KEY in your environment. You can get your key from the AgentReceipt dashboard.

export AGENTRECEIPT_API_KEY="ar_live_..."

Quickstart: OpenAI

import OpenAI from "openai";
import { createClient } from "@agentreceipt/sdk";

const ar = createClient({ apiKey: process.env.AGENTRECEIPT_API_KEY! });
const openai = ar.wrapOpenAI(new OpenAI(), {
  sessionName: "Process invoice #441",
});

const response = await openai.chat.completions.create({
  model: "gpt-4o",
  messages: [{ role: "user", content: "Parse this invoice." }],
});

Quickstart: Anthropic

import Anthropic from "@anthropic-ai/sdk";
import { createClient } from "@agentreceipt/sdk";

const ar = createClient({ apiKey: process.env.AGENTRECEIPT_API_KEY! });
const anthropic = ar.wrapAnthropic(new Anthropic(), {
  sessionName: "Review support ticket #89",
});

const response = await anthropic.messages.create({
  model: "claude-sonnet-4-6",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Summarize this ticket." }],
});

Quickstart: Gemini

import { GoogleGenAI } from "@google/genai";
import { createClient } from "@agentreceipt/sdk";

const ar = createClient({ apiKey: process.env.AGENTRECEIPT_API_KEY! });
const ai = ar.wrapGemini(
  new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY! }),
  {
    sessionName: "Classify document",
  },
);

const response = await ai.models.generateContent({
  model: "gemini-2.0-flash",
  contents: "What type of document is this?",
});

Quickstart: Mistral

import { Mistral } from "@mistralai/mistralai";
import { createClient } from "@agentreceipt/sdk";

const ar = createClient({ apiKey: process.env.AGENTRECEIPT_API_KEY! });
const mistral = ar.wrapMistral(
  new Mistral({ apiKey: process.env.MISTRAL_API_KEY! }),
  {
    sessionName: "Extract receipt data",
  },
);

const response = await mistral.chat.complete({
  model: "mistral-small-latest",
  messages: [{ role: "user", content: "Extract the total from this receipt." }],
});

Quickstart: Vercel AI SDK

import { generateText, streamText, generateObject, streamObject } from "ai";
import { openai } from "@ai-sdk/openai";
import { createClient } from "@agentreceipt/sdk";

const ar = createClient({ apiKey: process.env.AGENTRECEIPT_API_KEY! });
const wrapped = ar.wrapVercelAI(
  { generateText, streamText, generateObject, streamObject },
  {
    sessionName: "Chat session #12",
  },
);

const result = await wrapped.generateText({
  model: openai("gpt-4o-mini"),
  prompt: "Reply with exactly three words.",
});

Sessions

Every wrapper creates one session automatically. For most apps, you want one session per task. Create a new wrapper per request.

async function handleTicket(ticket: Ticket) {
  const anthropic = ar.wrapAnthropic(new Anthropic(), {
    sessionName: `Ticket #${ticket.id}`,
  });
  await anthropic.messages.create({ ... });
}

You can also create sessions manually with startSession.

const session = ar.startSession("Process invoice #441");

trackTool

Wraps an async function and records its input, output, and duration. If the function throws, the error is recorded and re-thrown.

const vendor = await session.trackTool(
  "look-up-vendor",
  { vendorName: "Acme Corp" },
  async () => {
    return db.vendors.findByName("Acme Corp");
  },
);

trackDecision

Records a decision your agent made. Takes a name, reasoning, and outcome.

await session.trackDecision(
  "approve-payment",
  "Amount $450 is within $500 auto-approval limit. Vendor is verified.",
  "approved",
);

trackHumanReview

Records a human review step. Useful for approval workflows where a person signs off before the agent proceeds.

await session.trackHumanReview({
  reviewer: "[email protected]",
  decision: "approved",
  notes: "Amount within $5,000 auto-approval policy",
});

The decision field accepts "approved", "rejected", or "modified".

Human review events appear with a purple badge in the dashboard. No payload is stored in R2 for this event type.

Compliance metadata

Tag any event with compliance metadata to flag sensitive data. Events with containsPII: true or a dataCategory show a PII badge in the dashboard.

await session.trackTool(
  "read-patient-record",
  { patientId: "pt-1234" },
  async () => fetchPatientRecord("pt-1234"),
  {
    compliance: {
      containsPII: true,
      dataCategory: "health",
      retentionOverride: 2190, // days, overrides project default
    },
  },
);

Works with trackDecision and trackHumanReview too.

await session.trackDecision(
  "approve-referral",
  "Patient meets criteria for specialist referral.",
  "approved",
  { compliance: { containsPII: true, dataCategory: "health" } },
);

await session.trackHumanReview({
  reviewer: "[email protected]",
  decision: "approved",
  compliance: { containsPII: false, dataCategory: "health" },
});

Ending a session

Call end() to flush any queued events and mark the session as complete. This triggers summary generation and Rekor anchoring right away rather than waiting for the inactivity timeout. If you do not call end(), the session completes automatically after 3 minutes of inactivity.

Always use a try/finally block so end() runs even if your agent throws an error.

const session = ar.startSession("Process invoice #441");

try {
  // your agent logic
} finally {
  await session.end(); // always call this when your agent finishes
}

Configuration

const ar = createClient({
  apiKey: "ar_live_...",
  baseUrl: "https://agentreceipt.co", // optional, defaults to production
});

Links