agentcage
Defense-in-depth security sandbox that runs autonomous AI coding agents behind a default-deny, TLS-inspecting egress proxy with placeholder secret injection.
At a Glance
Self-hosted agentcage CLI and sandbox released under the MIT License, free to use, copy, modify and distribute.
Engagement
Available On
Alternatives
Listed Nov 2026
About agentcage
agentcage is an open-source, MIT-licensed security sandbox for autonomous AI agents such as Claude Code, OpenAI Codex, Pi, OpenClaw, or custom agent workloads. It runs the agent in an isolated container or microVM whose only route to the outside world is an inspecting egress proxy controlled by the operator. The latest release listed is v0.54.1.
What It Is
agentcage is a command-line tool, written in Rust and shipped as a single binary, that wraps an AI coding agent in a sandbox. Each cage has two parts: a workload sandbox running the agent as an unprivileged user, and an egress gateway on an internal-only network. The gateway combines a DNS filter with a TLS-inspecting proxy that enforces a domain allowlist.
A command such as agentcage run claude-code -s ANTHROPIC_API_KEY builds the cage, stores the real key encrypted on the host, gives the agent a decoy placeholder token, mounts the current repository at /workspace, and opens an interactive session.
How Egress and Secrets Are Handled
Outbound requests pass through DNS filtering and TLS interception using a per-cage certificate authority. The proxy checks that SNI matches the Host header and blocks DNS rebinding to private addresses for runtime-granted hosts. An inspector chain then examines each request: domain, secrets, body size, opt-in entropy, and content-type checks, plus custom WebAssembly inspectors.
Real credentials never enter the sandbox. Placeholders are swapped for real secrets on the wire only for matching domains and credential headers, and any echoed secret in a response is redacted back to its placeholder. Decisions are logged to an audit file, and full HTTP transactions can be exported as HAR 1.2.
Policy API and Traffic Watcher
Sandboxed agents can query an in-cage policy endpoint to see allowed domains and request temporary access with a justification. An optional LLM decider agent evaluates the request and can grant runtime access. An opt-in watcher agent reviews audit logs and capture windows for exfiltration or beaconing patterns and can revoke runtime grants.
Isolation Backends and Scaffolds
The tool selects among three backends: rootless Podman with systemd quadlets on Linux, Apple container microVMs on macOS 26+ with Apple Silicon, and a Lima VM with Podman on other macOS or Linux setups. Project mounts hide .git/hooks/ and .claude/ through tmpfs masks to prevent host pivoting. Built-in scaffolds cover claude-code, codex, pi, openclaw, ubuntu, debian, and arch, and custom scaffolds can be created. Configuration lives in a cage.yaml file.
Community Discussions
Be the first to start a conversation about agentcage
Share your experience with agentcage, ask questions, or help others learn from your insights.
Pricing
Open Source (MIT)
Self-hosted agentcage CLI and sandbox released under the MIT License, free to use, copy, modify and distribute.
- MIT License
- Default-deny network egress
- Zero-leak placeholder secret injection
- TLS inspection proxy
- Autonomous Policy API & Traffic Watcher
Capabilities
Key Features
- Default-deny network egress with DNS filtering
- Zero-leak placeholder secret injection and response redaction
- TLS-inspecting egress proxy with inspector chain
- Custom WebAssembly inspectors
- Encrypted at-rest secret storage via systemd-creds or macOS Keychain
- Autonomous Policy API with LLM decider agent
- Opt-in autonomous traffic watcher
- Host pivot protection masks for .git/hooks and .claude
- HAR 1.2 export and JSONL audit logs
- Built-in scaffolds for Claude Code, Codex, Pi, OpenClaw and base distros
- Multi-backend isolation (Podman, Apple Container, Lima VM)
- Persistent and ephemeral cage lifecycles with backup and restore
