Skip to Content

Class Session

An open session, with every session-bound memory operation applied.

Returned by MemoryOperations.startSession and MemoryOperations.withSession alike; not constructed directly. No method here takes a session id or a domain: this object supplies both. That is the point of it — a call that silently drops the session id is still a valid call. It opens a session of its own and records the search there, so the series you were assembling quietly splits in two, and a later rating lands against a search you did not mean to make.

Nothing closes one: the contract has no operation that ends a session, so this is a handle to carry rather than a resource to release. Used as an async-disposable, [Symbol.asyncDispose] releases nothing either — it exists so await using can bound the region of code a session belongs to, which is a claim about the reader's attention rather than about a resource.

Index
id: string

The session id that was opened.

instructions: Instructions

What the service said when the session was opened.

toolCatalog: readonly ToolDescriptor[] | null

What MemoryOperations.listTools reported when this session was opened, which tools filters against. null when that fetch failed -- every tool is then treated as available rather than none.

Constructed by MemoryOperations.startSession, never by a caller.

  • Leave the session.

    Deliberately a no-op. See the class documentation.

    Returns Promise<void>

  • Fetch one memory in full, by an idx this session returned.

    Parameters

    • idx: string

      The handle, copied exactly as it appeared in a search response.

    • options: TimeoutOptions = {}

      Per-call deadline.

    Returns Promise<Memory>

    The memory, its feedback() bound to this session — unlike MemoryOperations.getMemory, which has no session of its own to bind.

  • This session's operations, described and rendered for an LLM.

    Each tool carries what the operation is for, a JSON Schema for its arguments, and a call that renders the result as text. Every one is bound to this session, so nothing a model sends can change which session a call is recorded under.

    The toolset hands itself to a framework — toLangChain(), toAnthropic(), toOpenAI() — or runs what a model named with call().

    An operation is included only when your token's role permits it, as reported by MemoryOperations.listTools when this session was opened. This only shapes what is offered here — it does not gate calling a Session method directly.

    Returns Toolset

    One tool per operation your role permits, as a Toolset.

    await using session = await client.memory.withSession('coding')
    createAgent({ model, tools: await session.tools().toLangChain() })