Agent immune system — detect, contain, and recover from prompt injection and malicious behavior in AI agent networks
Project description
AEGIS
Agent Embedding Guard & Immune System
Protect your agent swarm with an immune system! A drop-in security layer for LLM-powered agents, optimized for safe(r) participation in multi-agent societies. 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.
Quick Start
pip install -e . (until on pypi)
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.
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 |
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
pip install aegis-shield[identity] # Ed25519 attestation
pip install aegis-shield[ml] # ML-based scanning (uses LLM Guard)
pip install aegis-shield[monitoring] # Remote monitoring service
pip install aegis-shield[all] # Everything
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
- 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
- Examples - Runnable code for every feature
Requirements
- Python 3.10+
- No required dependencies beyond PyYAML
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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_shield-0.1.0.tar.gz.
File metadata
- Download URL: aegis_shield-0.1.0.tar.gz
- Upload date:
- Size: 559.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b77818bc7d3cd73d3b1501624ed7086794e4c13b69e5fad2e8118323423fecc
|
|
| MD5 |
077556f758233f7dcc3f8ebb03565248
|
|
| BLAKE2b-256 |
2c953951e64aa72e6b2b14643d86175e6cd449713fdb97b995104e8b3f0f5a7e
|
File details
Details for the file aegis_shield-0.1.0-py3-none-any.whl.
File metadata
- Download URL: aegis_shield-0.1.0-py3-none-any.whl
- Upload date:
- Size: 384.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb6b496fea725296418872d09c374a521c4ef9c8a49c26f6b16d3f74ba8ab23e
|
|
| MD5 |
65d97f13a5bb2a9a69ce9042414566fd
|
|
| BLAKE2b-256 |
ed2ea032820c5ec913c49e2b3080a1b14e07ab7f43a8907f69c146ddb8c3d511
|