Long-term memory usage examples
Apply Unreal long-term memory patterns for returning learners, shared devices, first sessions, and fresh-start reset flows.
Use these patterns after Long-term memory quick start is working. Each example focuses on which identity values to set on the chatbot component before StartSession. For assignment steps, see End-user identity.
Returning learner in a training simulation
A safety training simulation should remember that a learner has already completed a valve inspection module.
Setup:
LTM is enabled for the training character.
The learner has a saved
SpeakerID.
Blueprint flow:
Load
SpeakerIDfrom the learner'sSaveGameor account profile.Set
UConvaiChatbotComponent.EndUserIDandUConvaiPlayerComponent.EndUserIDto the saved value.Call
StartSessionon the chatbot component.
Expected outcome: The character can refer to facts learned in earlier sessions for the same learner and character.
First-time player profile
A new player starts the application with no stored identity.
Setup:
The project has collected a display name, such as
Alex.No saved
SpeakerIDexists for the profile.
Blueprint flow:
Call Convai Create Speaker ID with Speaker Name set to the display name.
On On Success, save the returned
SpeakerID.Set both components'
EndUserIDto the saved value.Call
StartSession.
For the full create workflow, see Speaker ID management.
Expected outcome: Convai creates a distinct memory scope for this player and character pair. Future launches should reuse the saved SpeakerID.
Shared classroom device
Several learners use the same machine during guided practice. Device fallback would merge their memory, so each learner needs an explicit identity.
Setup:
Each learner selects or signs into a profile before interacting with the character.
Each profile stores its own
SpeakerID.
Blueprint flow:
On profile selection, load that profile's
SpeakerID.Set the chatbot and player
EndUserIDvalues beforeStartSession.Keep each profile's
SpeakerIDseparate from other profiles on the same device.
Expected outcome: The character remembers each learner separately, even though all learners use the same device.
Account-backed identity
An enterprise onboarding app already has a user account ID and does not need a Speaker ID record.
Setup:
The account system provides a stable user ID, such as
employee-1042.The account ID does not change across devices.
Blueprint flow:
Load the signed-in user's account ID.
Set
UConvaiChatbotComponent.EndUserIDandUConvaiPlayerComponent.EndUserIDto the account ID.Optionally set
EndUserMetadataon both components with the same JSON string:
Call
StartSession.
Expected outcome: Memory follows the account identity instead of the local device.
Fresh start for a new scenario attempt
A learner repeats an assessment and should begin a fresh conversation, while keeping the same long-term identity.
Setup:
The learner keeps the same
SpeakerIDor account ID.The project should not resume the previous conversation session.
Blueprint flow:
Call Reset Conversation on the Convai Chatbot component, then call StartSession.
Expected outcome: The next connection starts from a fresh local conversation link. The player's identity remains the same, so character-level long-term memory can continue to accumulate for that user.
Remove a test identity
During development, remove test identities created by repeated Speaker ID experiments.
Blueprint flow:
Call Convai List Speaker IDs.
Find the test
SpeakerID.Call Convai Delete Speaker ID with that value.
Clear the local saved
SpeakerID.
Expected outcome: The test SpeakerID is removed from Convai and the local saved identity is cleared.
Next steps
End-user identitySpeaker ID managementTroubleshoot long-term memoryLTM Blueprint referenceLast updated
Was this helpful?