Run With History
This guide shows how to run agents with long-term memory by using sessions. This works on the server-side only.
In your server-side Scoopika initialization, you can pass a remote store ID that you can create here to have persistent memory and chat sessions, otherwise Scoopika will use an in-memory store (not persistent).
All data in remote memory stores is encrypted and never accessed by our team!
Create session
Let’s create a new session, in this case We’ll create a session for a user with the ID “SCOOP” so we can then list SCOOP’s sessions. You can use this approach to create sessions for specific users in your app based on their IDs.
Run agent
Now we can pass that session’s id to each agent run to save the run to that session, example:
Notice that we passed the session_id
as the session’s ID we previously created, so now we can run the agent again and it will remember was we said earlier:
Get session messages
Now we can check that session’s messages (history, it contains the user request and agent response):
List user sessions
and we can list SCOOP’s sessions, and it will return the IDs of sessions that SCOOP owns:
Delete session
You can also delete a session if you want to:
See how easy and simple that is, history is managed for you, you just pass sessions IDs to runs!
Was this page helpful?