Connection
Base URL, credentials and a reachable server.
Review trusted_child.py as a trusted-code process wrapper, checking the return code and direct-child cleanup instead of assuming isolation.
Base URL, credentials and a reachable server.
A model available through the configured endpoint.
Context limits and tool support are determined by the model and server.
import math, os, subprocess, sys
from pathlib import Path
def run_trusted_python(script, seconds, folder):
if type(script) is not str or len(script) > 4096:
raise ValueError("child.script")
if type(seconds) not in (int, float) or not .05 <= seconds <= 5 or not math.isfinite(seconds):
raise ValueError("child.timeout")
if not isinstance(folder, (str, Path)) or not Path(folder).is_dir():
raise ValueError("child.folder")
return subprocess.run([sys.executable, "-I", "-S", "-X", "utf8", "-c", script],
cwd=folder, timeout=seconds, capture_output=True, text=True,
encoding="utf-8", check=False,
creationflags=subprocess.CREATE_NO_WINDOW if os.name == "nt" else 0)