Programmatic access to the notebook daemon via Python
The runtimed Python package provides programmatic access to the notebook daemon. Use it to execute code, manage kernels, and interact with notebooks from Python scripts, agents, or automation workflows.
Each session connects to a unique “virtual notebook” room in the daemon. Sessions are isolated from each other but can share kernels if they use the same notebook_id.
Multiple sessions with the same notebook_id share the same kernel and document state. This enables Python scripts to interact with notebooks open in the app.
Two sessions with the same notebook_id share the same kernel and document:
# Session 1 creates a cell and executess1 = runtimed.Session(notebook_id="shared")s1.connect()s1.start_kernel()cell_id = s1.create_cell("x = 42")s1.execute_cell(cell_id)# Session 2 sees the cell and shares the kernels2 = runtimed.Session(notebook_id="shared")s2.connect()s2.start_kernel() # Reuses existing kernelcells = s2.get_cells()assert any(c.id == cell_id for c in cells)# Execute in s2, result visible to s1cell_id2 = s2.create_cell("print(x)")s2.execute_cell(cell_id2) # Uses x=42 from s1's execution
This enables:
Multiple Python processes sharing a notebook
Python scripts interacting with notebooks open in the app