Loading…
Glossary term
An isolated environment where code or an agent can run without affecting the rest of a system.
A sandbox is an isolated environment where code or an agent can run without being able to harm the wider system. It limits files, network access and resources.
Coding agents typically run commands inside a sandboxed container or virtual machine.
Run untrusted code with a time limit
import subprocess
result = subprocess.run(
["python", "-c", "print(2 + 2)"],
capture_output=True, text=True, timeout=5,
)
print(result.stdout) # 4Running model-generated code unsandboxed is risky, so isolation is a basic safety measure.