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

@codesec-ai/agentguard

v1.0.1

Published

Official TypeScript & Node.js SDK for the AgentGuard AI Agent Security Gateway

Readme

@codesec-ai/agentguard

Official Node.js & TypeScript SDK for the AgentGuard AI Agent Security Gateway.

AgentGuard intercepts, evaluates, and verifies autonomous AI agent actions against deterministic spending limits, currency controls, capability whitelists, and adversarial prompt injection heuristic scans before downstream payment APIs (such as Razorpay or PayPal) are executed.


Installation

npm install @codesec-ai/agentguard
# or
yarn add @codesec-ai/agentguard
# or
pnpm add @codesec-ai/agentguard

Quickstart

ESM (TypeScript / Modern Node)

import { AgentGuard } from '@codesec-ai/agentguard';

const agentguard = new AgentGuard({
  baseUrl: process.env.AGENTGUARD_URL || 'http://localhost:3001',
  apiKey: process.env.AGENTGUARD_API_KEY!,
  timeoutMs: 5000,
});

CommonJS

const { AgentGuard } = require('@codesec-ai/agentguard');

const agentguard = new AgentGuard({
  baseUrl: process.env.AGENTGUARD_URL || 'http://localhost:3001',
  apiKey: process.env.AGENTGUARD_API_KEY,
});

Pre-flight Action Evaluation

async function handleAgentCheckout() {
  const decision = await agentguard.evaluate({
    action: 'payment.create',
    amount: 1200.0,
    currency: 'INR',
    recipient: '[email protected]',
    description: 'Autonomous grocery restocking order',
    promptContext: 'User prompt: Restock organic coffee and paper towels.',
  });

  if (decision.status === 'ALLOW') {
    console.log(`Action permitted! Policy version: ${decision.policyVersion}`);
    console.log(`Server authorization token: ${decision.authorizationToken}`);
    // Pass decision.authorizationToken to your backend payment rail (e.g. Razorpay/PayPal)
  } else if (decision.status === 'HOLD') {
    console.warn(`Action held for human review: ${decision.pendingApprovalId}`);
    // Wait for operator review: const approval = await agentguard.waitForApproval(decision.pendingApprovalId!);
  } else {
    console.error(`Blocked by AgentGuard: ${decision.reason}`, decision.violations);
    // Abort execution
  }
}

Adversarial Prompt Scanning

async function scanUserInput(prompt: string) {
  const scan = await agentguard.scanPrompt(prompt);
  if (scan.isThreatDetected) {
    console.warn(`Prompt threat detected [${scan.threatLevel}]:`, scan.findings);
    return false;
  }
  return true;
}

Security Boundary Notice

Important: AgentGuard SDK evaluates proposed agent operations against deterministic policies and issues single-use cryptographic authorization tokens (decision.authorizationToken). The SDK itself does not execute or settle real payments. Your application must pass this authorization token to your server-side payment execution endpoint, where it is verified before funds move.


Key Features

  • Strict Fail-Closed Guarantee: Timeouts, network interruptions, and gateway outages strictly reject operations rather than failing open. Use evaluateSafely() to guarantee an authoritative BLOCK decision without uncaught exceptions.
  • Human-in-the-Loop (HITL) Support: High-value transactions trigger HOLD state and return pendingApprovalId. Poll with client.waitForApproval(id).
  • Adversarial Prompt Scanning: Provide promptContext or use client.scanPrompt(input) to detect prompt injection attempts before money moves. Returns structured findings even when threats trigger HTTP 403.
  • Dual Export: Full support for both ECMAScript Modules (ESM) and CommonJS (CJS).
  • TypeScript First: Full type definitions included out of the box.

License

MIT © AgentGuard Security Team