Skip to main content

SQLsaber Notebook

Notebook-specific data-analysis subagent for SQLsaber.

Implemented components:

  • provider-neutral notebook execution contract,
  • hardened local Docker execution (default),
  • explicit remote Modal Sandbox execution through the optional modal extra,
  • fresh-kernel transactional notebook sessions,
  • bounded notebook/image rendering and history collapse,
  • list_workspace and edit_cell analyst tools,
  • a Pydantic AI notebook analyst,
  • a managed SQLsaber analyze_data capability, and
  • the standalone sqlsaber-notebook CLI.

When installed with SQLsaber, the main agent can hand prior successful SQL results to analyze_data for multi-step calculations, statistics, transformations, and plots. The terminal displays the bounded executed notebook and plot previews before the main agent's text response. Notebook bytes and images are not sent to the parent model. Managed SDK applications can persist the notebook, plots, and generated files through SQLSaberOptions.artifact_publisher; only the publisher's durable references are stored in tool metadata and exposed through SQLSaberResult.artifacts.

The default balanced runtime targets larger EDA and classical ML: 4 CPUs, 8 GiB memory, and up to 100 MiB per input/250 MiB total. SQLsaber does not cap model requests, notebook cell count, the analyst loop, or the whole operation. Individual cells retain a 10-minute timeout so a stuck computation can be diagnosed without ending the overall analysis. These are fixed product defaults rather than CLI tuning flags. Use an immutable custom image through SQLSABER_NOTEBOOK_IMAGE when additional ML libraries are required.

Managed SQLsaber usage

uv tool install --with sqlsaber-notebook sqlsaber
saber

Docker is the default local backend. Select Modal explicitly because query results will be uploaded to a third party:

SQLSABER_NOTEBOOK_BACKEND=modal saber

Configure a dedicated analyst model with:

saber models set --agent notebook

For a web backend, inject an application-owned artifact publisher and pass tenant scope as run metadata:

from sqlsaber import FilesystemArtifactPublisher, SQLSaber, SQLSaberOptions

options = SQLSaberOptions(
    database="sqlite:///analytics.db",
    artifact_publisher=FilesystemArtifactPublisher("/private/artifacts"),
)

async with SQLSaber(options=options) as saber:
    result = await saber.query(
        "Analyze and plot revenue anomalies",
        conversation_id="conversation-123",
        metadata={"tenant_id": "acme"},
    )
    print(result.artifacts)

Implement the cloud-neutral ArtifactPublisher protocol to use S3, GCS, Azure Blob Storage, or another bucket. Return stable object references rather than expiring signed URLs.

Standalone usage

uv run sqlsaber-notebook \
  --model anthropic:claude-sonnet-4-6 \
  --backend docker \
  --output analysis.ipynb \
  "Compare revenue by region and explain material anomalies" data.csv

Modal is never selected as an automatic fallback. Select it explicitly because local files will be uploaded to Modal:

modal setup
SQLSABER_NOTEBOOK_BACKEND=modal uv run sqlsaber-notebook \
  --model anthropic:claude-sonnet-4-6 \
  "Analyze this dataset" data.csv

Development

uv sync
uv run pytest plugins/notebook/tests -q

Run live backend integration tests explicitly:

SQLSABER_RUN_DOCKER_INTEGRATION=1 \
  uv run pytest plugins/notebook/tests/test_notebook_docker_integration.py -q

SQLSABER_RUN_MODAL_INTEGRATION=1 \
  uv run pytest plugins/notebook/tests/test_notebook_modal_integration.py -q

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqlsaber_notebook-0.2.0.tar.gz (219.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sqlsaber_notebook-0.2.0-py3-none-any.whl (38.6 kB view details)

Uploaded Python 3

File details

Details for the file sqlsaber_notebook-0.2.0.tar.gz.

File metadata

  • Download URL: sqlsaber_notebook-0.2.0.tar.gz
  • Upload date:
  • Size: 219.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for sqlsaber_notebook-0.2.0.tar.gz
Algorithm Hash digest
SHA256 299a03c6a933b85f635bf3a69fe4d2bec43755b91b2e09401e29eb7dfd78ed61
MD5 bc2917a87315fac1f0a60828074f36c6
BLAKE2b-256 8d313c7317305d3249b0b6e384148e7f35aac60557d5b522920ed7903ecd425a

See more details on using hashes here.

File details

Details for the file sqlsaber_notebook-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: sqlsaber_notebook-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 38.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for sqlsaber_notebook-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3450189f7d740b31609e81b6e6e9590baf1742b1874daa539fc6b42bc5a1ce8c
MD5 429cfe72b7a0dd7f5a12148057b40887
BLAKE2b-256 db75e119312bf7c521a815143ba37491dbe707ce1cc12f3e8caccb1a897687ec

See more details on using hashes here.

Release history Release notifications | RSS feed

0.6.0

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

This release

0.2.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page