Conversation state

By default the agent server encrypts a conversation's state and stores the ciphertext in Search2o Cloud. With these three hooks, your own code stores the state instead, and it never leaves your organization. Set all three, or none.

HookWhen it is calledThe dict holds
saveSave conversation stateWhen a run ends successfully or pauses on an ask, in place of storing the state in the cloud.convid, state, the state as a JSON string, userEmail, agentName and isValidation.
restoreRestore conversation stateWhen a follow-up continues the conversation, and when the UI opens a past conversation. It returns the string that save stored, or None when there is none, which ends the conversation as expired.convid, userEmail and isValidation.
deleteConversationDelete conversation stateWhen a user deletes the conversation.convid and isValidation.

Storing the state yourself has three consequences. The agent server passes save the state in plain form; encrypt it before storing it if you need to. Search2o Cloud does not check who continues a conversation whose state your code holds; restore receives userEmail so that your code can. Expiring stored state is the responsibility of your code: the agent server calls deleteConversation when a user deletes a conversation, and nothing else.

The cloud still keeps the conversation's entry, with the encrypted title and the time of the last run, under the 7-day retention, so an unpinned conversation leaves the conversation list after 7 days. The paid service has no such limit. Validation runs keep their state in the cloud whatever the hooks. See Conversation state.