nbinlineai.browser_output_tools

Read live notebook outputs and capture supported visible surfaces.

Direct Python calls return mutable receipts before the browser result arrives. Inspect them in a later cell. Model tools receive bounded initial status and descriptors, not image pixels. Output IDs and revisions guard changed output.

read_notebook_view

source

read_notebook_view() -> BrowserReceipt

Describe the originating notebook’s active, selected and visible cells.

Parameter Type Default Description
returns BrowserReceipt Mutable browser receipt; inspect its later status and result.

read_selection

source

read_selection(max_chars: int = 2000) -> BrowserReceipt

Read selected text only when its editor belongs to this notebook.

Parameter Type Default Description
max_chars int 2000 Maximum selected characters to return, up to 3000.
returns BrowserReceipt Mutable browser receipt; inspect its later status and result.

list_outputs

source

list_outputs(cell_id: str, cursor: str = '', limit: int = 10) -> BrowserReceipt

List existing outputs of a live code cell without materializing renderers.

Parameter Type Default Description
cell_id str required Stable ID of a live code cell in the originating notebook.
cursor str '' Page cursor from the preceding result, or empty for the first page.
limit int 10 Maximum output descriptors, from 1 through 20.
returns BrowserReceipt Mutable browser receipt; inspect its later status and result.

read_output

source

read_output(cell_id: str, output_id: str, revision: int, mime: str = 'text/plain', start: int = 0, max_chars: int = 2000) -> BrowserReceipt

Read bounded text or structured data from one unchanged output.

Parameter Type Default Description
cell_id str required Stable ID of a live code cell in the originating notebook.
output_id str required ID of an existing output from list_outputs.
revision int required Output revision from list_outputs; a changed output is rejected.
mime str 'text/plain' Requested text or structured MIME type in this output.
start int 0 Zero-based character offset in the selected representation.
max_chars int 2000 Maximum characters in this slice, from 1 through 3000.
returns BrowserReceipt Mutable browser receipt; inspect its later status and result.

export_output

source

export_output(cell_id: str, output_id: str, revision: int, save_to: str | None = None, mime: str = '') -> BrowserReceipt

Export an existing image, SVG, or bounded data MIME without rerunning its cell.

Parameter Type Default Description
cell_id str required Stable ID of a live code cell in the originating notebook.
output_id str required ID of an existing output from list_outputs.
revision int required Output revision from list_outputs; a changed output is rejected.
save_to str | None None None keeps media in memory; auto or a server-root-relative path saves a new file.
mime str '' MIME type to export, or empty for the supported default.
returns BrowserReceipt Mutable browser receipt; inspect its later status and result.

list_canvases

source

list_canvases(cell_id: str, output_id: str, revision: int, cursor: str = '', limit: int = 10) -> BrowserReceipt

List supported live canvases in this output’s materialized renderer.

Parameter Type Default Description
cell_id str required Stable ID of a live code cell in the originating notebook.
output_id str required ID of an existing output from list_outputs.
revision int required Output revision from list_outputs; a changed output is rejected.
cursor str '' Page cursor from the preceding result, or empty for the first page.
limit int 10 Maximum canvas descriptors, from 1 through 20.
returns BrowserReceipt Mutable browser receipt; inspect its later status and result.

capture_canvas

source

capture_canvas(canvas: dict[str, Any], save_to: str | None = None, max_size: int = 1280) -> BrowserReceipt

Request a still from one origin-clean bound canvas.

With save_to=None, the completed Python result is a PIL image.

Parameter Type Default Description
canvas dict[str, Any] required Bound canvas reference returned by list_canvases.
save_to str | None None None keeps media in memory; auto or a server-root-relative path saves a new file.
max_size int 1280 Maximum longest image edge in pixels, from 1 through 4096.
returns BrowserReceipt Mutable browser receipt; inspect its later status and result.

export_canvas

source

export_canvas(canvas: dict[str, Any], save_to: str | None = 'auto', max_size: int = 1280) -> BrowserReceipt

Save a still from one bound canvas, or retain it in memory with None.

Parameter Type Default Description
canvas dict[str, Any] required Bound canvas reference returned by list_canvases.
save_to str | None 'auto' None keeps media in memory; auto or a server-root-relative path saves a new file.
max_size int 1280 Maximum longest image edge in pixels, from 1 through 4096.
returns BrowserReceipt Mutable browser receipt; inspect its later status and result.

start_canvas

source

start_canvas(canvas: dict[str, Any], frame_rate: int = 30) -> BrowserReceipt

Open a video-only canvas source for the shared recorder.

Parameter Type Default Description
canvas dict[str, Any] required Bound canvas reference returned by list_canvases.
frame_rate int 30 Requested canvas rate, from 1 through 60 frames per second.
returns BrowserReceipt Mutable browser receipt; inspect its later status and result.

capture_notebook_region

source

capture_notebook_region(cell_ids: list[str], save_to: str | None = None, max_size: int = 1280) -> BrowserReceipt

Capture supported visible output surfaces from the originating notebook.

Parameter Type Default Description
cell_ids list[str] required One through twelve distinct live cell IDs with visible supported outputs.
save_to str | None None None keeps media in memory; auto or a server-root-relative path saves a new file.
max_size int 1280 Maximum longest image edge in pixels, from 1 through 4096.
returns BrowserReceipt Mutable browser receipt; inspect its later status and result.