Brain Docs

Reference

Python SDKInstallationHTTP clientWire clientSync vs async
create_spacelist_spacesdelete_spacecreate_sessionlist_sessionsdelete_session
ErrorsRetriesPagination
Brain/Docs
✦ ASKBrain on GitHubDashboard
Python SDKSpaces and sessionscreate_session

create_session

Create a session inside the caller's space, with an id you choose.

PURPOSE

A session groups memories within one space. Sessions are caller-assigned, not server-generated — which is what lets you derive one from a conversation id you already hold and never store a mapping.

POST/v1/sessionsBearer API keystable
create_session(session_id: int, title: str | None = None) -> SessionProvision
Handshake credentialstable
create_session(request: SessionCreateRequest) -> SessionCreateResponse

Parameters

ParameterTypeRequired
session_id64-bit integerrequired

The id you choose. Deriving it from an id you already have — a thread id, a ticket number — means there is no mapping table to keep in sync.

titlestringoptional

A human label. Optional.

Returns

FieldTypePresence
space_idstringalways

The space it was created in.

session_id64-bit integeralways

The id you passed.

createdbooleanalways

true when this call made it; false when it already existed.

created_at_unix_nanos / last_active_unix_nanos64-bit integeralways

Lifecycle timestamps.

memory_countintegeralways

How many memories are already in it.

Creating a session is not required before writing to it. encode with a session id that does not exist records the memory against it; create_session exists to give the session a title and to read its counters back.

You do not choose your space on the HTTP tier

The space comes from the credential. These verbs act on the caller's space. Addressing another space per request is a wire-tier capability — see act_as. Per-end-user isolation is a storage-key prefix inside one space, not a key per user; see Namespaces.

See also
encodelist_sessions

Was this page helpful?

delete_space

Erase the caller's space and everything under it — hard, immediate and safe to retry.

list_sessions

The sessions in the caller's space, with their titles and memory counts.

On this page

ParametersReturns
Suggest an editOpen in Playground