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

@sentinelseed/voltagent

v0.2.2

Published

AI safety guardrails for VoltAgent: THSP protocol validation, OWASP protection, and PII detection for autonomous AI agents

Readme

@sentinelseed/voltagent

AI safety guardrails for VoltAgent applications. Implements THSP protocol validation, OWASP security protection, and PII detection/redaction.

License: MIT

Features

  • THSP Protocol: Truth, Harm, Scope, Purpose validation gates
  • OWASP Protection: SQL injection, XSS, command injection, SSRF detection
  • PII Detection: Email, phone, SSN, credit card, API keys, and more
  • Streaming Support: Real-time PII redaction for streaming responses
  • VoltAgent Native: Works directly with VoltAgent's guardrail system

Installation

npm install @sentinelseed/voltagent

Quick Start

The simplest way to add Sentinel protection to your VoltAgent agent:

import { Agent } from "@voltagent/core";
import { createSentinelGuardrails } from "@sentinelseed/voltagent";

// Create guardrails with preset configuration
const { inputGuardrails, outputGuardrails } = createSentinelGuardrails({
  level: "strict",
  enablePII: true,
});

// Add to your agent
const agent = new Agent({
  name: "safe-agent",
  inputGuardrails,
  outputGuardrails,
});

Configuration Presets

| Level | Description | |-------|-------------| | permissive | Log only, no blocking. Good for development. | | standard | Block unsafe content, THSP + OWASP enabled. Recommended for production. | | strict | All validations, block on any issue. For high-security applications. |

Usage Examples

Basic Input Protection

import { createSentinelInputGuardrail } from "@sentinelseed/voltagent";

const inputGuard = createSentinelInputGuardrail({
  enableTHSP: true,
  enableOWASP: true,
  blockUnsafe: true,
});

const agent = new Agent({
  inputGuardrails: [inputGuard],
});

PII Redaction in Responses

import { createSentinelOutputGuardrail } from "@sentinelseed/voltagent";

const outputGuard = createSentinelOutputGuardrail({
  enablePII: true,
  redactPII: true,
});

const agent = new Agent({
  outputGuardrails: [outputGuard],
});

// Input: "Contact [email protected] or call 555-123-4567"
// Output: "Contact [EMAIL] or call [PHONE]"

Specialized Guardrails

import {
  createChatGuardrails,
  createAgentGuardrails,
  createPrivacyGuardrails,
} from "@sentinelseed/voltagent";

// For chat applications (jailbreak prevention)
const chatGuards = createChatGuardrails();

// For agent applications (tool call protection)
const agentGuards = createAgentGuardrails();

// For privacy-sensitive applications (full PII protection)
const privacyGuards = createPrivacyGuardrails();

Custom Patterns

const guard = createSentinelInputGuardrail({
  customPatterns: [
    {
      pattern: /internal\s+only/i,
      name: "Internal content restriction",
      gate: "scope",
      severity: "high",
    },
  ],
});

THSP Protocol

The THSP protocol validates content against four safety gates:

| Gate | Description | Example Violations | |------|-------------|-------------------| | Truth | Factual accuracy | Fake documents, impersonation | | Harm | Potential for harm | Violence, malware, theft | | Scope | Operational boundaries | Jailbreaks, persona switching | | Purpose | Legitimate intent | Purposeless destruction |

OWASP Protection

Detects common security vulnerabilities:

  • SQL Injection
  • Cross-Site Scripting (XSS)
  • Command Injection
  • Path Traversal
  • Server-Side Request Forgery (SSRF)
  • Prompt Injection
  • Sensitive Data Exposure

PII Types Detected

  • Email addresses
  • Phone numbers
  • Social Security Numbers
  • Credit card numbers
  • IP addresses
  • Dates of birth
  • API keys / AWS keys
  • Private keys
  • JWT tokens
  • Passport numbers
  • Driver license numbers

Streaming Support

For streaming responses, use the stream handler:

import { createSentinelPIIRedactor } from "@sentinelseed/voltagent";

const piiRedactor = createSentinelPIIRedactor({
  enablePII: true,
  piiTypes: ["EMAIL", "PHONE", "SSN"],
});

const guardrail = {
  name: "pii-stream-redactor",
  handler: async (args) => ({ pass: true }),
  streamHandler: piiRedactor,
};

API Reference

Bundle Functions

| Function | Description | |----------|-------------| | createSentinelGuardrails(config) | Create complete input/output guardrail bundle | | createChatGuardrails() | Preset for chat applications | | createAgentGuardrails() | Preset for agent applications | | createPrivacyGuardrails() | Preset for privacy-focused applications | | createDevelopmentGuardrails(logger) | Permissive preset for development |

Input Guardrails

| Function | Description | |----------|-------------| | createSentinelInputGuardrail(config) | Main input guardrail factory | | createStrictInputGuardrail() | Strict preset | | createPermissiveInputGuardrail(logger) | Log-only preset | | createTHSPOnlyGuardrail() | THSP validation only | | createOWASPOnlyGuardrail() | OWASP validation only |

Output Guardrails

| Function | Description | |----------|-------------| | createSentinelOutputGuardrail(config) | Main output guardrail factory | | createPIIOutputGuardrail(options) | PII-focused output guardrail | | createStrictOutputGuardrail() | Block on any sensitive content | | createPermissiveOutputGuardrail(logger) | Redact only, no blocking |

Streaming Handlers

| Function | Description | |----------|-------------| | createSentinelPIIRedactor(config) | Streaming PII redactor | | createStrictStreamingRedactor(config) | Abort on sensitive content | | createPermissiveStreamingRedactor(types) | PII redaction only | | createMonitoringStreamHandler(logger) | Detection without modification |

Validators (Advanced)

| Function | Description | |----------|-------------| | validateTHSP(content, context, patterns) | Run THSP validation | | validateOWASP(content, checks, patterns) | Run OWASP validation | | detectPII(content, types, patterns) | Detect PII in content | | redactPII(content, types, format) | Redact PII from content | | quickCheck(content) | Fast THSP check | | quickOWASPCheck(content) | Fast OWASP check | | hasPII(content) | Quick PII detection |

Configuration Options

interface SentinelGuardrailConfig {
  // Behavior
  blockUnsafe?: boolean;           // Block unsafe content (default: true)
  logChecks?: boolean;             // Enable logging (default: false)
  logger?: (msg, data) => void;    // Custom logger function

  // Validation modules
  enableTHSP?: boolean;            // Enable THSP (default: true)
  enableOWASP?: boolean;           // Enable OWASP (default: true)
  enablePII?: boolean;             // Enable PII detection (default: false)

  // THSP options
  customPatterns?: PatternDefinition[];
  skipActions?: string[];
  minBlockLevel?: RiskLevel;       // 'low' | 'medium' | 'high' | 'critical'

  // OWASP options
  owaspChecks?: OWASPViolationType[];
  customOWASPPatterns?: OWASPPatternDefinition[];

  // PII options
  piiTypes?: PIIType[];
  redactPII?: boolean;
  redactionFormat?: string | ((type, value) => string);

  // Performance
  maxContentLength?: number;       // Max content length (default: 100000)
  timeout?: number;                // Timeout in ms (default: 5000)
}

Requirements

  • Node.js >= 18.0.0
  • VoltAgent >= 0.1.0 (tested with @voltagent/core v1.5.2)

Development

This package depends on @anthropic/sentinel-core which provides the THSP validation patterns. When developing locally, the dependency is resolved via file:../core in the monorepo structure.

For production npm installations, the core patterns are bundled during the build process. If you're building from source, ensure you have the full monorepo cloned:

git clone https://github.com/sentinel-seed/sentinel.git
cd sentinel
npm install
npm run build -w packages/core
npm run build -w packages/voltagent

Related Packages

Links

License

MIT License (see LICENSE for details)


Built by Sentinel Team