Home / Projects / NiPlex-Harness / Tools / Terminal and Python sandbox tools / run_code

Pictures

run_code

Runs Python in the sandbox. Risky code waits for button approval.

Since 2 Sept 2026

The code is scanned first. Safe code runs. Medium and high risk code returns an approval request and waits for a button. Secret placeholders are filled in only after the scan. Output is redacted.

Tool name
run_code
Group
Terminal and Python sandbox
Risk
high
Needs approval
sometimes
Approval rule
FREE or LOW code runs. MEDIUM and HIGH wait for a button unless the chat has Allow Session (MEDIUM only) or an /allow window.
Allowed in scheduled jobs
No
Default
on

Parameters

NameTypeRequiredDefaultMeaningLimits
codestringYesPython source to run.Wall-clock limit 60 seconds by default; memory limit 512 MB by default.
terminal_idstringNoId of a terminal session. Omit to use the first one.

Returns

JSON with terminal id, output and exit status.

Example (made up for this page)

Call
{
  "code": "demo"
}
Result
{"terminal_id": "t1", "stdout": "42\n", "returncode": 0}

Side effects

  • Runs code as the bot's OS user inside a limited subprocess
  • Can write files in a temp folder and use the network.

How it can fail

WhenWhat the agent sees
The code is riskyCommand Approval Required with an id, level and reason
The code times outA timeout result
The terminal is deadTerminal not found or dead.

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.