Don't let your agent phone home.
Defense-in-depth security sandbox for autonomous AI agents. Your agent runs on an internal-only network with no internet gateway — the only way out is through a Rust egress proxy that inspects every HTTP request, swaps decoy secrets for the real ones on the wire, and logs every decision.
curl -fsSL https://raw.githubusercontent.com/agentcage/agentcage/master/install.sh | sh
The Problem
Most agent deployments hand the agent three things that, combined, create an exfiltration risk most setups have zero defense against.
API keys, tokens, and credentials injected directly into the agent's environment.
Unrestricted outbound connectivity to any server on the internet.
Arbitrary code execution with full access to the local filesystem.
Defense-In-Depth
Every request must cross eight protective rings. A failure in any one layer does not compromise the others, and every failure narrows egress rather than widening it.
Workload attaches to an unrouted Internal=true bridge. iptables FORWARD DROP, IPv6 disabled, and non-HTTP protocols dropped unless explicitly allowed.
dnsmasq answers only allowlisted names. Everything else resolves to 198.51.100.1 (RFC 5737 TEST-NET-2), so denied requests fail fast with a clear policy error. IP literals and wildcard-DNS SSRF tricks are rejected.
Strict TLS SNI ↔ HTTP Host equality defeats domain fronting. Runtime-granted hosts are refused if they resolve to private, loopback or link-local addresses, and passthrough names are pinned to their real destination.
A chain run on worker threads: domain allowlist, 20 credential patterns, body-size limits, opt-in Shannon entropy, and content-type mismatch detection — plus your own WebAssembly inspectors with a CPU and memory budget.
The agent only ever sees agentcage:secret:KEY:<hex> decoys. The proxy swaps in real values on the wire and redacts them inbound — including percent-encoded, JSON-escaped and base64 forms.
Workload runs as UID 1000 with all capabilities dropped, no-new-privileges, and rootless user namespaces mapping container root to an unprivileged host subuid.
Read-only rootfs, with tmpfs pivot masks over .git/hooks/ and .claude/ so a rogue agent cannot plant hooks that run on your host. Host ~/.ssh and ~/.aws are out of reach.
Structured audit.jsonl and HAR 1.2 capture of every transaction, plus an in-egress Decider Agent and a background Traffic Watcher that can revoke grants on its own.
How It Works
A workload sandbox and an egress gateway share a private, internal-only network. The gateway owns the network boundary and is the agent's only route out.
The workload has no gateway to the internet. Its default route reaches only the egress gateway, so every connection is forced through inspection.
dnsmasq resolves allowlisted zones upstream. Anything not permitted returns the TEST-NET-2 sinkhole address, where the proxy answers with an explicit denial.
The Rust egress terminates TLS with a per-cage CA, checks SNI/Host identity and rebinding, and runs the inspector chain over the request and any WebSocket messages.
Decoy placeholders are swapped for real secrets on the wire, clean requests are forwarded over verified TLS, and suspicious ones get a JSON 403. Everything is audit-logged and HAR-exportable.
Autonomous Defense
agentcage doesn't only enforce the rules you wrote — it can negotiate and re-examine them while the agent runs.
The agent can inspect reachable domains at https://agentcage.local/v1/allowlist and request new access with a justification. An in-egress LLM decider adjudicates requests and grants temporary runtime access under a rate limit — and fails closed, denying on any error or timeout.
An opt-in background LLM agent re-reads recent audit logs and capture windows looking for subtle exfiltration, beaconing, or injection. It is narrowing-only: it can revoke a compromised runtime grant in real time, but can never add one.
Isolation Backends
Same inspection logic, different isolation boundaries. agentcage auto-selects the best backend for your host, and you can override it per cage.
Rootless Podman — Linux
Native microVMs — macOS 26+ Apple Silicon
QEMU / Apple VZ — macOS & Linux
Security Coverage
How agentcage maps to the OWASP agentic risk categories. See the full security model for the threat model, trust boundaries, and residual risks.
| OWASP Risk | Coverage | How |
|---|---|---|
| ASI01 Agent Goal Hijack | Out of scope | agentcage inspects network traffic, not agent intent |
| ASI02 Tool Misuse | Strong | Domain allowlist, WebSocket inspection, DNS filtering and sinkholing limit reachable services |
| ASI03 Identity / Privilege Abuse | Strong | Decoy placeholders keep real credentials out of the agent; runtime grants are scoped and expiring |
| ASI04 Supply Chain | Partial | Checksum-verified agent installs and sandboxed WebAssembly inspectors; dependencies are not universally pinned |
| ASI05 Unexpected Code Execution | Strong | Read-only rootfs, dropped capabilities, no-new-privileges, rootless user namespaces |
| ASI06 Memory & Context Poisoning | Out of scope | agentcage doesn't manage agent memory |
| ASI07 Insecure Inter-Agent Comms | Out of scope | Single-agent scope; all egress is still inspected |
| ASI08 Cascading Failures | Strong | Fail-closed on proxy errors and bad configs, per-host rate limiting, systemd auto-restart |
| ASI09 Human-Agent Trust Exploitation | Strong | Every allow, block and error is recorded in structured audit logs with HAR capture |
| ASI10 Rogue Agents | Strong | Network isolation, multi-layer inspection, DNS filtering, and the autonomous Traffic Watcher |
Scaffolds
Pre-built scaffolds package a hardened image, domain allowlist, secret bindings, and mounts for popular agents. Run agentcage scaffold list to see everything, or start from ubuntu, debian, arch, or busybox.
Anthropic's coding agent CLI. Allowlists Anthropic endpoints, injects ANTHROPIC_API_KEY or a Claude OAuth token, and masks .git/hooks and .claude/.
Codex CLI on a minimal Debian base, installed from upstream's checksum-verified release. Allowlists api.openai.com and injects OPENAI_API_KEY.
Pi.dev autonomous terminal coding harness, with support for Anthropic/OpenAI keys or an in-cage OAuth login.
agentcage run pi -s OPENAI_API_KEYFull-featured agent harness with browser automation and a local web gateway, plus nested rootless containers and named volume caches.
--scaffold openclawQuick Start
curl -fsSL https://raw.githubusercontent.com/agentcage/agentcage/master/install.sh | sh
One command builds the sandbox, mounts the current project, prompts for the key securely, and tears everything down on exit.
agentcage run claude-code -s ANTHROPIC_API_KEY
agentcage init my-cage --scaffold claude-code
agentcage secret set my-cage ANTHROPIC_API_KEY
agentcage cage create -c cage.yaml
agentcage cage shell my-cage && agentcage cage audit my-cage --summary
Full network forensics: agentcage cage har my-cage -o audit.har
Fork the repo, create a feature branch, add tests, and submit a PR. Keep changes focused — one concern per PR.
Do not open a public issue for security vulnerabilities. Email security@agentcage.ai instead. You will receive an acknowledgment within 48 hours.
Built On