What is Superagent?
Superagent helps developers make their AI apps safe
Modern AI apps rely on agents and LLM workflows that read data, follow instructions, call tools, and produce outputs users trust. These systems fail in ways traditional software does not—data leakage, prompt injections, unsafe tool actions, and workflow failures. Superagent helps developers make their AI apps safe.
Safety Agent SDK
The Safety Agent is an SDK that teams embed directly into their AI app. Run it on inputs, outputs, or intermediate steps—depending on how your agent or workflow is designed. It works with any language model.
npm install @superagent-ai/safety-agentGuard
Detect and block unsafe content: prompt injections, malicious instructions, and unsafe tool calls
Redact
Remove PII, PHI, and secrets from text automatically with placeholder or rewrite modes
Analyze
Deep inspection of files and documents. Returns reasoning, findings, and suggested fixes
Why Safety Agent
- Default Superagent model: No API keys required for guard—works out of the box
- Works with any model: OpenAI, Anthropic, Google, Bedrock, Groq, Fireworks, and more
- 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
- Custom prompts: Override default behavior with your own classification logic
- Proven accuracy: Up to 30% better Guard performance on the Browser Safe benchmark
Quick Example
import { createClient } from "@superagent-ai/safety-agent";
const client = createClient();
// Guard - Uses default Superagent model (no API keys required)
const guardResult = await client.guard({
input: "user message to analyze"
});
// Or specify a different model explicitly
const guardResultWithModel = await client.guard({
input: "user message to analyze",
model: "openai/gpt-4o-mini"
});
if (guardResult.classification === "block") {
console.log("Blocked:", guardResult.violation_types);
}
console.log(`Tokens used: ${guardResult.usage.totalTokens}`);
// Redact - Sanitize sensitive content
const redactResult = await client.redact({
input: "My email is john@example.com and SSN is 123-45-6789",
model: "openai/gpt-4o-mini"
});
console.log(redactResult.redacted);
// "My email is [REDACTED_EMAIL] and SSN is [REDACTED_SSN]"Get Started
Quickstart
Install the SDK and make your first call in minutes
Guard
Detect prompt injections, malicious inputs, and unsafe tool calls
Redact
Remove PII, PHI, and secrets from text automatically
Providers
Supported LLM providers and configuration
Legacy API
Looking for the hosted API with purpose-trained models? See the Legacy SDK/API documentation.
Support
Need help or have questions? Connect with us:
- X (Twitter): Follow @superagent_ai for updates and announcements
- Discord: Join our community at discord.gg/spZ7MnqFT4 for support and discussions
- GitHub: Check out our source code and contribute at github.com/superagent-ai/superagent