Home / Projects / NiPlex-Harness / Safety model / Sandbox

Pictures

Sandbox

run_code runs Python in a subprocess with memory, CPU, file and process limits and a cleaned environment. It is not a container or a virtual machine.

Since 2 Sept 2026 · Updated 29 Oct 2026

Code runs inside a limited box

Builtin mode (default)

  • Own virtual environment under data/sandbox_venv.
  • Memory 512 MB, wall time 60 s, 256 open files, 200 MB files, no core dumps.
  • Process budget: current count plus 24.
  • No new privileges. Own process group, killed on timeout.
  • Fresh temporary working folder. Python only.

External mode

Code is sent by HTTP to a sandbox service you run. The limits are then that service's.

What it does not stop

Network use, reading files the bot's user can read, and slow abuse within limits.

See sandbox-limits.json.

Limits

LimitValueEnforced byApplies toOwner can changeSetting
Memory512 MBRLIMIT_ASbuiltinYesSANDBOX_MAX_MEMORY_MB
Wall-clock timeout60 secondstimer, process group killedbothYesSANDBOX_TIMEOUT
CPU timetimeout + 5 secondsRLIMIT_CPUbuiltinNo
Open files256 filesRLIMIT_NOFILEbuiltinNo
Largest file200 MBRLIMIT_FSIZEbuiltinNo
Core dumps0 bytesRLIMIT_COREbuiltinNo
New processes24 above current count processesRLIMIT_NPROCbuiltinNo
No new privilegeson flagPR_SET_NO_NEW_PRIVSbuiltinNo
Working directoryfresh temporary folder path rulesubprocess setupbuiltinNo
Environmentsecret-like names removed kinds: provider keys, bot tokens, names with TOKEN, SECRET, PASSWORD, API_KEYenvironment scrubbuiltinNo
LanguagePython only -sandbox designbuiltinNo
External request timeouttimeout + 10 secondsHTTP clientexternalYesSANDBOX_TIMEOUT

Checked against the source at commit f4fd89f on 29 Oct 2026. Everything here is merged on the main branch; no release has been tagged yet. The source is private, so these pages are the public description.