Update Memory

Updates an existing memory by providing the memory ID and the new content or metadata. You can modify the memory content or update metadata.

Parameters

  • memory_id (str, required) — Unique identifier of the memory to update.

  • new_content (str, optional) — Updated content for the memory. If None, the existing content stays the same. Default is None.

  • metadata (dict[str, str], optional) — Updated metadata to merge with existing metadata. If None, metadata stays unchanged. Default is None.

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

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

Returns

Chunk — The updated memory chunk in GL SDK format, or None if the memory was not found or the operation failed.

Example

Expected Output

Last updated