nbinlineai.execution_tools

Explicit, bounded subprocess and tmux tools for the kernel’s machine.

run_shell

source

run_shell(command: str, cwd: str = '.', timeout: int = 10) -> str

Execute a shell command in a separate process; effects are real, not sandboxed.

Parameter Type Default Description
command str required Shell command; executes with the kernel user’s permissions.
cwd str '.' Working directory relative to the kernel, or absolute.
timeout int 10 Maximum runtime in seconds, from 1 through 20.
returns str Exit status and bounded combined output.

run_python

source

run_python(code: str, cwd: str = '.', timeout: int = 10) -> str

Execute Python with the kernel’s interpreter in a fresh process; effects are real.

Parameter Type Default Description
code str required Python source to execute in a fresh subprocess, not the live namespace.
cwd str '.' Working directory relative to the kernel, or absolute.
timeout int 10 Maximum runtime in seconds, from 1 through 20.
returns str Exit status and bounded combined output.

tmux_sessions

source

tmux_sessions() -> str

List local tmux panes; requires tmux and does not list JupyterLab terminals.

Parameter Type Default Description
returns str Bounded local tmux session/window/pane inventory.

tmux_read

source

tmux_read(pane: str, lines: int = 40) -> str

Read a local tmux pane’s recent screen/scrollback without sending input.

Parameter Type Default Description
pane str required Exact local pane ID such as %3 from tmux_sessions.
lines int 40 Last 1 through 100 lines of pane content.
returns str Bounded plain terminal text.