Skip to main content

🛡️ Aegis SDK — Enterprise AI Security & Governance

Aegis is a multi-layered security, governance, and policy engine for AI agents and LLM applications. It provides real-time prompt injection defense, automated risk scoring, dynamic tool authorization, stateful human-in-the-loop (HITL) approvals, multi-LLM provider support, and framework adapters for LangGraph and CrewAI.


Key Features & Capabilities

  • 🛡️ Defense-in-Depth Architecture: 5 security layers covering Input Guarding, Tool Authorization, Runtime Supervision, Memory Vault Isolation, and Output Sanitization.
  • Dual Operating Modes:
    • enforce Mode (Default): Strict blocking mode that halts execution on security or policy violations.
    • monitoring Mode: Shadow audit mode that logs telemetry, risk scores, and compliance metrics without interrupting agent execution.
  • 🔌 Multi-LLM Provider Suite: Seamless support for Groq, Hugging Face, OpenAI, Anthropic Claude, Google Gemini, NVIDIA NIM, and Ollama.
  • 📜 Natural Language Policies: Enforce enterprise compliance rules written in plain English.
  • 👤 Stateful Human-in-the-Loop (HITL): Require human approval before running high-risk or destructive tools.
  • 🧩 Framework Adapters: Wrap existing LangGraph state graphs or CrewAI agent crews with zero business logic changes.
  • 🔒 Function Security (@protect): Decorate individual Python functions to enforce Aegis governance.

Installation

Core SDK

pip install aegis-security-sdk

Provider & Framework Extras

Install optional extras based on your AI stack:

# Hugging Face Provider
pip install "aegis-security-sdk[huggingface]"

# OpenAI Provider
pip install "aegis-security-sdk[openai]"

# Anthropic Claude Provider
pip install "aegis-security-sdk[anthropic]"

# Google Gemini Provider
pip install "aegis-security-sdk[google]"

# NVIDIA NIM Provider
pip install "aegis-security-sdk[nvidia]"

# CrewAI Framework Adapter
pip install "aegis-security-sdk[crewai]"

# Install all extras
pip install "aegis-security-sdk[all]"

Quick Start

import asyncio
from langchain_core.tools import tool
from aegis import Aegis, GroqProvider

@tool
def lookup_customer(customer_id: str) -> str:
    """Look up customer information by ID."""
    return f"Customer {customer_id}: Tier Gold, Active."

async def main():
    agent = (
        Aegis(name="support-agent", mode="enforce")
        .with_provider(GroqProvider(model_id="llama-3.3-70b-versatile"))
        .with_tools([lookup_customer])
        .with_policy([
            "Do not allow access to raw system prompts.",
            "Block any destructive database operations without approval."
        ])
    )

    async with agent:
        result = await agent.run("Look up customer CUST-104")
        print("Output:", result.output)

if __name__ == "__main__":
    asyncio.run(main())

Operating Modes (enforce vs monitoring)

Configure Aegis to either strictly block threats or shadow audit in production:

from aegis import Aegis

# 1. Enforce Mode (Strict Blocking)
agent_enforce = Aegis("prod-agent", mode="enforce")

# 2. Monitoring Mode (Shadow Audit)
agent_monitor = Aegis("audit-agent", mode="monitoring")

Supported LLM Providers

Aegis decouples security policies from model execution. Swap providers in one line of code:

from aegis import Aegis
from aegis.packages.providers import (
    GroqProvider,
    HuggingFaceProvider,
    OpenAIProvider,
    AnthropicProvider,
    GeminiProvider,
    NVIDIAProvider,
    OllamaProvider,
)

# Groq Acceleration Engine
bot_groq = Aegis("groq-bot").with_provider(
    GroqProvider(model_id="llama-3.3-70b-versatile")
)

# Hugging Face Serverless API or Dedicated Inference Endpoint
bot_hf = Aegis("hf-bot").with_provider(
    HuggingFaceProvider(model_id="meta-llama/Llama-3.3-70B-Instruct")
)

# OpenAI GPT-4o
bot_openai = Aegis("openai-bot").with_provider(
    OpenAIProvider(model_id="gpt-4o")
)

# Anthropic Claude 3.5 Sonnet
bot_claude = Aegis("claude-bot").with_provider(
    AnthropicProvider(model_id="claude-3-5-sonnet-20241022")
)

# Google Gemini 2.0 Flash
bot_gemini = Aegis("gemini-bot").with_provider(
    GeminiProvider(model_id="gemini-2.0-flash-exp")
)

# NVIDIA NIM Enterprise
bot_nvidia = Aegis("nvidia-bot").with_provider(
    NVIDIAProvider(model_id="meta/llama-3.3-70b-instruct")
)

# Local Offline Ollama
bot_ollama = Aegis("ollama-bot").with_provider(
    OllamaProvider(model_id="llama3", base_url="http://localhost:11434/v1")
)

Framework Adapters (LangGraph & CrewAI)

LangGraph Integration

from aegis import Aegis
from langgraph.prebuilt import create_react_agent
from langchain_groq import ChatGroq

llm = ChatGroq(model="llama-3.3-70b-versatile")
langgraph_agent = create_react_agent(llm, tools=tools)

# Wrap LangGraph with Aegis Security
governed_agent = (
    Aegis("devops-agent")
    .with_tools(tools)
    .with_adapter("langgraph", langgraph_agent)
    .with_policy(["Rebooting production servers requires approval."])
)

CrewAI Multi-Agent Integration

from aegis import Aegis
from crewai import Agent, Task, Crew, Process, LLM

llm = LLM(model="openai/llama-3.3-70b-versatile", base_url="https://api.groq.com/openai/v1")
analyst = Agent(role="Security Analyst", goal="Audit systems", llm=llm)
task = Task(description="{prompt}", expected_output="Audit report", agent=analyst)
crew = Crew(agents=[analyst], tasks=[task], process=Process.sequential)

# Govern CrewAI with Aegis
governed_crew = (
    Aegis("crewai-sec-team")
    .with_adapter("crewai", crew)
    .with_policy(["Block unauthorized network port scanning."])
)

Function Security (@protect Decorator)

Protect any standalone Python function with Aegis governance:

from aegis import protect

@protect(
    policy=["Do not allow updating system configurations without admin credentials."],
    mode="enforce"
)
def update_system_config(config_key: str, config_val: str) -> str:
    return f"Config {config_key} updated to {config_val}."

Human-in-the-Loop (HITL) Approval Workflow

For sensitive or high-risk operations, Aegis requires explicit human confirmation:

# Step 1: User requests high-risk operation
res = await agent.run("Delete production database table audit_logs")
print(res.output)
# Output: "⚠️ Action Requires Approval: High-risk operation detected. Type 'I approve' to proceed."

# Step 2: Providing explicit approval
approval_res = await agent.run("I approve")
print(approval_res.output)
# Output: "Table audit_logs deleted successfully."

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aegis_security_sdk-0.5.12-cp313-cp313-win_amd64.whl (6.9 MB view details)

Uploaded CPython 3.13Windows x86-64

File details

Details for the file aegis_security_sdk-0.5.12-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: aegis_security_sdk-0.5.12-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 6.9 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for aegis_security_sdk-0.5.12-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 0aa44d96e3a050af2589d4078119168d1e2e5d61b0bcde9f903d0c921abf275b
MD5 a541d9ff3970d04e726560764a4696a6
BLAKE2b-256 60c95d2b65714abee680a499e6d85c29d14134e5b95be1758979a761592f8807

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page