Overview
TheUser class represents a user in your RecallrAI project. It provides methods for managing sessions, memories, messages, and merge conflicts.
Properties
Unique identifier for the user.
User metadata as a dictionary.
UTC timestamp when the user was created.
UTC timestamp of the user’s last activity.
User Management Methods
update()
Update the user’s metadata or ID.New metadata to replace the existing metadata. Completely replaces the old metadata.
Optional new user ID. Must be unique within your project.
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.Automatically process the session after this many seconds of inactivity. Optional.
Optional metadata to associate with the session.
Session object
Raises: UserNotFoundError
get_session()
Retrieve an existing session by ID.The UUID of the session to retrieve.
Session object
Raises: UserNotFoundError, SessionNotFoundError
list_sessions()
List all sessions for the user with optional filtering.Number of sessions to skip. Default:
0Maximum number of sessions to return. Default:
10Filter sessions by metadata fields.
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.Filter by memory categories. Only memories matching these categories are returned.
Filter by specific session IDs.
Filter by session metadata.
Number of memories to skip. Default:
0Maximum number of memories to return. Range: 1-200. Default:
20Include version history for each memory. Default:
TrueInclude related memories. Default:
TrueMemoryList object
Raises: UserNotFoundError, InvalidCategoriesError
Memory Item Fields
Each memory item contains:memory_id: Unique identifier for the current versioncategories: List of category stringscontent: Current version’s content textcreated_at: UTC timestamp when createdsession_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 active conflict
Message Methods
get_last_n_messages()
Retrieve the most recent messages for the user across all sessions.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.Number of conflicts to skip. Default:
0Maximum number of conflicts to return. Default:
10Filter by status:
PENDING, IN_QUEUE, RESOLVING, RESOLVED, FAILEDSort field:
created_at or resolved_at. Default: created_atSort order:
asc or desc. Default: descMergeConflictList object
get_merge_conflict()
Get a specific merge conflict by ID.The UUID of the merge conflict to retrieve.
MergeConflict object
Raises: UserNotFoundError, MergeConflictNotFoundError
Async User
For async applications, useAsyncUser: