List Memories

List all memories for a given identifier, optionally filtering the results by specific keywords.

Parameters

  • user_id (str, optional) — User identifier for the memory.

  • agent_id (str, optional) — Agent identifier for the memory.

  • 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.

  • keyword (str, optional) — Keyword to search for in memory content. If not defined, it will return all memories. The keyword is not case sensitive.

  • page (int, optional) — Page number for pagination. Defaults to 1.

  • page_size (int, optional) — Number of items per page. Defaults to 100.

Note: At least one of user_id or agent_id must be provided.

Returns

list[Chunk] — A list of retrieved memory chunks. Each Chunk follows the GL SDK format and includes an id, content, metadata, and score.

Example

Expected Output

Last updated