Memory¶
The agent remembers short facts and preferences about each person from one conversation to the next. For example, "Nick wants short summaries" or "Nick looks after the Acme account". It reads them at the start of every conversation, so the person doesn't have to say them again.
How memories are made¶
- The agent saves them when the person says something lasting ("always use bullet points") or asks it to remember something. Its answer says so ("I'll remember that…"), so nothing is saved without the person seeing it.
- Your app can add them with
POST /memories, for example from a settings screen.
Each person can have up to 50 memories of up to 300 characters each. The same thing saved twice is kept once.
Never remembered
Health details, passwords and keys, and card or account numbers are refused, whoever tries to save them. A memory goes into every later conversation, so anything sensitive in it would travel everywhere.
Let people see and change them¶
People should be able to see what the agent remembers about them, and change or delete it. These routes are for building that screen. They need the memories scope.
| Route | Does |
|---|---|
GET /memories?user=… |
Everything remembered about the person, oldest first |
POST /memories |
Add one: {"user": "…", "text": "…"} |
PATCH /memories/{id} |
Change one: {"user": "…", "text": "…"} |
DELETE /memories/{id}?user=… |
Forget one |
{
"id": "mem_0c7e…",
"object": "memory",
"text": "Prefers short bullet-point answers.",
"added_by": "agent",
"conversation": "conv_93ab…",
"created_at": 1793900000,
"updated_at": 1793900000
}
added_by is agent when the agent saved it in a conversation (named in conversation), api when your app added it, and person when someone added it in Klaris. A refused memory gets 400 memory_not_kept with the reason in plain words.
headers = {"Authorization": f"Bearer {KEY}"}
mine = requests.get(f"{API}/memories", params={"user": "nick@example.com"}, headers=headers).json()["data"]
for memory in mine:
print(memory["id"], memory["text"])
requests.delete(f"{API}/memories/{mine[0]['id']}", params={"user": "nick@example.com"}, headers=headers)
Earlier conversations¶
When a person refers back ("what did we say about Acme last week?"), the agent searches their earlier conversations by words. It only ever searches that person's own conversations, and never deleted ones.
Deleting a conversation also deletes the memories the agent saved in it. See Conversations.