passdrill
AI & LLM Engineering · AI Agents & Tool Use · Card 004/012 easy

A coding assistant is given a tool that lets it write and run arbitrary Python and bash commands to analyze data the user uploads. Rather than running those commands directly on the same machine that hosts the production application and its databases, the system runs each command inside an isolated, resource-limited container with no access to the production network. What is the main reason for running agent-generated code this way?

  1. It contains the blast radius of any command the model generates -- whether flawed, unexpected, or actively malicious (for example, from data the model was fed) -- so it cannot reach production systems, other users' data, or the internet at large
  2. It is required because language models are physically incapable of producing syntactically valid Python or bash unless the code executes inside a separate container
  3. It removes the need for the calling application to read or check the model's generated code at all, since the sandbox itself rewrites unsafe commands into safe ones before running them
  4. It allows the agent to run commands faster, since sandboxed containers execute code with less overhead than running the same command directly on the host machine
Next card → Shuffle