How do I handle state between conversations?

I’m building a life coaching app and I need for the state to be maintained between sessions so that there’s a feel of continuity.

Hey Ayusch,

The Runtime should maintain session state automatically. For persistence across sessions:

// Save state
const sessionData = await runtime.getSessionState();
await yourDB.save(userId, sessionData);

// Restore state
const sessionData = await yourDB.load(userId);
await runtime.loadSessionState(sessionData);

State includes conversation history, knowledge context, and custom variables.

Let us know if this isn’t the case for you.