Overview
TheSession class represents a conversation session. It provides methods for adding messages, retrieving context, and processing sessions.
Properties
Session Management Methods
delete()
Delete this session and all associated data permanently.Promise<void>
Throws: UserNotFoundError, SessionNotFoundError
Message Methods
addMessage()
Context Retrieval
getContext()
Trusted IDs Fast Path
If your system already trusts the IDs, you can skip SDK pre-validation calls and go directly to context retrieval:Whether to include memory IDs and session IDs that contributed to the context.
ContextResponse object with:
Only present when
includeMetadataIds=true. Contains:memoryIds: Array of memory IDs that contributed to the contextsessionIds: Array of session IDs that contributed to the contextagentReasoning: (Optional) Agent’s reasoning process, only populated when using agentic recall strategyvectorSearchQueries: (Optional) Vector search queries generated for recallkeywords: (Optional) Keywords extracted for recallsessionSummariesSearchQueries: (Optional) Queries used to search session summariesdateRangeFilters: (Optional) Date range filters extracted from the query (balanced recall only)
getContextStream()
Stream context events with status updates and structured metadata.Whether to include context metadata (IDs, queries, filters, and agent reasoning in status events) in the response.
ContextResponse objects with the following fields:
Only present when
includeMetadataIds=true and isFinal=true. Contains:memoryIds: Array of memory IDs that contributed to the contextsessionIds: Array of session IDs that contributed to the contextagentReasoning: (Optional) Agent’s reasoning process, only populated when using agentic recall strategyvectorSearchQueries: (Optional) Vector search queries generated for recallkeywords: (Optional) Keywords extracted for recallsessionSummariesSearchQueries: (Optional) Queries used to search session summariesdateRangeFilters: (Optional) Date range filters extracted from the query (balanced recall only)

