Skip to main content

langchain-amu

LangChain integration for amu-pgvector: a VectorStore and Retriever backed by lineage-gated Analytical Memory Units on PostgreSQL + pgvector, part of a reference implementation of Lineage-Aware Memory Governance (Sangaraju & Vissa, IEEE Access, 10.1109/ACCESS.2026.3730363).

Every read runs under the store's own Postgres role, so row-level security gates LangChain retrieval exactly the same way it gates raw SQL or the MCP server — there is no separate access-control path to keep in sync.

Full project docs, the SQL schema, and benchmarks live in the main repository: https://github.com/sangaraju1988/amu-pgvector

Install

pip install langchain-amu

This depends on and reuses amu-pgvector's client. You'll also need the schema installed in Postgres — see the 60-second quickstart in the main README.

Quickstart

from amu_pgvector import AMUStore
from langchain_amu import AMUVectorStore, AMURetriever
from langchain_core.embeddings import DeterministicFakeEmbedding

store = AMUStore("postgresql://finance_agent:finance_pw@localhost:5433/amu_dev")
embedding = DeterministicFakeEmbedding(size=1536)  # swap for a real embeddings model

vectorstore = AMUVectorStore(store, embedding)
vectorstore.similarity_search("average customer income", k=5)

retriever = AMURetriever(vectorstore=vectorstore, k=5)
retriever.invoke("average customer income")

A restricted role (one never granted the sensitive column a cached result was derived from) gets nothing back from similarity_search, max_marginal_relevance_search, or the retriever — enforced by Postgres, not by this library.

What's in this package

  • AMUVectorStore(VectorStore) -- similarity_search, similarity_search_by_vector, max_marginal_relevance_search, add_texts/add_documents (with ids=[...] upsert), delete, get_by_ids. Document.metadata carries metric_name, owner_department, definition_hash, and value alongside whatever metadata the caller supplied.
  • AMURetriever(BaseRetriever) -- wraps an AMUVectorStore.

Tested against LangChain's own standard VectorStoreIntegrationTests suite; see the main repo's docs/design.md for the handful of tests that don't apply here and why (every AMU necessarily exposes governance fields in Document.metadata, which conflicts with a few of the suite's generic exact-metadata-echo assertions — content, ids, add/delete/mutate/search all genuinely work).

Release files for langchain-amu 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-amu 0.1.2
File Size Uploaded
langchain_amu-0.1.2.tar.gz 7.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-amu 0.1.2
File Interpreter ABI Platform
langchain_amu-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 13.0 kB

Release files / langchain_amu-0.1.2.tar.gz

Download URL langchain_amu-0.1.2.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
66983bcb32e8e1f9c041444454a542c92c7fb0b9cbdb993b866c74c9d91f9c92
BLAKE2b-256 checksum
How to use checksums
56327f528096ffef30262fd3b1f7bb409482524dc0ba563dddfd30a8b9e34fce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release files / langchain_amu-0.1.2-py3-none-any.whl

Download URL langchain_amu-0.1.2-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d97413073655515aa7999561053ddf30136e02503fa05f0c1f779e7222624045
BLAKE2b-256 checksum
How to use checksums
a5b464dadfca360534e9146398e9c33d68989241837e29f6ff8750883b39608b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.3

2 release files

This release

0.1.2 This release

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page