superagent

Frameworks & SDKs 💻 TypeScript ⚖️ MIT 🟢 Actively maintained
6.7k stars

Superagent SDK is an open-source toolkit for AI agent safety. It blocks prompt injections, redacts PII and secrets, scans repositories for threats, and runs red team scenarios. It is for developers building AI applications who need runtime security and compliance.

✨ Key features

  • Guard: Detect and block prompt injections and unsafe tool calls at runtime.
  • Redact: Automatically remove PII, PHI, and secrets from text.
  • Scan: Analyze repositories for AI agent-targeted attacks like repo poisoning.
  • Test: Run red team scenarios against production agents (coming soon).
  • Works with any model: OpenAI, Anthropic, Google, Groq, Bedrock, etc.
  • Open-weight models: Run Guard on your infrastructure with 50-100ms latency.

🎯 Use cases

  • Protect AI chatbots from prompt injection attacks.
  • Sanitize user inputs to remove personal data before processing.
  • Audit code repositories for malicious instructions before integration.
  • Automate security testing of AI agents with red team scenarios.

📦 Installation

🧰 Requirements: Requires an API key from superagent.sh; supports TypeScript and Python runtimes.

TypeScript

npm install safety-agent

Python

uv add safety-agent

Set your API key:

export SUPERAGENT_API_KEY=your-key

🚀 Usage

TypeScript

import { createClient } from "safety-agent";

const client = createClient();

const result = await client.guard({
  input: userMessage
});

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

Python

from safety_agent import create_client

client = create_client()

result = await client.guard(input=user_message)

if result.classification == "block":
    print("Blocked:", result.violation_types)

⚠️ Good to know

The Test feature is coming soon and not yet available.

❓ FAQ

What models are supported?

The SDK works with any model, including OpenAI, Anthropic, Google, Groq, and Bedrock.

Can I run Guard on my own infrastructure?

Yes, open-weight models are available for running Guard on your infrastructure with 50-100ms latency.

How do I get an API key?

Sign up at superagent.sh to get your API key.

Is the SDK open source?

Yes, it is MIT licensed with full transparency.

📊 Repository

Stars★ 6,729
Forks🍴 960
Open issues🐛 16
Last commit🕒 Aug 25, 2026
Created📅 May 2023
Language💻 TypeScript
License⚖️ MIT

🤖 Overview, features, install steps and FAQ were generated from the project's README on Sep 4, 2026. Always check the original source before running commands.