Overview
TheUser class represents a user in your RecallrAI project. It provides methods for managing sessions, memories, messages, and merge conflicts.
Properties
string
Unique identifier for the user.
dict
User metadata as a dictionary.
bool | None
Per-user merge conflict override.
True = always raise merge conflicts for this user. False = never raise. None = inherit the project-level setting.datetime
UTC timestamp when the user was created.
datetime
UTC timestamp of the user’s last activity.
User Management Methods
update()
Update the user’s metadata or ID.dict
New metadata to replace the existing metadata. Completely replaces the old metadata.
string
Optional new user ID. Must be unique within your project.
bool
Per-user merge conflict override.
True = always raise merge conflicts for this user. False = never raise. Pass None explicitly to reset to the project-level default.UserNotFoundError, UserAlreadyExistsError
refresh()
Refresh the user instance with the latest data from the server.UserNotFoundError
delete()
Delete the user and all associated data.UserNotFoundError
Session Management Methods
create_session()
Create a new session for the user.integer
Automatically process the session after this many seconds of inactivity. Optional.
dict
Optional metadata to associate with the session.
datetime
Optional custom timestamp for when the session was created. Must be a timezone-aware datetime in UTC. Useful for benchmarking or importing historical data.
Session object
Raises: UserNotFoundError, ValueError (if timestamp is not UTC)
Example with Custom Timestamp
get_session()
Retrieve an existing session by ID.string
required
The UUID of the session to retrieve.
boolean
default:"True"
Whether to validate session existence via API before creating the instance. Set
False only when user_id and session_id are already trusted.Session object
Raises: UserNotFoundError, SessionNotFoundError
When
validate=False, fields that require an API lookup (for example status, created_at, and metadata) are set to UNAVAILABLE until you call refresh().
Import UNAVAILABLE from recallrai.models when checking these values.list_sessions()
List all sessions for the user with optional filtering.integer
Number of sessions to skip. Default:
0integer
Maximum number of sessions to return. Default:
10dict
Filter sessions by metadata fields.
list[SessionStatus]
Filter by session status. Available statuses:
PENDING, PROCESSING, PROCESSED, FAILEDSessionList object with sessions, total, and has_more fields
Memory Management Methods
list_memories()
List user memories with optional filtering.list[string]
Filter by memory categories. Only memories matching these categories are returned.
list[string]
Filter by specific session IDs.
dict
Filter by session metadata.
integer
Number of memories to skip. Default:
0integer
Maximum number of memories to return. Range: 1-200. Default:
20boolean
Include version history for each memory. Default:
Trueboolean
Include related memories. Default:
TrueMemoryList object
Raises: UserNotFoundError, InvalidCategoriesError
get_memory()
Retrieve a single memory by its ID.string
required
UUID of the memory to retrieve.
boolean
Include version history for the memory. Default:
Trueboolean
Include related memories. Default:
TrueUserMemoryItem object
Raises: RecallrAIError
delete_memory()
Delete a specific memory version, with an option to also remove all previous versions in the chain.string
required
UUID of the memory to delete. Can be any version in the version chain.
boolean
If
True, deletes the specified version and all previous versions in the chain. If False (default), deletes only the specified version.None
Raises: RecallrAIError
Memory Item Fields
Each memory item contains:memory_id: Unique identifier for the current versioncategories: List of category stringscontent: Current version’s content textevent_date_start: UTC timestamp when the event started (actual event time, not when it was recorded)event_date_end: UTC timestamp when the event ended (actual event time, not when it was recorded)created_at: UTC timestamp when this memory version was created (when it was recorded in the system)expired_at: UTC timestamp when this version expired — only set when viewing an expired/previous versionexpiration_reason: Why this version was superseded (MERGE_CONFLICT,ADDITION_TO_EXISTING_MEMORY,TEMPORAL_CONFLICT) — only set for expired versionssession_id: ID of the session that created this versionversion_number: Current version numbertotal_versions: Total number of versionshas_previous_versions: Boolean indicating multiple versions existprevious_versions: List ofMemoryVersionInfoobjects (optional)connected_memories: List ofMemoryRelationshipobjects (optional)merge_conflict_in_progress: Boolean indicating an active (unresolved) conflict on this memorymerge_conflict_id: ID of the merge conflict that caused this memory to expire — only set whenexpiration_reasonisMERGE_CONFLICTand a conflict record exists (manually resolved conflicts only)
MemoryVersionInfo object in previous_versions contains:
memory_id: ID of that specific version (can be passed toget_memory()for full details)version_number: Version number (1 = oldest)content: Content of that versionevent_date_start/event_date_end: Event timestamps for that versioncreated_at: When that version was createdexpired_at: When that version expiredexpiration_reason: Why it was supersededmerge_conflict_id: Conflict that caused expiration, if applicable
The difference between
event_date_start/event_date_end and created_at:- Event dates represent when the event actually occurred in the real world (e.g., “I met John on Monday”)
- Created at represents when the memory was extracted and stored in the system
Message Methods
get_last_n_messages()
Retrieve the most recent messages for the user across all sessions.integer
required
Number of recent messages to retrieve.
MessageList object with messages field
Raises: UserNotFoundError
Merge Conflict Methods
list_merge_conflicts()
List merge conflicts for the user.integer
Number of conflicts to skip. Default:
0integer
Maximum number of conflicts to return. Default:
10MergeConflictStatus
Filter by status:
PENDING, IN_QUEUE, RESOLVING, RESOLVED, FAILEDstring
Sort field:
created_at or resolved_at. Default: created_atstring
Sort order:
asc or desc. Default: descMergeConflictList object
get_merge_conflict()
Get a specific merge conflict by ID.string
required
The UUID of the merge conflict to retrieve.
MergeConflict object
Raises: UserNotFoundError, MergeConflictNotFoundError
Async User
For async applications, useAsyncUser:
Working with Historical Data
When importing historical data or running benchmarks, you can preserve original timestamps:When sessions are processed with custom timestamps, the memory extraction and context retrieval use that timestamp instead of the current time. This ensures accurate temporal context for benchmarking and historical data analysis.

