Brain Docs

Reference

TypeScript SDKInstallationHTTP clientWire client
createSpacelistSpacesdeleteSpacecreateSessionlistSessionsdeleteSession
ErrorsRetriesPagination
Brain/Docs
✦ ASKBrain on GitHubDashboard
TypeScript SDKSpaces and sessionscreateSession

createSession

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
createSession(input: CreateSessionInput): Promise<SessionProvision>
Handshake credentialstable
createSession(request: SessionCreateRequest): Promise<SessionCreateResponse>

Parameters

ParameterTypeRequired
sessionId64-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
spaceIdstringalways

The space it was created in.

sessionId64-bit integeralways

The id you passed.

createdbooleanalways

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

createdAtUnixNanos / lastActiveUnixNanos64-bit integeralways

Lifecycle timestamps.

memoryCountintegeralways

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; createSession 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
encodelistSessions

Was this page helpful?

deleteSpace

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

listSessions

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

On this page

ParametersReturns
Suggest an editOpen in Playground