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-langgraph

v0.0.1

Published

Atbash safety guard and audit nodes for LangGraph workflows

Downloads

139

Readme

@atbash/atbash-langgraph

Add Atbash as a safety guard inside a LangGraph workflow.

This package adds a guard node before tool execution and an audit node after, using native LangGraph interrupt semantics for HOLD verdicts.

Installation

npm install @atbash/atbash-langgraph

Peer dependencies:

npm install @langchain/core @langchain/langgraph

When To Use It

Use this package when:

  • your app already uses LangGraph
  • your graph has a distinct agent phase and tools phase
  • you want HOLD to pause execution using LangGraph interrupt semantics
  • you want audit logging after the tool phase

Quick Start

import { loadAgent } from "@atbash/sdk";
import { StateGraph, START, END, MemorySaver } from "@langchain/langgraph";
import { AtbashStateAnnotation, addAtbashSafety } from "@atbash/atbash-langgraph";

const builder = new StateGraph(AtbashStateAnnotation)
  .addNode("agent", agentNode)
  .addNode("tools", toolsNode)
  .addEdge(START, "agent")
  .addConditionalEdges("agent", routeAfterAgent);

addAtbashSafety(builder, {
  privkey: process.env.ATBASH_AGENT_PRIVKEY,
});

const app = builder.compile({ checkpointer: new MemorySaver() });

API

addAtbashSafety(builder, opts)

Convenience helper that wires atbash_guard and atbash_audit into your graph.

Assumes your graph has nodes named agent and tools. If your layout differs, use createGuardNode() and createAuditNode() directly.

| Option | Type | Description | |---|---|---| | privkey | string | Agent private key (falls back to ATBASH_AGENT_PRIVKEY env var) | | agent | AgentAuth | Pre-loaded agent (alternative to privkey) | | endpoint | string | Override Atbash endpoint |

createGuardNode(opts)

Creates the pre-tool safety node. Calls client.auditToolCall() for every tool call in the last AI message.

Returns a node function that writes atbashVerdict, atbashReason, atbashToolCallId to state.

createAuditNode(opts)

Creates the post-tool audit node. Fire-and-forget call to logToolCall() — errors are suppressed so they never break the graph.

AtbashStateAnnotation

Extends MessagesAnnotation with Atbash fields:

| Field | Type | Description | |---|---|---| | atbashVerdict | string \| null | Last verdict from the guard node | | atbashReason | string \| null | Reason from the judge | | atbashToolCallId | string \| null | Tool call ID for polling or HOLD resume | | atbashConfidence | number \| null | Confidence score |

createJudgeTool(agent, endpoint?)

Optional: creates an atbash_safety_check LangChain tool for direct LLM access to the judge.

Verdict Handling

| Verdict | Meaning | Graph Behavior | |---|---|---| | ALLOW | Safe to proceed | Routes to tools node | | HOLD | Needs human review | Graph interrupts; resume with Command({ resume: "approve" }) | | BLOCK | Policy violation | Injects blocked ToolMessage; routes back to agent | | ERROR | Judge unreachable | Treated as BLOCK — fail closed |

HOLD / Resume Pattern

import { Command, isInterrupted } from "@langchain/langgraph";

const result = await app.invoke(input, config);

if (isInterrupted(result)) {
  const payload = result.__interrupt__[0]?.value;
  // show payload to operator ...

  const approved = await app.invoke(
    new Command({ resume: "approve" }),
    config,
  );
}

Environment Variables

| Variable | Required | Description | |---|---|---| | ATBASH_AGENT_PRIVKEY | Yes (if not passing agent) | 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 invent your graph structure.
  • It does not automatically find your tool node if you use a custom layout.
  • It does not execute operator review — it only exposes pause/resume mechanics.

Example

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

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