Skip to main content

SecureAI Python SDK (secureai-sdk)

PyPI Version Python Versions License Website

SecureAI is the enterprise cybersecurity armor for Large Language Models (LLMs), AI coding agents, and autonomous multi-agent workflows. Powered by AcadmyAI (https://secure.acadmyai.com).


Key Capabilities

  1. Sub-0.5ms In-Process Guardrails (@guard): Intercepts direct prompt injection, DAN jailbreaks, synthetic delimiters, and toxic content in-memory before reaching LLMs.
  2. Autonomous Agent Runtime Action Firewall (intercept_agent_action): Intercepts filesystem reads/writes (.env, credentials), shell command executions (rm -rf, curl | sh), and outbound network egress (SSRF). Automatically rewrites dangerous commands into secure sandboxed operations.
  3. MLSecOps Model Vulnerability Scanner (scan_model_artifact): Scans serialized ML model artifacts (.pkl, .pt, .safetensors, .onnx) to detect remote code execution opcodes (__reduce__, eval, exec, subprocess.Popen) and trojans.
  4. Reversible Zero-Knowledge PII Vault (tokenize_pii / detokenize_pii): Redacts SSNs, credit cards, emails, passwords, and API keys with AES-256 synthetic surrogate tokens upstream.
  5. Model Context Protocol (MCP) Governance (authorize_mcp_tool): AST parameter sanitization for Claude Desktop, Cursor, and custom agent tool calls.
  6. Automated AI Red Teaming (run_redteam_simulation): Automated adversarial vulnerability testing across OWASP LLM01–LLM10.
  7. Canary Honeytoken Deception (generate_canary_token / verify_canary_leakage): Injects signed honeytokens to detect system prompt extraction.
  8. Compliance Reporting (get_compliance_report): Audit-ready mapping for the EU AI Act (2025) and ISO/IEC 42001.

Installation

pip install --upgrade secureai-sdk

Quickstart

1. Function Decorator (@guard)

import secureai
from secureai import guard, SecurityPolicy

# Optional: Connect to SecureAI Gateway for real-time SIEM & console telemetry
secureai.init(api_key="sec_live_your_key_here") # or export SECUREAI_API_KEY="sec_live_..."

# Sub-0.5ms local inspection + PII tokenization
@guard(policy=SecurityPolicy.STRICT, user_context={"role": "analyst", "dept": "finance"})
def generate_response(prompt: str) -> str:
    # Prompt is verified safe and PII is vaulted before entering function
    return "Safe model response"

2. Centralized Gateway Client (SecureAI)

from secureai import SecureAI

client = SecureAI(
    api_key="sec_live_your_key_here",
    base_url="https://secure.acadmyai.com/v1"
)

# 1. Prompt Inspection
report = client.inspect(prompt="Verify risk posture")
print("Verdict:", report["action"], "Risk:", report["injection_scan"]["risk_score"])

# 2. Autonomous Agent Runtime Action Firewall
# Intercepts agent shell commands, blocks reverse shells, and safely rewrites destructive operations
res = client.intercept_agent_action(
    action_type="EXECUTE_SHELL",
    command="rm -rf /var/log/app/* && echo 'Cleaned'"
)
print("Decision:", res["verdict"]) # "REWRITE_SAFE"
print("Safe Command:", res["rewritten_command"]) # "rm -rf ./scratch/sandbox_tmp/* && echo 'Cleaned'"

# 3. Model File Vulnerability Scanner (Protect AI style)
scan = client.scan_model_artifact(
    filename="weights.pkl",
    raw_content="cos\nsystem\n(S'rm -rf /'\ntR."
)
print("Model Safe:", scan["is_safe"], "Threats:", scan["malicious_opcodes"])

# 4. Zero-Knowledge PII Vault
vaulted = client.tokenize_pii("Contact user with SSN 123-45-6789")
print("Sanitized:", vaulted["sanitized_text"])

3. Asynchronous Client (AsyncSecureAI)

import asyncio
from secureai import AsyncSecureAI

async def main():
    async with AsyncSecureAI(api_key="sec_live_...") as client:
        report = await client.inspect("Analyze portfolio")
        print("Report:", report["is_safe"])

asyncio.run(main())

Zero-Code Reverse Proxy

Point any standard OpenAI SDK application to SecureAI without modifying your codebase:

export OPENAI_BASE_URL="https://secure.acadmyai.com/v1"
export OPENAI_API_KEY="sec_live_your_key_here"
from openai import OpenAI

client = OpenAI()
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello SecureAI"}]
)
print(response.choices[0].message.content)

Documentation & Support

Metadata

Release files for secureai-sdk 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for secureai-sdk 1.2.0
File Size Uploaded
secureai_sdk-1.2.0.tar.gz 36.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for secureai-sdk 1.2.0
File Interpreter ABI Platform
secureai_sdk-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 71.8 kB

Release files / secureai_sdk-1.2.0.tar.gz

Download URL secureai_sdk-1.2.0.tar.gz
Size 36.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8a6981481e8727cdf492830227612bae0b317338302a05b6fabd264ac81ebe14
BLAKE2b-256 checksum
How to use checksums
b8bcdc87ed47bce5908ca6b4559152a98fd4db328364c124b3b63e82cbd6d236
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.11

Release files / secureai_sdk-1.2.0-py3-none-any.whl

Download URL secureai_sdk-1.2.0-py3-none-any.whl
Size 35.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d822d9eefe5509d70db193817d31c70cb959cb04fec56a011280fc3e40944bf4
BLAKE2b-256 checksum
How to use checksums
86ff6e814006b27cec77305fcbb6ecece1dfd97d74512587440589ef3903e7c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.11

Release history Release notifications | RSS feed

1.2.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

This release

1.2.0 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page