Skip to main content

AEGIS

Agent Embedding Guard & Immune System

AEGIS is something new: the first distributed immune system for agents, organized much like a biological one. It is designed to be a highly robust crowdsourced network for protection against prompt injections of all types, but especially against prompt worms that self-replicate in shared multi-agent spaces such as Moltbook. It can also be used to adaptively block universal jailbreaks after the first few harmful actions taken using a given jailbreak, compressing a patch loop that would have previously required manual review. AEGIS drops-in with a single line of code and is secure out of the box, but is also highly configurable and modular - read on for how to tune it with global and setting-specific configs. AEGIS detects prompt injections, contains compromised agents, and prevents cascading attacks across multi-agent systems so you don't end up inadvertently authoring the first chapter of a sci-fi novel.

AEGIS implements our Semantic Immunity framework. The adaptive component of AEGIS maintains a shared database of compromised agent embedding hashes. Compromised agents themselves will populate it through the innate component of the framework and existing adaptive population immunity. This results in true immunological memory that scales automatically with the strength of the models using the system, without introducing another LLM layer that could itself be vulnerable to prompt injection.

Quick Start

pip install aegis-shield[all]
import aegis
import anthropic  # or openai, or any client with create()/generate()

client = aegis.wrap(anthropic.Anthropic())

# Use the client exactly as before - AEGIS scans automatically
response = client.messages.create(
    model="claude-sonnet-4-5-20250929",
    messages=[{"role": "user", "content": "What is 2+2?"}],
)

One line. No config needed. AEGIS auto-detects your provider, scans inputs for prompt injection, sanitizes outputs, and tracks agent trust - all transparently.

If you're using OpenClaw, check out the skill - it provides nearly all functionality in an easy to consume format for your agent.

What It Does

AEGIS layers eight independent defense mechanisms so that bypassing any single one doesn't mean total compromise:

Module Purpose
Scanner Detects direct and indirect prompt injections via regex, heuristics, ML classifiers, and embedding-based intent-context divergence
Broker Controls tool access with capability manifests and write budgets
Identity Tracks agent trust tiers, verifies cryptographic attestations
Behavior Fingerprints agent behavior and detects drift from baseline
Memory Guards against memory poisoning with category restrictions and taint tracking
Recovery Auto-quarantines compromised agents and rolls back to known-good state
Integrity Detects tampering of local model files (Ollama, vLLM) via stat checks, hashing, and inotify
Monitoring Optional reporting to a central monitoring service for network-wide visibility

Broadly speaking, AEGIS uses innate defense layers to bootstrap more powerful adaptive ones. Suspicious inputs, outputs, or patterns of tool use that trip innate defenses are presented to the adaptive embedding database to propagate immunity.

Modes

Mode Behavior
enforce (default) Blocks detected threats by raising ThreatBlockedError
observe Detects and logs threats, but never blocks - useful for evaluation
# Protected by default
client = aegis.wrap(my_client)

# Use observe mode to evaluate detections before enforcing
client = aegis.wrap(my_client, mode="observe")

Supported Providers

Provider Intercepted Method
Anthropic client.messages.create()
OpenAI client.chat.completions.create()
Ollama client.chat() and client.generate()
vLLM llm.generate() and llm.chat()
Generic client.create() or client.generate()

Optional Extras

To customize your installation, start with:

pip install aegis-shield                # Basic framework

And layer on the modules you want:

pip install aegis-shield[identity]      # Ed25519 attestation
pip install aegis-shield[ml]            # ML-based scanning (uses LLM Guard)
pip install aegis-shield[ml-behavior]   # Isolation Forest anomaly detection
pip install aegis-shield[pii]           # PII detection and redaction (Presidio)
pip install aegis-shield[yara]          # YARA rule matching
pip install aegis-shield[embeddings]    # Semantic embeddings for indirect injection detection
pip install aegis-shield[content-gate]  # Social media/external content filtering
pip install aegis-shield[fuzzy]         # Fuzzy identity matching
pip install aegis-shield[monitoring]    # Remote monitoring service
pip install aegis-shield[all]           # Everything

Companion Modules

AEGIS ships with several companion packages for different deployment scenarios:

Package Purpose
aegis-monitor Real-time monitoring dashboard with agent graph visualization, R0 estimation, attack strain clustering, and epidemic simulator
aegis-sentinel Passive sentinel agent that observes AEGIS-protected networks and reports detections to the central monitor
aegis-openclaw OpenClaw skill and hooks integration — exposes AEGIS commands (aegis-scan, aegis-trust, aegis-quarantine, etc.) to OpenClaw agents
aegis_proxy Standalone HTTP proxy for remote AEGIS enforcement — transparent scanning without per-agent installation

Documentation

You can get started with a single line of code, but there's a lot more you can do with AEGIS:

  • Getting Started - Installation, usage, and progressive walkthrough of every feature
  • API Reference - Complete class/method/config reference
  • Monitor Quickstart - Set up the monitoring dashboard and connect agents
  • OpenClaw Integration - Proxy and skill integration for OpenClaw agents
  • Security Rationale - Why AEGIS exists, attack anatomy, defense-in-depth analysis
  • Whitepaper - outlining the risk of prompt worms in agentic networks and detailing the concept of Semantic Immunity
  • Comparison - AEGIS vs Guardrails AI vs LLM Guard
  • Roadmap - Future features and research directions
  • Examples - Runnable code for every feature

Requirements

  • Python 3.10+
  • Core dependencies: PyYAML and Pydantic (installed automatically)

License

MIT

Metadata

Release files for aegis-shield 0.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 aegis-shield 0.2.0
File Size Uploaded Provenance Actions
aegis_shield-0.2.0.tar.gz 681.0 kB Without provenance Details for aegis_shield-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aegis-shield 0.2.0
File Interpreter ABI Platform Actions
aegis_shield-0.2.0-py3-none-any.whl Python 3 none any Details for aegis_shield-0.2.0-py3-none-any.whl

Total release size: 858.0 kB

Release files / aegis_shield-0.2.0.tar.gz

Download URL aegis_shield-0.2.0.tar.gz
Size 681.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7489337622b2a8e9392750dfeb167e99464854329b9c3f0ea2bc107e894c9405
BLAKE2b-256 checksum
How to use checksums
19474f86dab8b7631eecca42c8d6b47851cd30b6f10102bff4d5b42e5aa1d296
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / aegis_shield-0.2.0-py3-none-any.whl

Download URL aegis_shield-0.2.0-py3-none-any.whl
Size 177.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
21ef54cdfb49f1a4431df9fe130fe7be0751dbd271a60303f02495efb2236a55
BLAKE2b-256 checksum
How to use checksums
74278371c549c682e798f854b17c30026d4ff35d8f7578c0b34bbd9722173ba8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Security for aegis-shield 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

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