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

@rankigi/langchain

v1.0.0

Published

LangChain (JS/TS) callback handler that adds RANKIGI cryptographic receipts to every LLM, tool, agent, and retriever step.

Readme

@rankigi/langchain

LangChain (JS/TS) callback handler that adds RANKIGI cryptographic receipts to every LLM, tool, agent, retriever, and LangGraph node.

Compatible with @langchain/core >= 0.3 and LangGraph.

Install

npm install @rankigi/langchain @rankigi/sdk @langchain/core

Setup

First, enroll a connector passport in your RANKIGI dashboard (Agents → New, type "connector"). Copy the credentials into your environment:

RANKIGI_API_KEY=rnk_...
RANKIGI_AGENT_ID=<uuid>
RANKIGI_PASSPORT_ID=<uuid>
RANKIGI_SIGNING_KEY=<base64 ed25519 seed>

Then add the callback to your agent:

import { createRankigiCallback } from "@rankigi/langchain";
import { AgentExecutor } from "langchain/agents";

const executor = new AgentExecutor({
  agent,
  tools,
  callbacks: [createRankigiCallback({ agentTag: "checkout-service-prod" })],
});

Or pass per-invocation:

await executor.invoke(
  { input: "..." },
  { callbacks: [createRankigiCallback({ agentTag: "checkout-service-prod" })] },
);

LangGraph works the same way — pass the callback in the RunnableConfig:

await graph.invoke(state, {
  callbacks: [createRankigiCallback({ agentTag: "research-agent" })],
});

What gets a receipt

| LangChain event | RANKIGI action | |---|---| | handleLLMEnd / handleChatModelStart+End | llm_call | | handleToolEnd | tool_call | | handleAgentAction | agent_action | | handleAgentEnd | agent_finish | | handleChainStart/End (LangGraph nodes + top-level only) | chain_start / chain_end | | handleRetrieverEnd | retrieval | | any *Error callback | *_error with severity: "warn" |

What gets hashed

Prompts, completions, tool inputs, tool outputs, agent reasoning logs, retriever queries, and document contents are SHA-256-hashed locally by the SDK before any network call. Only the hashes plus safe metadata (model name, token counts, latency, run/parent IDs, LangGraph node names) reach RANKIGI.

Safety

Every callback is wrapped in try/catch. SDK or network failures are absorbed silently — the callback never throws into LangChain. The underlying SDK has a durable disk queue that absorbs RANKIGI downtime and retries on the next process boot.

Explicit credentials

If you can't use env vars, pass the credentials directly:

createRankigiCallback({
  apiKey: process.env.RANKIGI_API_KEY!,
  agentId: process.env.RANKIGI_AGENT_ID!,
  passportId: process.env.RANKIGI_PASSPORT_ID!,
  signingPrivateKey: process.env.RANKIGI_SIGNING_KEY!,
  agentTag: "checkout-service-prod",
});

Test injection

For unit tests, pass a mock client:

createRankigiCallback({
  client: { computeHashes: ..., track: async () => {} },
});

Note on method names

The JS LangChain BaseCallbackHandler dispatches by camelCase handle* method names (handleLLMEnd, handleToolEnd, etc.). The on_* snake_case names are the Python SDK convention; in JS the runtime will never call them. This handler exposes the canonical handle* names.

License

MIT