Expand description
Notebook cell execution backend for
POST /api/v1/notebooks/{notebook_id}/{cell_id}/run.
The Python reference at
/tmp/cognee-python/cognee/modules/notebooks/operations/run_in_local_sandbox.py
uses in-process exec() and captures print() calls into a list. Running
arbitrary user code in-process in Rust would be a remote-code-execution
gun, so this module instead spawns an isolated python3 subprocess and
captures stdout/stderr, then enforces wall-clock, memory, and output-size
caps.
Trait shape: a single async NotebookRunner::run_cell returning a
RunCellOutcome. Production wiring uses SubprocessRunner; tests
that don’t want to spawn Python plug in a mock runner.
Structs§
- RunCell
Outcome - Wire-shape outcome of running a single cell.
- Subprocess
Runner - Production runner: spawns
python3 -c '<wrapper>'and feeds the user’s code via stdin.
Enums§
- Runner
Error - Errors that can surface from a
NotebookRunnerimplementation.
Traits§
- Notebook
Runner - Abstract code-execution backend.