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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@jlinc/langchain

v0.1.4

Published

A LangChain integration that logs events to the JLINC API.

Readme

JLINC Langchain Integration

The JLINC Langchain Integration is the official way to implement the zero-knowledge third-party auditing and authorization provided by the JLINC Server inside any Langchain-based infrastructure.

By embedding JLINC's trusted protocol directly into Langchain's tracing system, organizations can prove compliance, accountability, and data integrity without ever exposing sensitive information. This seamless integration enables developers to track, verify, and audit model interactions with full transparency while preserving confidentiality through cryptographically verifiable zero-knowledge proofs. Whether for regulated industries, enterprise governance, or AI safety applications, the JLINC Langchain Tracer ensures that trust, privacy, and accountability are built in from the ground up.

Sample auditing application

The below code sample is a demonstration of the JLINC Langchain Integration in action. As data moves through the chain, it is cryptographically signed with a unique key for each element in the chain, and zero-knowledge audit records are delivered to the JLINC Archive Server.

const { ChatOpenAI } = require("@langchain/openai");
const { awaitAllCallbacks } = require("@langchain/core/callbacks/promises");
const { Calculator } = require("@langchain/community/tools/calculator");
const { AgentExecutor, createToolCallingAgent } = require("langchain/agents");
const { ChatPromptTemplate } = require("@langchain/core/prompts");
const { JLINCTracer } = require("@jlinc/langchain");

async function main() {
  const config = {
    dataStoreApiUrl: "http://localhost:9090",
    dataStoreApiKey: process.env.JLINC_DATA_STORE_API_KEY,
    archiveApiUrl: "http://localhost:9090",
    archiveApiKey: process.env.JLINC_ARCHIVE_API_KEY,
    agreementId: "00000000-0000-0000-0000-000000000000",
    systemPrefix: "TracerTest",
    debug: true,
  }

  const tracer = new JLINCTracer(config);

  const llm = new ChatOpenAI({
    openAIApiKey: "n/a",
    configuration: {
      baseURL: "http://localhost:1234/v1",
    },
    modelName: "meta-llama-3.1-8b-instruct",
  });

  const calculator = new Calculator();
  const tools = [calculator];

  const prompt = ChatPromptTemplate.fromMessages([
    ["system", "You are a helpful assistant"],
    ["placeholder", "{chat_history}"],
    ["human", "{input}"],
    ["placeholder", "{agent_scratchpad}"],
  ]);

  const agent = createToolCallingAgent({ llm, tools, prompt });

  const agentExecutor = new AgentExecutor({
    agent,
    tools,
  });

  try {
    const r = await agentExecutor.invoke({ input: "Add 1 + 1" }, {callbacks: [tracer]});
    console.log(`\nResult`)
    console.log(`---------------------------------------------`)
    console.log(r)
  } catch (err) {
    console.error("Error calling LLM:", err);
  } finally {
    await awaitAllCallbacks();
  }
}

main()

Sample authorization code

The JLINC integration also supports AuthZEN-styled authorization pass through to any provider. For instance, the below modifications to the above code would add in authorization to determine if a "public" or "private" tool or LLM can be utilized:

const { ChatOpenAI } = require("@langchain/openai");
const { awaitAllCallbacks } = require("@langchain/core/callbacks/promises");
const { Calculator } = require("@langchain/community/tools/calculator");
const { AgentExecutor, createToolCallingAgent } = require("langchain/agents");
const { ChatPromptTemplate } = require("@langchain/core/prompts");
const { JLINCTracer, JLINCAuthDecision, JLINCAuthBaseChatModel, JLINCAuthTool } = require("../src/index.js");

class CalculatorPrivate extends Calculator {
  static lc_name() {
    return "CalculatorPrivate";
  }
}

class CalculatorPublic extends Calculator {
  static lc_name() {
    return "CalculatorPublic";
  }
}

async function main() {
  const config = {
    dataStoreApiUrl: "http://localhost:9090",
    dataStoreApiKey: process.env.JLINC_DATA_STORE_API_KEY,
    archiveApiUrl: "http://localhost:9090",
    archiveApiKey: process.env.JLINC_ARCHIVE_API_KEY,
    agreementId: "00000000-0000-0000-0000-000000000000",
    systemPrefix: "TestTracerJlinc",
    debug: true,
  }
 
  const jlincAuthDecision = new JLINCAuthDecision(config);
  const auth = {
    subject: {
      type: "user",
      id: "tester",
    },
    action: {
      name: "read",
    },
    resource: {
      type: "data",
      id: "1234",
      properties: {
        ownerID: "[email protected]",
      }
    }
  }
  await jlincAuthDecision.evaluate(auth);

  const tracer = new JLINCTracer(config);

  const authorizedLlm = new ChatOpenAI({
    openAIApiKey: "n/a",
    configuration: {
      baseURL: "http://localhost:1234/v1",
    },
    modelName: "meta-llama-3.1-8b-instruct",
  });
  const notAuthorizedLlm = new ChatOpenAI({
    openAIApiKey: "n/a",
    configuration: {
      baseURL: "http://localhost:1234/v1",
    },
    modelName: "hermes-3-llama-3.1-8b",
  });
  const llm = new JLINCAuthBaseChatModel({
    config,
    jlincAuthDecision,
    targetAuthorized: authorizedLlm,
    targetNotAuthorized: notAuthorizedLlm, // Optional
  });

  const calculatorPublic = new CalculatorPublic();
  calculatorPublic.name = 'calculator_public';
  const calculatorPrivate = new CalculatorPrivate();
  calculatorPrivate.name = 'calculator_private';
  const jlincAuthTool = new JLINCAuthTool({
    config,
    jlincAuthDecision,
    targetAuthorized: calculatorPublic,
    targetNotAuthorized: calculatorPrivate, // Optional
  });
  const tools = [jlincAuthTool];

  const prompt = ChatPromptTemplate.fromMessages([
    ["system", "You are a helpful assistant"],
    ["placeholder", "{chat_history}"],
    ["human", "{input}"],
    ["placeholder", "{agent_scratchpad}"],
  ]);

  const agent = createToolCallingAgent({ llm, tools, prompt });

  const agentExecutor = new AgentExecutor({
    agent,
    tools,
  });

  try {
    const r = await agentExecutor.invoke({ input: "Add 1 + 1. If a function call is used, tell me the output of the function call." }, { callbacks: [tracer] });

    // The next invocation requires a reauth for any future calls to the agent:
    auth.action.name = "write";
    jlincAuthDecision.evaluate(auth);

    console.log(`\nResult`)
    console.log(`---------------------------------------------`)
    console.log(r)
  } catch (err) {
    console.error("Error calling LLM:", err);
  } finally {
    await awaitAllCallbacks();
  }
}

main()

Additional information

Full JLINC Documentation: https://docs.jlinc.io

Details of the JLINC protocol, schema, and context can be found at: https://protocol.jlinc.org/.