Environments, sessions and runs
Compute, live notebook state, execution records, ownership, and cleanup.
When you open a notebook, Querio starts live compute separately from the work you saved. Use session state to tell whether you can work, and run status to tell whether execution finished. Neither tells you that a result is analytically correct or current.
| Resource | What it holds | What happens when compute closes |
|---|---|---|
| Saved notebook | Cells, configuration, layout, and stored outputs in an Explore. | Saved work remains. Stored output may reflect earlier code or data. |
| Execution environment | Compute and a workspace file view. | Its running services are released; the saved notebook remains. |
| Notebook session | An open notebook in an environment, with a mode, selected datasources, and query variables. | Live Python values, cell state, and connections are lost when its runtime ends. The session is then closed; open it again to get compute. |
| Run | A recorded notebook execution or agent turn associated with a session. | Its status, input, output, error, and timestamps remain available, subject to access. The record does not keep Python running. |
Associations and ownership
A session, its notebook, and its environment belong to the same workspace. An environment hosts one active notebook kernel at a time. To work in two notebooks concurrently, use separate environments. Finish closing a session before reusing its environment.
Explicit CLI/API opens use the saved notebook ID as the session ID. Only one such session can be open for that notebook. Browser View creates a separate live session ID for each view instance, so several people can view the same Explore in independent runtimes. Keep returned IDs; do not construct them.
Opening an edit session requires Explore edit permission. A run session normally requires read permission, and custom query variables also require edit permission. Sharing an Explore does not grant control of another person's live session or query access. Session events and scratchpad execution check runtime identity, with separate authorization for managed platform work.
Session datasource selections and query variables configure execution; query variables are not Python globals. Close and deliberately reopen an explicit session to change its configuration. A notebook may have a bound agent session in the same environment. Closing the agent leaves the notebook usable; closing the notebook closes its bound agents.
Close only resources you created or were asked to close. Resource IDs are not access grants. Query access still requires datasource permission and exactly one authorized credential; see Groups.
When notebook configuration is omitted, opening uses saved session configuration for the same mode, or the conversation defaults on first open. Agent sessions likewise use saved settings or conversation defaults; fields supplied in a nonempty agent configuration override those defaults. An explicit empty configuration ({}) requests empty settings rather than inherited settings.
Readiness and session states
An environment reporting ready can host a notebook. It does not mean a notebook is open or any cell has run.
| Environment state | Meaning |
|---|---|
ready | The environment resource is available. Notebook readiness is checked separately. |
closed | The environment resource has been released. Create another environment before opening a notebook there. |
An explicit notebook open can return while startup is in progress. Wait for session readiness before using it; readiness is not an execution result.
| Notebook session state | Meaning and next action |
|---|---|
starting | Saved state is loading and the runtime is starting. Wait for readiness. |
ready | The session can accept work. A calculation may still be running or may have failed. |
closing | Shutdown is in progress. Wait before reusing the notebook or environment. |
closed | No usable runtime is attached. Deliberately reopen an explicitly closed session. |
failed | Startup or session bookkeeping failed. Inspect error before retrying. |
Read id, notebookId, environmentId, workspaceId, mode, config, state, and error together. activeRunId identifies a tracked run when present; its absence does not establish that no interactive work is happening.
Inspection never starts compute
Inspecting a session reports whether it is live right now. After idle reclamation or a server restart the session reports closed with its saved configuration; open it again with notebook-session create to get fresh compute. Fresh compute does not recover in-memory Python values. Run the cells you need again.
Edit and View modes
The session mode run controls what you can do in View. It is distinct from a recorded execution run.
| Mode | Notebook behavior |
|---|---|
edit | Author and execute cells. Notebook changes are saved to the Explore; its editing conversation is saved separately. |
run | Execute existing, unchanged cells and use controls. You cannot author cells or rename the source notebook. Live results and View chat are not saved back to the source Explore. |
View's authoring restriction does not make the filesystem or database read-only. Hybrid and Notebook are display presets, not execution modes. See Explores for View chat and continuation into editable work.
Opening a CLI/API session does not execute its cells. The browser manages its own initialization and may run the notebook when opening View.
Operations and outcomes
These commands show which action creates, inspects, or closes each resource. See the CLI reference for flags and result shapes, or Get started with CLI for the authoring path. The CLI is distributed through its official repository.
| Operation | CLI command | Result |
|---|---|---|
| Create compute | execution-environment create | Environment ID; no notebook opened. |
| Open a saved notebook | notebook-session create | Session ID. --wait waits for readiness and leaves resources open. |
| Inspect | notebook-session get | Current session state and saved configuration; never starts compute. |
| Wait for readiness | notebook-session wait | Ready or terminal session state, or a local timeout error; no execution submitted. |
| Interactive work | code exec | Synchronous result with success and errors; no durable run ID. |
| Execute the notebook | notebook-session execute | Run ID after acceptance. --wait waits for a terminal result and leaves resources open. |
| Read history | notebook-session executions | Saved runs, oldest first, with pagination. |
| Inspect or wait for a run | runs get, runs wait | Recorded status and results. |
| Request cancellation | runs cancel | Accepted request; inspect until the run is terminal. |
| Close a session | notebook-session close | Saves first, then closes the session and bound agents. Environment remains open. |
| Close compute | execution-environment close | Releases the environment after attached sessions close. Saved notebooks remain. |
For a notebook run-all API event, data.closeAfterDone: true requests run-scoped resources. If the notebook has no open saved session, execution creates one using its retained configuration and closes that session and environment before recording success, failure, or cancellation. If an open session already exists, execution borrows it and leaves it open. This option defaults to false and is used by Explore sync automations.
The current shared run inspection and cancellation API endpoints are marked deprecated; replacement endpoints are not yet defined. Existing CLI commands use the current surface. See the API reference before choosing an integration contract.
Run states and results
Run status is separate from session state: a session can be ready while a run is running. A returned run ID means the request was accepted, not that the work succeeded.
| Recorded status | Meaning |
|---|---|
pending | Reserved or waiting for dispatch; it may not have reached the runtime. |
running | Started, with no terminal result recorded. |
completed | Successful execution recorded. Check the result and analytical assumptions before using it. |
failed | Execution, dispatch, or recovery failed. Inspect error and existing effects before retrying. |
cancelled | Cancellation recorded. Effects already completed are not rolled back. |
A response or live event can say cancelling while interruption is in progress. Read the recorded status for the final outcome. Cancellation does not guarantee that a remote warehouse query stopped.
Runs record kind (notebook or agent), sessionId, input, output, error, and creation, start, and completion times. Run output can differ from the notebook's current source, stored output, or a later result. Records remain after session and environment closure, subject to access; a live task index may disappear on restart. If a runtime vanishes without a completion report, do not assume success. No fixed history-retention period is promised here.
Concurrency and saving
Notebook execution and agent turns have busy checks. Another execution for the same active session can fail with Session execution already in progress. Browser editing can also be refused while an editor or automation holds the Explore. Wait for that work to finish; do not close someone else's session to clear a conflict.
In an editable session, a successful code exec waits for the notebook save. If saving fails, the code may already have run and changed cells. Keep the session open, inspect its cells and saved state, resolve the save failure, then retry saving or closing. Do not replay authoring code or submit a durable run just to flush a save.
Replacing a closed notebook's saved cells is a separate operation. Saved updates do not currently enforce a timestamp precondition. A title-only update can occur while a session is open. See CLI reference.
Disconnect, timeout, and close
| Event | Resource effect |
|---|---|
| Browser notebook or chat connection drops | The connection ended; another connection or active work can keep the session alive. |
| Browser session becomes idle and unobserved | Compute may be reclaimed after the configured idle grace period. The session is then closed; reconnecting opens it again with its saved configuration. |
| CLI readiness wait times out | Created resources remain. Inspect them using the returned or printed IDs. |
| Durable run wait times out | Local waiting stops; the run may continue. Inspect it before submitting again. |
| Interactive execution disconnects or is interrupted | Interruption is requested. Completed writes and other effects can remain. Check state before retrying. |
| Session close succeeds | Runtime and bound agents close; saved notebook work and recorded runs remain. Environment stays open. |
| Environment close succeeds | Compute is released; the saved notebook is not deleted. |
The browser manages resources it opens. CLI/API callers close their own sessions, then their environments. Closing a terminal or losing a stream is not cleanup. Active work is protected from ordinary idle reclamation, but process failure and explicit close can still stop it.
Errors and recovery
| Condition | Next action |
|---|---|
| Wrong workspace or unavailable resource | A lookup can return 404. Check workspace and IDs; an ID is not an access grant. |
| Notebook or environment occupied | A 409 can mean another session owns it. Inspect the session, use separate compute, or close only your earlier session. |
| Environment still has sessions | Close attached sessions before retrying environment close (409). |
| Startup fails | Inspect session error. It may report failed; execution acquisition can return 503. Resolve the cause before reopening. |
| View tries to change cells | Use an authorized edit session or continue into a new Explore (403). |
| Save fails before session close | Close fails and the live session stays open. Resolve persistence, inspect saved code, then retry close. |
| Runtime closed but closure could not be saved | The session reports failure with a retry-close message. Resolve it and retry session close before environment close. |
Runtime replaced without a recorded outcome | Previously running work can be marked failed. Check results and external effects before rerunning. |
| Run already terminal | Cancellation returns 409. Read its recorded outcome. |
For cells and stored outputs, see Notebooks. For resource creation and cleanup, use Get started with CLI.
Last updated on November 18, 2026