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

@atbash/atbash-langchain

v0.0.2

Published

Atbash safety guard for LangChain DynamicStructuredTool

Readme

@atbash/atbash-langchain

Guard LangChain tools with Atbash.

This is the lightest Atbash integration — a single function that wraps a DynamicStructuredTool and adds a safety check before the tool runs. No graph changes, no framework lifecycle, just a guarded tool boundary.

Installation

npm install @atbash/atbash-langchain

Peer dependency:

npm install @langchain/core

When To Use It

Use this package when:

  • you already use DynamicStructuredTool
  • you want minimal ceremony
  • you only need Atbash at the tool execution boundary

Use @atbash/langgraph instead when you need graph-level pause/resume on HOLD.

Quick Start

import { createAtbashClient, loadAgent } from "@atbash/sdk";
import { DynamicStructuredTool } from "@langchain/core/tools";
import { withAtbashGuard } from "@atbash/atbash-langchain";
import { z } from "zod";

const agent = loadAgent(process.env.ATBASH_AGENT_PRIVKEY);
const client = createAtbashClient({
  keyPair: { privKey: agent.privkey, pubKey: agent.pubkey },
});

const tool = new DynamicStructuredTool({
  name: "send_bank_transfer",
  description: "Send a bank transfer to an external vendor account",
  schema: z.object({ request: z.string() }),
  func: async (input) => `Executed: ${input.request}`,
});

withAtbashGuard(tool, client);

try {
  const result = await tool.invoke({ request: "Transfer $25 to vendor" });
  console.log(result);
} catch (error) {
  // BLOCK or ERROR — surface error.message to the operator
  console.error(error.message);
}

API

withAtbashGuard(tool, client)

Mutates tool.func in-place. The original tool instance is returned for chaining.

| Parameter | Type | Description | |---|---|---| | tool | DynamicStructuredTool | The tool to guard | | client | AtbashClient | SDK client created with createAtbashClient() |

Returns the same tool instance with its func wrapped.

Verdict Handling

| Verdict | Behavior | |---|---| | ALLOW | Original tool func runs normally | | HOLD | Original tool func runs (HOLD treated as ALLOW) | | BLOCK | Throws Error with the policy reason | | ERROR | Throws Error with the API error message |

Because blocked and errored calls throw, wrap tool invocations in try/catch and handle the error deliberately — do not treat all exceptions as generic crashes.

Creating the Client

Create AtbashClient once at startup and reuse it for every guarded tool:

import { createAtbashClient, loadAgent } from "@atbash/sdk";

const agent = loadAgent(process.env.ATBASH_AGENT_PRIVKEY);
const client = createAtbashClient({
  keyPair: { privKey: agent.privkey, pubKey: agent.pubkey },
  judge: process.env.ATBASH_ENDPOINT
    ? { endpoint: process.env.ATBASH_ENDPOINT }
    : undefined,
});

Environment Variables

| Variable | Required | Description | |---|---|---| | ATBASH_AGENT_PRIVKEY | Yes | Your Atbash agent private key | | ATBASH_ENDPOINT | No | Override the default Atbash endpoint (https://atbash.ai) |

What This Package Does Not Do

  • It does not manage a review queue.
  • It does not pause and resume execution (use @atbash/langgraph for that).
  • It does not guard arbitrary business code — only code behind a wrapped DynamicStructuredTool.

Example

A runnable example is in examples/langchain-runtime-agent/.

npm install && npm run build
cd examples/langchain-runtime-agent && npm install && cd ../..
ATBASH_AGENT_PRIVKEY=your_key_here node examples/langchain-runtime-agent/run.mjs