Defense-in-depth proxy sandbox for AI agents
Project description
agentcage
Defense-in-depth proxy sandbox for AI agents.
Don't let your agent phone home.
:warning: Warning: This is an experimental project. It has not been audited by security professionals. Use it at your own risk. See Security & Threat Model for details and known limitations.
What is it?
agentcage is a CLI that generates hardened, sandboxed environments for AI agents. Your agent runs on an internal-only network with no internet gateway; the only way out is through an inspecting proxy that scans every HTTP request before forwarding it.
Most agent deployments hand the agent a lethal trifecta: internet access, real secrets, and arbitrary code execution. Combined, they create an exfiltration risk that most setups have zero defense against. agentcage breaks that combination. See Security & Threat Model for the full breakdown.
- Network isolation -- agent on internal-only network, no internet gateway
- Inspecting proxy -- pluggable inspector chain on every HTTP request, WebSocket frame, and DNS query
- Secret injection -- agent gets placeholders, proxy swaps in real values outbound and redacts inbound
- Secret & payload scanning -- regex secret detection, Shannon entropy, content-type mismatch, base64 blob scanning
- DNS filtering -- allowlist-based dnsmasq sidecar, placeholder IPs for unauthorized domains
- Fail-closed by default -- all hardening on out of the box; component failure stops traffic
Both container mode (rootless Podman) and VM mode (Lima KVM) are supported -- see Security & Threat Model for the comparison. For the full container topology and inspector chain, see Architecture.
Quick Start
# Install
curl -fsSL https://raw.githubusercontent.com/agentcage/agentcage/master/install.sh | sh
# Scaffold a config (or use --scaffold openclaw)
agentcage init myapp --image node:22-slim
# Create and start the cage
agentcage cage create -c cage.yaml
# Store secrets (cage must exist first)
agentcage secret set myapp ANTHROPIC_API_KEY
agentcage cage restart myapp
# Verify it's healthy
agentcage cage verify myapp
Run agentcage init --list-scaffolds to see available scaffolds. See CLI Reference for the full command set.
Install
One-line installer (installs agentcage + prerequisites):
curl -fsSL https://raw.githubusercontent.com/agentcage/agentcage/master/install.sh | sh
Manual install:
Container mode (Linux only) -- prerequisites: Podman (rootless), Python 3.12+, uv.
| OS | Command |
|---|---|
| Arch Linux | sudo pacman -S podman python uv |
| Debian / Ubuntu 24.04+ | sudo apt install podman python3 && curl -LsSf https://astral.sh/uv/install.sh | sh |
| Fedora | sudo dnf install podman python3 uv |
VM mode (Linux and macOS) -- prerequisites: Lima, Python 3.12+, uv. QEMU also required on Linux.
| OS | Command |
|---|---|
| macOS | brew install lima python uv |
| Arch Linux | sudo pacman -S qemu-full python uv + install Lima |
| Debian / Ubuntu | sudo apt install qemu-system python3 && curl -LsSf https://astral.sh/uv/install.sh | sh + install Lima |
On macOS, only VM mode is available. Podman is optional (only needed for agentcage secret set). See VM Isolation for details.
Then install agentcage:
uv tool install agentcage # from PyPI
uv tool install git+https://github.com/agentcage/agentcage.git # from GitHub
For development:
git clone https://github.com/agentcage/agentcage.git
cd agentcage
uv run agentcage --help
Usage
# View logs
agentcage cage logs myapp # agent logs
agentcage cage logs myapp -s proxy # proxy inspection logs
# Audit inspection decisions
agentcage cage audit myapp --summary --since 24h
# Rotate a secret (auto-reloads the cage)
agentcage secret set myapp ANTHROPIC_API_KEY
# Update after code/config changes
agentcage cage update myapp -c cage.yaml
# Restart without rebuild
agentcage cage restart myapp
# Backup and restore
agentcage cage backup myapp --include-secrets -o backup.tar.gz
agentcage cage restore backup.tar.gz --name myapp-clone
# Tear it all down
agentcage cage destroy myapp
| Command / Group | Commands |
|---|---|
init |
(top-level) -- scaffold a config file |
cage |
create, update, edit, list, destroy, verify, restart, logs, exec, audit, har, backup, restore (aliases: ls/ps/status → list, rm → destroy, reload → restart) |
secret |
set, list, rm (alias: ls → list) |
domain |
list, add, rm (alias: ls → list) |
completions |
(top-level) -- print shell completion script (bash/zsh/fish) |
See CLI Reference for full documentation of all commands and options.
Configuration
See the Configuration Reference for all settings, defaults, and examples. Example configs: basic/cage.yaml. Deployment state is tracked per-cage in ~/.config/agentcage/deployments/<name>/.
Security
The agent has no internet gateway -- all traffic must pass through the proxy, which applies domain filtering, secret detection, payload inspection, and custom inspectors. For workloads requiring hardware-level isolation, VM mode adds a dedicated guest kernel per cage via Lima, eliminating container escape as an attack vector. See Security & Threat Model for the full threat model, defense layers, and known limitations.
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 agentcage-0.9.2.tar.gz.
File metadata
- Download URL: agentcage-0.9.2.tar.gz
- Upload date:
- Size: 649.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5254c7926c8288b35554da67b7dd01da2eedce03d194622505f8e2cefe7f6e2
|
|
| MD5 |
94a7f6030f5dfdb9ae2d0e4e405da65c
|
|
| BLAKE2b-256 |
d36fe1f6a4bc036e09f623ecf169f46d9808739680bfb59c1e66b659fa5991e1
|
Provenance
The following attestation bundles were made for agentcage-0.9.2.tar.gz:
Publisher:
publish.yml on agentcage/agentcage
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentcage-0.9.2.tar.gz -
Subject digest:
a5254c7926c8288b35554da67b7dd01da2eedce03d194622505f8e2cefe7f6e2 - Sigstore transparency entry: 1147983802
- Sigstore integration time:
-
Permalink:
agentcage/agentcage@b89467b1ba37251b068e2a294d9dec5ed5fc41ca -
Branch / Tag:
refs/tags/v0.9.2 - Owner: https://github.com/agentcage
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b89467b1ba37251b068e2a294d9dec5ed5fc41ca -
Trigger Event:
push
-
Statement type:
File details
Details for the file agentcage-0.9.2-py3-none-any.whl.
File metadata
- Download URL: agentcage-0.9.2-py3-none-any.whl
- Upload date:
- Size: 117.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52a4af22f4caa1181f56f3edb1861b008a17ab831af8ca0e562112ef67b1092a
|
|
| MD5 |
8480459c70bb8e4604125680ef53ef34
|
|
| BLAKE2b-256 |
5fd6930592c35b070c22ce3ca2537f9add1c7bfce25624af6c32e10c645b5897
|
Provenance
The following attestation bundles were made for agentcage-0.9.2-py3-none-any.whl:
Publisher:
publish.yml on agentcage/agentcage
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentcage-0.9.2-py3-none-any.whl -
Subject digest:
52a4af22f4caa1181f56f3edb1861b008a17ab831af8ca0e562112ef67b1092a - Sigstore transparency entry: 1147983809
- Sigstore integration time:
-
Permalink:
agentcage/agentcage@b89467b1ba37251b068e2a294d9dec5ed5fc41ca -
Branch / Tag:
refs/tags/v0.9.2 - Owner: https://github.com/agentcage
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b89467b1ba37251b068e2a294d9dec5ed5fc41ca -
Trigger Event:
push
-
Statement type: