Expand description
Tools that run code: RunCommand (run_command, a shell command), RunPython
(run_python, Python code or a script), InstallPackages (install_packages,
programs and Python libraries for the workspace, with Nix or pixi, or in the workspace’s
container), InstallPythonPackages (install_python_packages, into byob’s managed
venv with uv, where there is no package manager for install_packages) and
InstallSystemPackages (install_system_packages, Homebrew/winget, the last resort a
person approves every time).
Every run is prepared by env::Envs: it runs in the workspace’s container if the user
opted in; otherwise installed packages, the workspace’s .venv and (once the user agreed)
its dev shell go on PATH, and the nix CLI works inside the sandbox.
Everything runs through byob_sandbox: read the system, read+write the workspace and
a private temp folder, no network unless the call asks (and the user approves), a
minimal environment without inherited secrets, wall-clock timeout, bounded output,
and the whole process tree is killed on timeout or Stop. Where the OS can’t sandbox
(no Landlock), commands still run, with a warning in the log and in the tool output;
BYOB_SANDBOX=off turns the sandbox off explicitly (Mode::Unsandboxed).
Re-exports§
pub use python::Python;
Modules§
- env
- Workspace environments: where the programs and libraries a run needs come from.
- python
- Which Python runs model code, and the managed environment for data-analysis packages.
Structs§
- Exec
- Shared by the tools.
- Install
Packages install_packages: programs and Python libraries for this workspace, from the machine’s package manager (Nix). They stay installed (per workspace) and are onPATHfor every laterrun_command/run_python.- Install
Python Packages install_python_packages: add packages to byob’s managed venv (created on first use) withuv. Wheels only (--only-binary :all:), so installing never runs package code.- Install
System Packages install_system_packages: the last resort, Homebrew or winget, system-wide. Every call needs a person’s approval (it is never auto-approved), and while there is a workspace installer it only takes packagesinstall_packagescouldn’t find.- RunCommand
run_command: a shell command in the workspace.- RunPython
run_python: Python code (or a workspace script) in the workspace.
Enums§
- Mode
- How commands run.
Constants§
- DEFAULT_
TIMEOUT_ S - MAX_
OUTPUT - Bytes kept per stream (head and tail halves) for the model.
- MAX_
TIMEOUT_ S
Functions§
- install
- Create the managed venv if needed and install
packagesinto it. Usable by the app directly (e.g. a “set up Python for data analysis” button). Runs in the sandbox with network on, writing only under<data>/python. - register
- Register
run_command,run_python, and — when there’s a data folder — eitherinstall_packages(a package manager like Nix is installed) or, failing that,install_python_packages(uvis installed).