🛡️ 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:
enforceMode (Default): Strict blocking mode that halts execution on security or policy violations.monitoringMode: 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aegis_security_sdk-0.5.7-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: aegis_security_sdk-0.5.7-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 7.0 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98e2af53228c49ebb624fcb4b6fcb2238cbc32e510bce9f0f77cf3e951be1212
|
|
| MD5 |
d463758a14d40f0120ab737bf5a71ade
|
|
| BLAKE2b-256 |
d848307ddec1e9b3f93f7366578e4f8db8a6924bcad6da22a894db1ba84bb8f5
|