Add a self-hosted PostgreSQL/pgvector semantic memory backend (PgvectorMemory) #8306
Nantha kumar (Nanduu24)
started this conversation in
Feature suggestions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
Add a self-hosted, semantic
PgvectorMemorybackend toautogen-ext(autogen_ext.memory.pgvector), backed by PostgreSQL with the pgvector extension.Motivation
autogen-ext/memorytoday shipschromadb,mem0,redis, andcanvas, but none offers vector memory on a general-purpose SQL database the user already controls. Teams that run on PostgreSQL and need semantic agent memory on-premise, in air-gapped environments, or under data-residency constraints have no built-in option. pgvector is the standard way to add vector search to Postgres, so aPgvectorMemorycloses that gap and complements the existing backends.Proposed behavior
A
PgvectorMemory(Memory, Component[PgvectorMemoryConfig])that:addembeds aMemoryContent(TEXT / MARKDOWN / JSON) and stores it, with its vector, in a Postgres table (extension/table/HNSW index created on first use).queryembeds the query and returns the nearest memories by cosine distance via a pgvector HNSW index, with an optionaldistance_threshold.update_contextinjects the relevant memories as aSystemMessage, matching the other backends.clear/closebehave as expected.model_name), with an injectableembedding_functionoverride.pip install "autogen-ext[pgvector]".It follows the existing
redis/chromadbcomponent pattern (a serializableComponentconfig), and the connection pool and embedder are both injectable, which keeps it unit-testable without a live database.Willingness to contribute
Yes — I already have a complete implementation with unit tests (that run without a live DB) and I verified it end-to-end against a real PostgreSQL + pgvector instance. I'd like to contribute it; I can open the PR right away. Posting here first per the feature-suggestion process — happy to adjust the design based on feedback.
All reactions