Add Memory
Add new memory items from a list of messages.
Parameters
user_id (str, required) — User identifier for the memory.
agent_id (str, required) — Agent identifier for the memory.
messages (list[Message], required) — List of messages to store in memory. Each Message follows the GL SDK format and contains a role and content.
scopes (set[MemoryScope], optional) — Specifies the target for memory management, either for a specific participant or for combined access (USER or ASSISTANT). Default is [USER].
USER: Writes and retrieves memories targeting messages from user.
ASSISTANT: Writes and retrieves memories targeting messages from assistant.
USER, ASSISTANT: Writes and retrieves memories targeting messages from both the user and assistant.
metadata (dict[str, str], optional) — Extra metadata linked to the memory, which can be used to store any supplementary details or context related to it. Default is None.
infer (boolean, optional) — Whether to infer the memories or directly store the messages. Default is True.
Returns
list[Chunk] — A list of memory chunks created. Each Chunk follows the GL SDK format and includes an id, content, metadata, and score.
Example
Expected Output
Last updated