langchain-security

langchain-security is a skill for Claude Code, Codex from Tyox-all/Weave_Protocol. It costs 44 tokens per session (676 once invoked), scanned A, original, Apache-2.0.

A security integration for LangChain.js, a JavaScript framework for building AI workflows and agents.

In plain words
What is it for?
Use it to scan inputs and retrieved documents, block or log threats, redact personal information, and require approval before high-risk tools run.
Why use it?
It adds checks to chains, retrieval-augmented generation pipelines, and tool calls that may handle untrusted input or sensitive data.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to scan inputs and retrieved documents, block or log threats, redact personal information, and require approval before high-risk tools run.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tyox-all/weave_protocol/langchain
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Tyox-all/Weave_Protocol --skill langchain
Clone the repo
git clone --depth 1 https://github.com/Tyox-all/Weave_Protocol

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for langchain-security

README.md
[![agentmods](https://agentmods.dev/badge/skills/tyox-all/weave_protocol/langchain/github.svg)](https://agentmods.dev/skills/tyox-all/weave_protocol/langchain)
Your own site
<a href="https://agentmods.dev/skills/tyox-all/weave_protocol/langchain"><img src="https://agentmods.dev/badge/skills/tyox-all/weave_protocol/langchain/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for langchain-security

Your own site · 80×15
<a href="https://agentmods.dev/skills/tyox-all/weave_protocol/langchain"><img src="https://agentmods.dev/badge/skills/tyox-all/weave_protocol/langchain.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 44 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 676 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00044 $0.00676
Opus 5.5 $0.00018 $0.00270
Sonnet 5.5 $0.00009 $0.00135
Haiku 4.5 $0.00004 $0.00068

Measured 1mo ago against content hash e0113eff0877, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

langchain-security scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

The scan reads SKILL.md. This mod also ships 6 executable files (src/callback.ts, src/index.ts, src/scanner.ts, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

langchain/SKILL.md · 115 lines

How it starts

The opening of the file, as written. The whole thing — 115 lines — stays where its author put it; the contents beside it link to each section on GitHub.

LangChain Security Integration

Add security scanning to LangChain.js applications using Weave Protocol.

When to Use

  • Building LangChain chains or agents that handle untrusted input
  • Implementing RAG pipelines that need document scanning
  • Protecting against prompt injection in production LLM apps
  • Adding approval gates for dangerous tool operations
  • Redacting PII from retrieved documents

Installation

npm install @weave_protocol/langchain @langchain/core

Core Patterns

1. Callback Handler (Recommended)

import { WeaveSecurityCallback } from '@weave_protocol/langchain';

const callback = new WeaveSecurityCallback({
  action: 'block',        // block | warn | log
  minSeverity: 'medium',  // low | medium | high | critical
});

// Works with any LangChain component
const chain = new LLMChain({
  llm,
  prompt,
  callbacks: [callback],
});

2. Secure Tools

import { createSecureTool, createHighRiskTool } from '@weave_protocol/langchain';

// Basic security scanning
const secureTool = createSecureTool(myTool, {
  name: 'my-tool',
  security: { action: 'block' },
});

// Require user approval
const approvedTool = createHighRiskTool(dangerousTool, async (input) => {
  return await askUser(`Execute: ${input}?`);
});

3. Secure Retrievers

import { createSecureRetriever } from '@weave_protocol/langchain';

const secureRetriever = createSecureRetriever(vectorStore.asRetriever(), {
  name: 'docs',
  scanDocuments: true,
  redactSensitive: true,  // Auto-redact PII
});

Presets

import {
  createStrictSecurityCallback,    // Blocks medium+
  createWarningSecurityCallback,   // Logs only
  createProductionSecurityCallback // Blocks high+
} from '@weave_protocol/langchain';

Event Handling

new WeaveSecurityCallback({
  onSecurityEvent: (event) => {
    if (event.threats.length > 0) {
      logger.warn('Threat detected', {
        category: event.threats[0].category,
        mitreId: event.threats[0].mitreId,
      });
    }
  },
});

Read the full file on GitHub · 115 lines

Files

What ships with it

10 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 115 lines · 44 tokens per session scan A e0113eff0877

Subscribe to this mod's changes

langchain-security is a skill published in the GitHub repository Tyox-all/Weave_Protocol (0 stars, last pushed 2d ago), licensed Apache-2.0. It adds 44 tokens to every session and 676 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.