Open Science maintains a persistent Python kernel per session, enabling stateful multi-step analyses — variables, imports, and data all persist across agent turns. Each session runs its own isolatedDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/aipoch/open-science/llms.txt
Use this file to discover all available pages before exploring further.
python3 interpreter process, launched on demand and kept alive as long as the session is active.
Kernel Lifecycle
Kernel starts on first use
The
NotebookPythonExecutor spawns a python3 subprocess the first time a code cell is executed in the session. The subprocess hosts a lightweight stdin/stdout JSON bridge that keeps a single global namespace alive across all executions, so variables defined in one cell are available in later cells.Agent streams code into a cell
The agent writes code using a three-step protocol:
beginCodeCell acquires an exclusive write lock, appendCodeCell streams incremental code deltas into the cell, and finishCodeCell releases the lock. The notebook preview reflects each delta as it arrives.runCell executes the code
runCell sends the completed cell code to the bridge over stdin as a newline-delimited JSON request. The bridge executes the code in the shared global namespace, capturing both file descriptors and subprocess writes, then returns stdout, stderr, and a traceback (if any) as a JSON response on stdout.Results are written to run.json
The
NotebookRunRecord produced by the execution is persisted in run.json for the session. The record includes the source code, status, timestamps, all outputs, and a list of any working files created during the run. The preview panel reloads the record to show live progress.Artifacts are collected
Files written to the notebook session root or data root during execution are surfaced as artifacts in the conversation thread. Artifact tabs open in the preview panel when the agent or user clicks them.
The kernel is scoped per session. Restarting one session’s kernel does not affect any other session — each has its own subprocess and its own global namespace.
Kernel Status
TheNotebookKernelMetadata.lastKnownStatus field reflects the current state of the interpreter:
| Status | Description |
|---|---|
idle | The interpreter is ready and waiting for the next execution request |
starting | The subprocess is being spawned for the first time |
running | A cell is currently executing inside the bridge |
error | The interpreter encountered a fatal error or exited unexpectedly |
shutdown | The interpreter has been explicitly shut down |
NotebookRunRecord Fields
Every execution produces aNotebookRunRecord stored in run.json. The table below describes each field:
| Field | Type | Description |
|---|---|---|
runId | string | Unique identifier for this run |
cellId | string | The ID of the cell that triggered this run |
source | 'agent' | 'user' | Whether the run was initiated by the agent or by the user terminal |
inputKind | 'cell' | 'terminal' | Distinguishes regular notebook cells from terminal submissions |
script | string | The exact Python code that was executed |
status | NotebookRunStatus | The terminal state of this run (see below) |
startedAt | number | Unix timestamp (ms) when execution began |
endedAt | number | Unix timestamp (ms) when execution completed |
cwdBefore | string | Working directory at the start of execution |
cwdAfter | string | Working directory after execution (may differ if the code called os.chdir) |
executionCount | number | Monotonically increasing counter across all runs in the session |
text | NotebookTextOutput | Structured capture of stdout, stderr, traceback, and a plain display array |
outputs | NotebookOutput[] | Structured output objects (stream, error, text, json) |
artifacts | ArtifactFile[] | Files promoted to the artifact store during this run |
workingFiles | NotebookWorkingFile[] | Intermediate files found in the working directory after execution |
truncated | boolean | Set when the run record was trimmed due to output size |
Run Status Values
NotebookRunStatus is one of:
run.json Structure
Each notebook session persists its full execution history in arun.json file at the path <storageRoot>/notebooks/<projectName>/<sessionId>/run.json. The document is a NotebookRunDocument with version: 1:
kernel object stores interpreter metadata including the pythonPath, kernelName, runtimeRoot, and lastKnownStatus. The runs array is the ordered history of every execution in the session.
Working Files
Files created inside the notebook session workspace are tracked asNotebookWorkingFile entries. Each entry has a kind field from NotebookWorkingFileKind:
| Kind | Description |
|---|---|
raw-data | Original input data files, not yet processed |
processed-data | Data that has been transformed or cleaned |
cache | Intermediate computed results saved to speed up reruns |
script | Helper scripts written by the agent or user |
intermediate | Temporary computation outputs not intended as final results |
other | Any file that doesn’t fit the above categories |
NotebookOutput Types
Structured outputs returned by the interpreter bridge are typed asNotebookOutput:
| Type | Fields | Description |
|---|---|---|
stream | name: 'stdout' | 'stderr', text | A line or block of standard output or error text |
error | name?, message?, traceback | A Python exception with optional name, message, and full traceback |
text | text | Plain text output not associated with a specific stream |
json | data | A rich structured object, such as a serialized DataFrame summary |