Long-term memory quick start
Set up long-term memory for an Unreal character, assign a stable player identity, and confirm recall across Play In Editor sessions.
Set up long-term memory for a working Convai character, then confirm that the character recalls the same player in a later Play In Editor session.
Prerequisites
The Convai Unreal Engine plugin version 4.0.0-beta.27 is installed and the API key is configured. See Install the Convai Unreal Engine plugin.
A level contains a
UConvaiChatbotComponenton the AI character and aUConvaiPlayerComponenton the player Actor.The chatbot component has a valid
CharacterIDfrom the Convai dashboard.
Enable memory and connect with identity
Enable LTM for the character
In a development Blueprint, add Convai Set LTM Status from the Convai|LTM category.
Set Character ID to the character ID from the Convai dashboard. Set B Enable to true. Connect On Success to a Print String node so you can confirm the request completed.
For ongoing verification, use Convai Get LTM Status with the same Character ID.
Get a stable EndUserID
Call Convai Create Speaker ID the first time a player uses your project. On On Success, save the returned SpeakerID from FConvaiSpeakerInfo in a SaveGame or account profile.
On later launches, load the saved SpeakerID instead of creating a new record. For the full create, list, and delete workflow, see Speaker ID management.
Assign identity and start the session
Before calling StartSession, assign the saved SpeakerID as EndUserID on both components:
Set
EndUserIDon the Convai Chatbot component in the Details panel or from Blueprint.Set
EndUserIDon the Convai Player component in the Details panel or from Blueprint.
The chatbot EndUserID is the value sent to Convai at connect time. Call StartSession on the chatbot component after both values are set.
Verify cross-session recall
Press Play.
Tell the character a persistent fact, such as
My name is Alex, and I inspect safety valves.Let the conversation continue long enough for the character to respond.
Stop Play In Editor.
Press Play again.
Restore the same
EndUserIDon the chatbot and player components beforeStartSession.Ask
Do you remember what I inspect?
The character should respond using the earlier fact. If it starts fresh, see Troubleshoot long-term memory.
Next steps
How long-term memory worksEnd-user identityConfigure memory for a characterLast updated
Was this helpful?