Overview
TheSession class represents a conversation session. It provides methods for adding messages, retrieving context, and processing sessions.
Properties
string
Unique identifier for the session.
SessionStatus
Current session status:
PENDING, PROCESSING, PROCESSED, or FAILED.object
Session metadata as an object.
datetime
UTC timestamp when the session was created.
Session Management Methods
delete()
Delete this session and all associated data permanently.Promise<void>
Throws: UserNotFoundError, SessionNotFoundError
Message Methods
addMessage()
MessageRole
required
Message role:
USER or ASSISTANT.string
required
Message content text.
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:RecallStrategy
Strategy for memory retrieval:
LOW_LATENCY, BALANCED, AGENTIC, or AUTO.number
default:"15"
Minimum number of memories to return. Range: 5-50.
number
default:"50"
Maximum number of memories to return. Range: 10-100.
number
default:"0.6"
Similarity threshold for memories. Range: 0.2-0.8.
number
default:"0.5"
Similarity threshold for summaries. Range: 0.2-0.8.
number
Number of last messages to include in context. Range: 1-100.
number
Number of last summaries to include in context. Range: 1-20.
string
default:"UTC"
Timezone for formatting timestamps (e.g., “America/New_York”).
boolean
default:"true"
Whether to include the default RecallrAI system prompt.
boolean
default:"false"
Whether to include memory IDs and session IDs that contributed to the context.
ContextResponse object with:
boolean
Always
true for non-streaming responses.string
The formatted context string containing relevant memories and conversation history.
ContextMetadata
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.boolean
default:"false"
Whether to include context metadata (IDs, queries, filters, and agent reasoning in status events) in the response.
ContextResponse objects with the following fields:
boolean
Indicates whether this is the final event or a status update.
string
Human-readable status update message (only present when
isFinal is false).string
Error message if an error occurred during context generation.
string
The formatted context string (only present when
isFinal is true).ContextMetadata
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)

