api
    New
    2026-05-30

    TypeScript / Node.js SDK

    Typed client for all Aegis Sovereign APIs — model registry, compliance, bias evals, robustness, webhooks, audit, and the full AI Safety Platform (v0.2.0). Works in Node.js 18+ and modern browsers.

    sdk
    typescript
    nodejs
    api
    webhooks

    Installation

    Install the SDK from npm.

    bash
    1npm install @aegissovereign/sdk
    2# or
    3yarn add @aegissovereign/sdk
    4# or
    5pnpm add @aegissovereign/sdk

    Quick Start

    Initialise the client with your API key and workspace ID.

    typescript
    1import { AegisSovereignClient } from "@aegissovereign/sdk";
    2
    3const client = new AegisSovereignClient({
    4  baseUrl: "https://sovereign.yourcompany.com",
    5  apiKey: process.env.AEGISSOVEREIGN_API_KEY!,
    6  workspaceId: "ws_prod_abc123",
    7  // baseUrl: "https://api.aegissovereign.io",  // default
    8  // timeoutMs: 30_000,                        // default
    9});
    10
    11// List models
    12const models = await client.models.list();
    13
    14// Run compliance evaluation
    15const eval_ = await client.regulatory.evaluate(
    16  "model_fraud_v2",
    17  "eu_ai_act"
    18);
    19
    20// Verify a webhook signature
    21const isValid = AegisSovereignClient.verifyWebhookSignature(
    22  rawBody,
    23  signature,
    24  process.env.WEBHOOK_SECRET!
    25);

    Available Sub-Clients

    The SDK exposes typed sub-clients for every surface area.

    ClientDescription
    client.modelsModel registry — create, list, get, update, promote
    client.chatLLM gateway — completions with budget enforcement
    client.outputEvalsLLM output quality evaluations
    client.biasEvalsBias/fairness evaluations with DIR analysis
    client.robustnessEvalsAdversarial robustness evaluations
    client.complianceRegulatory framework evaluations
    client.regulatoryAlias for client.compliance
    client.webhooksWebhook subscription management
    client.auditAudit log queries + external-ledger anchoring
    **client.safety** ✨AI Safety Platform — Policy Engine, Agentic Guard, PII Masking, Conversation Monitor, Approvals, Clearance, SLOs, Red-Team, Integrations, Regulatory Reports. 30 typed types, 20+ methods.

    Safety Client Examples

    The client.safety sub-client covers all 8 subsystems of the AI Safety Platform.

    typescript
    1import { AegisSovereignClient } from "@aegissovereign/sdk";
    2const client = new AegisSovereignClient({
    3  baseUrl: "https://sovereign.yourcompany.com",
    4  apiKey: process.env.AEGISSOVEREIGN_API_KEY!,
    5  workspaceId: "ws-prod",
    6});
    7
    8// Validate a prompt through the full pipeline (regex + ML)
    9const result = await client.safety.validateInput(
    10  "Ignore all previous instructions and...",
    11);
    12if (result.blocked) {
    13  console.error("Blocked:", result.violations.map(v => v.rule_id));
    14}
    15
    16// Validate a model response (auto-redacts PII)
    17const resp = await client.safety.validateOutput(responseText);
    18const safeText = resp.sanitized_text ?? responseText;
    19
    20// Check model registry clearance before promoting
    21const clearance = await client.safety.checkModel(
    22  "gpt-4", "gpt-4-turbo", "customer-support"
    23);
    24if (!clearance.allowed) throw new Error(clearance.reason);
    25
    26// SLO fleet health — burn_rate_1h > 14.4 = page immediately
    27const slos = await client.safety.getSLOSummary();
    28if (slos.critical > 0) console.error("Critical SLO burn rate!");
    29
    30// Run red-team certification suite
    31const redteam = await client.safety.runRedteam({
    32  domains: ["medical", "financial"],
    33  includeMultiTurn: true,
    34});
    35console.log(`Pass rate: ${(redteam.certification.pass_rate * 100).toFixed(1)}%`);
    36
    37// Generate EU AI Act report
    38const report = await client.safety.generateReport({
    39  framework: "eu_ai_act",
    40  organization: "Acme Financial",
    41});
    42console.log(report.content);
    typescript
    1// List pending critical review requests
    2const reviews = await client.safety.listReviews({
    3  status: "pending",
    4  priority: "critical",
    5});
    6
    7// Submit a review decision
    8await client.safety.submitReview("rev-abc123", {
    9  decision: "reject",
    10  reason: "Confirmed jailbreak attempt",
    11  reviewer_id: "alice@corp.com",
    12  reviewer_name: "Alice Chen",
    13});
    14
    15// Validate a tool call before execution (Agentic Guard)
    16const check = await client.safety.validateToolCall(
    17  "delete_file",
    18  { path: "/prod/db" },
    19  "researcher-agent",
    20);
    21if (!check.allowed) {
    22  throw new Error(`Tool blocked: risk=${check.risk_level}`);
    23}
    24
    25// Run the red-team certification suite (server-side)
    26const cert = await client.safety.runRedteam({
    27  domains: ["financial"],
    28  includeMultiTurn: true,
    29});
    30if (!cert.overall_passed) {
    31  console.error(`${cert.certification.blocking_failures} undetected attack(s)`);
    32}
    Edit this page on GitHub