Skip to content

fix(agent-framework): give each add_memory call its own document - #1751

Open
harshitgavita-07 wants to merge 2 commits into
supermemoryai:mainfrom
harshitgavita-07:harshitgavita-07-patch-1
Open

harshitgavita-07 wants to merge 2 commits into
supermemoryai:mainfrom
harshitgavita-07:harshitgavita-07-patch-1

Conversation

@harshitgavita-07

Copy link
Copy Markdown

Problem

SupermemoryTools.add_memory in agent-framework-python passes custom_id=self._connection.custom_id (conversation_<id>) on every call.

In Supermemory a stable customId identifies one document, and re-adding under it updates that document (see the customId notes in the ingest docs). So with this tool:

  • the second add_memory call in a conversation replaces the first remembered fact instead of adding a new one, and
  • every tool-saved fact shares an id with the conversation transcript that the middleware and context provider save under the same connection.custom_id, so they overwrite each other.

supermemory_openai's add_memory does not pass a custom_id, so each fact is its own document there. This makes the agent-framework tool match.

Fix

Drop custom_id from the add_memory tool call. connection.custom_id is unchanged and still used for conversation capture.

Test

New TestAddMemoryDocumentIdentity records the arguments of two add_memory calls and asserts neither reuses connection.custom_id. It fails on main and passes with this change. Full package suite: 59 passed (58 existing plus the new one).

I did not run this against the live API. The overwrite behavior comes from the documented customId semantics, not from a live reproduction.

Clarified memory handling by removing custom_id in memory addition.
…ument id

Add tests to ensure unique document IDs for memory entries.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant