sandbox
agentic_ml.core.sandbox
¶
Run untrusted, agent-generated code out-of-process.
This module is deliberately ML-agnostic: it only knows how to launch a Python subprocess with
a timeout, a clean-ish environment and captured output. The evaluation logic lives in
:mod:agentic_ml.core.evaluation, which is what gets executed here.
ExecResult
dataclass
¶
ExecResult(
returncode: int | None,
stdout: str,
stderr: str,
timed_out: bool,
duration: float,
)
Outcome of a subprocess run.
run
¶
run(
args: list[str],
cwd: str | Path,
timeout: float,
env: dict[str, str] | None = None,
) -> ExecResult
Run args in cwd with a hard timeout (seconds).
Source code in src/agentic_ml/core/sandbox.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |