SessionIndex,
created from MossClient.session().
Sessions are available in the Python, Swift, Elixir, and C SDKs today. JavaScript (Node)
session support is coming.
Lifecycle
Create or resume
client.session(name) returns a SessionIndex. If a cloud index with that name already
exists, it auto-loads into the session (no re-embedding); otherwise the session starts
empty. The workflow is identical in both cases.Mutate locally
add_docs, delete_docs, and get_docs run in-memory. add_docs embeds locally via the
Rust core - no network. With model_id="custom", each document must carry its own
.embedding.Query locally
query runs entirely in-memory (~1-10 ms) and supports the same metadata filter syntax as
MossClient.query().Example
Short-term vs. long-term context
A session is short-term context - the working set for the current interaction. A persistent cloud index loaded withload_index()
is long-term context - durable knowledge shared across interactions. Most real-time
apps query both; see Live-call context.
Models
The session’s embedding model is set by themodel_id argument to session() (default
"moss-minilm"; also "moss-mediumlm" or "custom"). When resuming an existing cloud
index, omit model_id to adopt the stored model - passing a different one raises a
ValueError. All participants resuming the same index must use the same model.
Authentication
Project credentials are validated when the session is opened;session() raises if they’re
invalid. See Authentication.
Related
Real-time local indexing
Why sessions are sub-10 ms.
Cross-agent handoff
Resume a session on another agent or channel.