AI agents now run code themselves—the container wall may not be thick enough
Containers, VMs, and sandboxes all provide isolation, but shared kernels, full OSes, and syscall filtering are three separate trade-offs. Once AI agents increase the frequency of executing unfamiliar code, the order in which you choose them should change. A free open-source agent course is linked at the end.
AI agents are starting to write code themselves and run it themselves. The real question becomes: where should this code execute.
The tweet author ramakrishna breaks common approaches into three categories: containers, virtual machines, and sandboxes. All three do the same thing: keep one piece of code from damaging anything else. The difference is how thick the wall is and how much startup time and resources you're willing to pay. The original tweet included a demo video:
Containers package an application and its dependencies and run on the host machine's kernel. Many containers share the same kernel, so startup is measured in seconds and size in MB. That's also the cost: a kernel bug can take down containers on the same machine together. If the code is trusted and you need fast startup, containers are a good fit.
VMs take another path. Each VM runs a complete guest OS on a hypervisor, with its own kernel. Isolation is strongest, but size is measured in GB and startup is much slower. Choose a VM when you need a complete OS or strict isolation between different customers.
Sandboxes sit in the middle. They're for code you didn't write. Tools such as gVisor and Firecracker filter system calls and limit network and file access, with startup times that can be in milliseconds. Firecracker also gives each sandbox a small VM. The author's recommendation is direct: use containers for trusted code that needs speed, sandboxes for code you didn't write, and VMs when you need a full OS or hard isolation between customers.
There's a change here that's easy to overlook. Containers used to be treated as the default isolation answer, because that's how both dev machines and production environments use them. But containers share the kernel, and the isolation boundary is thinner than many people think. As AI agents increase the frequency of executing unfamiliar code, sandboxes move from optional to default. Nobody wants code generated by an agent to run on the host with full privileges.
In the same thread, the author also shared a free open-source course: Agentic AI from Scratch. The course page says it has 16 stages, 163 lessons, and 127 hours of build time, starting with a single HTTP call and a while loop. You first hand-write tool dispatch, the ReAct loop, vector storage, and an MCP server, then bring in frameworks such as LangGraph, OpenAI Agents SDK, and CrewAI. It supports Python and TypeScript and can connect to local models or hosted APIs. They even packaged the course as a skill for coding agents; the install command is:
npx skills add Ramakm/agentic-ai-from-scratch
Course link: https://agentic-ai-from-scratch.vercel.app . GitHub: https://github.com/Ramakm/agentic-ai-from-scratch . The page says it's free, with no paywall, and you finish by building your own CLI agent harness. For people who want to fill in the fundamentals of agents, this is more practical than bookmarking a pile of framework tutorials.
Back to isolation. If you're currently having an AI agent run code, answer one question first: which isolation layer is this code running in? If the answer isn't clear, don't rush it into production.
发布时间: 2026-11-29 17:27