How to run AI-generated code safely
Blog post from Northflank
Running AI-generated code safely necessitates an isolated execution environment that enforces boundaries around filesystem, process space, network, and kernel, as standard Docker containers are inadequate for untrusted code due to their shared host kernel. Different isolation models, such as hardened containers, gVisor, and microVMs, are suitable for varying levels of risk associated with AI-generated code execution, with microVMs offering the highest level of isolation. Northflank provides hosted sandbox platforms using technologies like Kata Containers, Cloud Hypervisor, and Firecracker, which support any OCI container image and offer both ephemeral and persistent execution modes. These platforms are crucial for securely running AI-generated code in production, particularly for multi-tenant architectures, allowing companies to deploy workloads in their own cloud accounts while maintaining necessary isolation and security measures. Since 2021, Northflank has been successfully operating sandbox infrastructure across startups, public companies, and government deployments, ensuring that AI-generated code is treated as untrusted unless reviewed, to mitigate risks such as filesystem access, network exfiltration, resource exhaustion, and privilege escalation.
| Trend | Post Mentions | Total Month Mentions | Posts | Companies | MoM |
|---|---|---|---|---|---|
| AI Agents | 9 | 4,545 | 963 | 231 | +27% |
| LLM | 6 | 6,078 | 960 | 218 | +18% |
| AI Coding Assistant | 5 | 1,255 | 319 | 126 | +24% |
| Kubernetes | 4 | 1,840 | 308 | 106 | +33% |
| Serverless | 2 | 729 | 189 | 89 | -11% |
| Secrets Management | 1 | 1,488 | 268 | 99 | +7% |