Thanks to visit codestin.com
Credit goes to docs.superagent.sh

Superagent LogoSuperagent

What is Superagent SDK?

An open-source SDK for AI agent safety

Modern AI apps rely on agents that read data, follow instructions, call tools, and produce outputs users trust. These systems fail in ways traditional software does not: prompt injections, data leakage, unsafe tool actions, and workflow failures. Superagent SDK helps developers make their AI apps safe.

Core Methods

The SDK provides four core methods that teams embed directly into their AI app. Run them on inputs, outputs, or intermediate steps. Works with any language model.

npm install safety-agent

Why Superagent SDK

  • Free guard model: No API keys required for guard out of the box
  • Works with any model: OpenAI, Anthropic, Google, Bedrock, Groq, Fireworks, and more
  • Open-weight models: Run Guard on your own infrastructure with 50-100ms latency
  • Low latency: Parallel processing for large inputs and multi-page documents
  • File support: Analyze PDFs, images, and URLs directly
  • Flexible integration: Run on inputs, outputs, or any intermediate step

Quick Example

import { createClient } from "safety-agent";

const client = createClient();

// Guard - Uses default Superagent model (no API keys required)
const guardResult = await client.guard({
  input: "user message to analyze"
});

if (guardResult.classification === "block") {
  console.log("Blocked:", guardResult.violation_types);
}

// Redact - Remove sensitive data
const redactResult = await client.redact({
  input: "My email is [email protected] and SSN is 123-45-6789",
  model: "openai/gpt-4o-mini"
});

console.log(redactResult.redacted);
// "My email is <EMAIL_REDACTED> and SSN is <SSN_REDACTED>"

// Scan - Check repos for threats
const scanResult = await client.scan({
  repo: "https://github.com/user/repo"
});

console.log(scanResult.result);  // Security report

Get Started

Legacy API

Looking for the hosted API with purpose-trained models? See the Legacy documentation.

Support

Need help or have questions? Connect with us: