New:Socket for Asana Is Now Available.Learn more
Get Started

@complyedge/sdk

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@complyedge/sdk

TypeScript/JavaScript SDK for ComplyEdge runtime EU AI Act enforcement

Source
npmnpm
Version
0.2.0
Version published
Weekly downloads
158
2533.33%
Maintainers
1
Weekly downloads
 
Created
Source

@complyedge/sdk

TypeScript/JavaScript SDK for ComplyEdge: runtime EU AI Act enforcement for AI agents.

Every check() call is evaluated against a deterministic Rego rule bundle, returns article-cited violations, and is written to an Article 12 audit trail.

Install

npm install @complyedge/sdk

Requires Node.js 18 or later. Get an API key at dashboard.complyedge.io.

Quick start

import { ComplyEdgeClient } from "@complyedge/sdk";

const ce = new ComplyEdgeClient({ apiKey: process.env.COMPLYEDGE_API_KEY! });

const result = await ce.check("Score users based on their social behavior");

if (!result.allowed) {
  console.log("Blocked:", result.violations[0].ruleId);
  console.log("Why:", result.violations[0].ruleDescription);
  console.log("Audit event:", result.eventId);
}

Blocked output:

Blocked: rego-art5-1c-001
Why: Social scoring prohibited under Article 5(1)(c)
Audit event: evt_01J...

Configuration

const ce = new ComplyEdgeClient({
  apiKey: process.env.COMPLYEDGE_API_KEY!,
  jurisdiction: "EU",   // default: "EU"
  agentId: "support-bot", // default: "default"
  timeout: 30_000,      // ms, default: 30_000
  baseUrl: "https://api.complyedge.io", // or COMPLYEDGE_API_URL
});

check(text, context?)

Calls POST /v1/check, the deterministic OPA hot path. Returns:

FieldTypeMeaning
allowedbooleanfalse means block before the model sees it
status"safe" | "violation"Convenience mirror of allowed
violationsComplianceViolation[]Rule ID, description, severity, reason, confidence
eventIdstringIdentifier of the audit record for this decision
auditLoggedbooleanWhether the decision reached the Article 12 trail
enginePathstringopa, opa_fallback_llm, or opa_error
latencyMs / opaLatencyMsnumberServer-reported latency
bundleVersionstringRule bundle the decision was evaluated against
evaluatedRulesstring[]Rule IDs considered

Per-call context overrides the client defaults:

await ce.check(userPrompt, {
  direction: "prompt",     // "prompt" (user input) or "output" (model output)
  jurisdiction: "EU",
  agentId: "hr-screening",
  userRole: "recruiter",   // recorded for audit attribution
});

OpenAI middleware

Wrap an OpenAI client so user messages are checked before they reach the model:

import OpenAI from "openai";
import { ComplyEdgeClient, withCompliance, ComplianceError } from "@complyedge/sdk";

const openai = withCompliance(
  new OpenAI(),
  new ComplyEdgeClient({ apiKey: process.env.COMPLYEDGE_API_KEY! }),
  { jurisdiction: "EU", blockOnViolation: true }
);

try {
  await openai.chat.completions.create({
    model: "gpt-4o",
    messages: [{ role: "user", content: prompt }],
  });
} catch (err) {
  if (err instanceof ComplianceError) {
    // Blocked before the request left your system.
  }
}

openai is an optional peer dependency. Install it only if you use the middleware.

Pre-deployment assessment

const assessment = await ce.assessPreDeployment({
  systemPrompt: "You screen CVs and rank candidates.",
  jurisdiction: "EU",
});

console.log(assessment.riskTier);        // "high"
console.log(assessment.euAiActCategory); // "employment-workers"

detectSensitivity(text, context?)

Legacy sensitivity detection (POST /v1/sensitivity/detect), kept for existing callers. It runs the TrustLint and LLM pipeline, not OPA, and does not write the Article 12 audit trail. Use check() for runtime enforcement.

Errors

Network and HTTP failures surface as AxiosError. The middleware throws ComplianceError when a check blocks a request.

License

Apache-2.0. See LICENSE.

Keywords

compliance

FAQs

Package last updated on 22 Jul 2026

Related posts