JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 106
  • Score
    100M100P100Q83035F
  • License MIT

TypeScript SDK for the Superagent Guard service.

Package Exports

  • superagent-ai
  • superagent-ai/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (superagent-ai) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Superagent Guard TypeScript SDK

A lightweight client for calling the Superagent Guard endpoint from TypeScript or JavaScript projects.

Installation

npm install superagent-ai
# or
pnpm add superagent-ai
# or
yarn add superagent-ai

Usage

import { createGuard } from "superagent-ai";

const guard = createGuard({
  apiBaseUrl: process.env.SUPERAGENT_GUARD_URL!,
  apiKey: process.env.SUPERAGENT_API_KEY!,
});

const command = "Write a benign hello world script";

const { data, rejected, reasoning } = await guard(command, {
  onBlock: (reason) => {
    console.warn("Guard blocked command:", reason);
  },
  onPass: () => {
    console.log("Guard approved command, continue!");
  },
});

if (rejected) {
  // handle rejection logic
} else {
  // proceed with the approved command
}

Options

  • apiBaseUrl – fully qualified URL for your Guard endpoint.
  • apiKey – API key provisioned in Superagent.
  • fetch – optional custom fetch implementation (defaults to global fetch).
  • timeoutMs – optional timeout for the outbound request.

The guard response includes both the raw analysis payload and the parsed classification, enabling you to plug into custom workflows or audit logs.