Running an agent in a container or VM caps the damage at that environment and whatever credentials you put in it. Devcontainers make the setup reproducible, while microVMs and user-space kernels add stronger isolation for untrusted workloads. Isolation is what makes unattended modes defensible.
Read in this order
- OfficialClaude Code: Development containersStart here: a ready container setup for running an agent with less risk.
- OfficialDocker SandboxesDocker's purpose-built sandboxes for agents, with isolation tradeoffs.
- OfficialDevelopment Containers specificationThe devcontainer spec, for making environments reproducible across teams.