Building an Agent Sandbox from Scratch in Python

muhammadraza.me20 min read

An engineer builds a Python-based sandbox from scratch for running untrusted coding agents, layering six isolation mechanisms including namespaces, pivot_root, seccomp filters, Landlock path rules, network restrictions, and cgroups. Testing against various simulated attacks demonstrates how each layer defends the host, while revealing critical edge cases like directory handle leaks and unhandled abstract Unix sockets. Open article →