Skip to main content
A session is an in-process index. You open it with client.session(name), then add, query, and delete documents locally; embedding and search run on-device, with no network call per operation. When you are done, push_index() persists the index to the cloud. A session is represented by a SessionIndex.

Operations

Session operations run on device, with add_docs and query in process before optional push_index to cloudSession operations run on device, with add_docs and query in process before optional push_index to cloud
  • add_docs(docs, options?) - embeds and indexes documents locally; returns (added, updated).
  • query(text, options?) - semantic or hybrid search over the in-memory index; returns a SearchResult.
  • get_docs(options?) / delete_docs(ids) - read and remove documents locally.
  • push_index() - uploads the session to the cloud, creating or replacing the cloud index of the same name. No server-side re-embedding.
session(name) is create-or-resume: if a cloud index with that name already exists it is loaded into the session (no re-embedding); otherwise the session starts empty. The API is the same in both cases.

Example

Performance characteristics

  • Operations run in-process: no network round trip, TLS, or serialization on the query path.
  • Query text is embedded by a local model; with model_id="custom" you supply the query vector via QueryOptions.embedding instead.
  • Local queries typically complete in single-digit milliseconds, which suits short, frequent queries against a per-session or per-user working set.

Session vs. loaded cloud index

The two compose: load a persistent index and open a session in the same client. See Live-call context.

Sessions guide

The full session lifecycle and API.

SessionIndex reference

Methods, parameters, and return types.