Skip to main content

Overview

When RecallrAI processes sessions, it may detect conflicts between new memories and existing ones. The SDK provides comprehensive tools to handle these merge conflicts through clarifying questions.

MergeConflict Class

The MergeConflict class represents a conflict between memories that requires resolution.

Properties

string
Unique identifier for the merge conflict.
string
ID of the user this conflict belongs to.
MergeConflictStatus
Current status: PENDING, IN_QUEUE, RESOLVING, RESOLVED, or FAILED
string
Content of the proposed memory that conflicts with existing ones.
list
List of existing memories that conflict with the new memory. Each contains:
  • content: Memory content
  • reason: Explanation of why it conflicts
list
List of questions to help resolve the conflict. Each contains:
  • question: The question text
  • options: List of possible answers
datetime
UTC timestamp when the conflict was created.
datetime | None
UTC timestamp when resolved, or None if not yet resolved.
dict | None
Additional data about the resolution, or None if not resolved.

List Merge Conflicts

List merge conflicts for a user with optional filtering.
integer
Number of conflicts to skip. Default: 0
integer
Maximum number of conflicts to return. Default: 10
MergeConflictStatus
Filter by status. Options:
  • PENDING: Conflict detected and waiting for resolution
  • IN_QUEUE: Queued for automated processing
  • RESOLVING: Being processed
  • RESOLVED: Successfully resolved
  • FAILED: Resolution failed
string
Sort field: created_at or resolved_at. Default: created_at
string
Sort order: asc or desc. Default: desc
Returns: MergeConflictList object with conflicts, total, and has_more fields

Get a Specific Merge Conflict

Retrieve detailed information about a specific merge conflict.
string
required
The UUID of the merge conflict to retrieve.
Returns: MergeConflict object Raises: UserNotFoundError, MergeConflictNotFoundError

Resolve a Merge Conflict

Resolve a merge conflict by answering the clarifying questions.

resolve() Method

list[MergeConflictAnswer]
required
List of answers to the clarifying questions. Each answer must include:
  • question: The question text (must match exactly)
  • answer: Selected option (must be one of the valid options)
  • message: Optional explanation for the choice
Returns: None (updates the instance in place) Raises:
  • MergeConflictNotFoundError: Conflict doesn’t exist
  • MergeConflictAlreadyResolvedError: Conflict already processed
  • MergeConflictInvalidQuestionsError: Questions don’t match original questions
  • MergeConflictMissingAnswersError: Not all questions have been answered
  • MergeConflictInvalidAnswerError: Answer is not a valid option
All clarifying questions must be answered, and each answer must match one of the provided options exactly.

Refresh Merge Conflict

Refresh the merge conflict instance to get the latest status from the server.
Returns: None (updates the instance in place) Raises: UserNotFoundError, MergeConflictNotFoundError

MergeConflictAnswer Model

When resolving conflicts, you need to create MergeConflictAnswer objects:
string
required
The exact question text from the conflict’s clarifying questions.
string
required
The selected option. Must be one of the valid options from the question.
string
Optional explanation for why this answer was selected.

Merge Conflict Statuses

Conflict has been detected and is waiting for resolution. You can call resolve() to provide answers.
Conflict is queued for automated processing by the system.
Conflict is currently being processed.
Conflict has been successfully resolved. The memories have been updated accordingly.
Conflict resolution failed. You may need to contact support or try resolving again.

Async Merge Conflicts

For async applications, all merge conflict methods support async/await:

Best Practices

Regular Monitoring: Check for pending merge conflicts regularly, especially after processing sessions with important conversations.
Contextual Answers: When resolving conflicts, use the message field to provide context about why you selected a particular answer. This helps improve the accuracy of future memory updates.
Error Handling: Always handle the specific merge conflict exceptions to provide appropriate user feedback and recovery options.