$npx skillfedfor your agent

langchain-postgres

An integration package connecting Postgres and LangChain

Worth itPyPI DatabaseReleased Feb 20261.6M downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — langchain_postgres-0.0.17-py3-none-any.whl
v0.0.17 · released 2026-02-17 · Python >=3.9 · 7 runtime deps: asyncpg, langchain-core, numpy, pgvector, psycopg-pool, psycopg, sqlalchemy

Yes. The package is actively maintained, has low install friction, carries no known vulnerabilities, and is licensed permissively. It fills a clear role for developers building LangChain applications that need persistent vector storage or chat history in PostgreSQL. Install it if you are already using LangChain and need a Postgres-backed vector store or session manager; skip it if you do not use LangChain or prefer a different database backend.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires a running PostgreSQL instance and either asyncpg or psycopg driver installed; Python 3.9 or later.
  • Low friction installation with a pure-Python wheel.
  • Actively maintained as of the latest release.

License · maintenance · safety

MIT (permissive) — Released under the MIT license (permissive), allowing free use, modification, and distribution with minimal restrictions.

last release 2026-02-17 (178 days)

0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,578,491 downloads/mo, #3,743 on PyPI

Verify before relying

pip install langchain-postgres

from langchain_postgres import PGEngine, PGVectorStore
from langchain_core.embeddings import DeterministicFakeEmbedding

engine = PGEngine.from_connection_string("postgresql+psycopg://user:pass@localhost/db")
embedding = DeterministicFakeEmbedding(size=768)
store = PGVectorStore.create_sync(engine=engine, table_name="docs", embedding_service=embedding)
store.add_documents([...])
results = store.similarity_search("query")
  • Performance characteristics of hybrid search compared to vector-only search in production workloads.
  • Whether the migration path from deprecated PGVector to PGVectorStore is straightforward for large existing datasets.
Same gist for agents: .md · .json

What it is and what it does

langchain-postgres bridges LangChain and PostgreSQL, providing implementations of core LangChain abstractions (vector stores, chat message history, document storage) that persist data in a Postgres database. It supports both synchronous and asynchronous workflows and offers two driver options: asyncpg and psycopg3.

The package's main components are PGVectorStore for semantic search with optional hybrid search (combining vector and keyword matching), and PostgresChatMessageHistory for persisting conversation state across sessions. Both are designed to be used directly or extended for custom applications. The package depends on sqlalchemy for ORM operations, pgvector for vector operations, and numpy for numerical work.

Use it for

  • Build a RAG (retrieval-augmented generation) application that stores document embeddings in Postgres and retrieves relevant context for LLM prompts.
  • Persist multi-turn chat conversations in a database so users can resume sessions or audit interaction history.
  • Implement hybrid search combining semantic similarity and keyword matching to improve retrieval relevance.
  • Deploy LangChain applications on cloud-hosted Postgres (AlloyDB, Cloud SQL) with simplified connection management.
  • Extend the provided abstractions to add custom metadata filtering or schema changes for domain-specific requirements.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

The package is actively maintained, has low install friction, carries no known vulnerabilities, and is licensed permissively. It fills a clear role for developers building LangChain applications that need persistent vector storage or chat history in PostgreSQL. Install it if you are already using LangChain and need a Postgres-backed vector store or session manager; skip it if you do not use LangChain or prefer a different database backend.

Install

langchain-postgres on PyPI

Before you install

Low friction installation with a pure-Python wheel. Actively maintained as of the latest release. Requires PostgreSQL and one of two supported drivers (asyncpg or psycopg3), which are listed as runtime dependencies.

Requires a running PostgreSQL instance and either asyncpg or psycopg driver installed; Python 3.9 or later.

License in practice

Released under the MIT license (permissive), allowing free use, modification, and distribution with minimal restrictions.

Quickstart

pip install langchain-postgres

from langchain_postgres import PGEngine, PGVectorStore
from langchain_core.embeddings import DeterministicFakeEmbedding

engine = PGEngine.from_connection_string("postgresql+psycopg://user:pass@localhost/db")
embedding = DeterministicFakeEmbedding(size=768)
store = PGVectorStore.create_sync(engine=engine, table_name="docs", embedding_service=embedding)
store.add_documents([...])
results = store.similarity_search("query")

Verify before relying

  • Performance characteristics of hybrid search compared to vector-only search in production workloads.
  • Whether the migration path from deprecated PGVector to PGVectorStore is straightforward for large existing datasets.

Package facts

LicenseMIT permissive
Python supportSupports the current Python release >=3.9
Install frictionLow. Pure-Python wheel
Runtime dependencies
7 packages
asyncpglangchain-corenumpypgvectorpsycopg-poolpsycopgsqlalchemy
MaintenanceActively maintained 178 days since the last release
First released
Downloads1,578,491 / month, #3,743 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14

Evidence: langchain_postgres-0.0.17-py3-none-any.whl

Tags

Capabilities
langchain postgres integrationvector store postgresqlchat history persistence postgrespgvectorstore embeddingslangchain database backend
Topics
langchain-integrationvector-databaserag

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “langchain postgres integration”

Give your agent the search over MCP, or paste the wish link into any chat.

More Database packages

psycopg2-binary Worth it
PyPI · Software Development · released Apr 2026

psycopg2-binary is a PostgreSQL database adapter for Python that implements the DB API 2.0 specification, enabling Python applications to connect to and query PostgreSQL databases with thread-safe concurrent operations.

copyleftcompiled wheel · 3.9+
271.6Mdownloads / mo
redis Worth it
PyPI · Database · released Jul 2026

Python client library for connecting to and executing commands against Redis key-value stores, supporting both synchronous and asynchronous operations.

Install it if your application needs to interact with Redis; the only prerequisite is a running Redis server instance.

MITpure Python · 3.10+
268.3Mdownloads / mo
ydb Worth it
PyPI · Database · released Jul 2026

YDB Python SDK is the official client library for connecting to and querying YDB databases from Python applications.

Install it if you need to connect Python applications to YDB databases.

permissive licensepure Python · 3.10+
210.0Mdownloads / mo
snowflake-connector-python Worth it
PyPI · Software Development · released Aug 2026

Connects Python applications to Snowflake data warehouses using the DB API 2.0 specification, enabling SQL queries, data transfers, and warehouse operations.

Apache-2.0compiled wheel · 3.10+
193.6Mdownloads / mo
sqlparse Worth it
PyPI · Software Development · released Aug 2026

sqlparse tokenizes SQL text into a tree of statements, clauses, and expressions, and provides functions to split scripts, format queries, and inspect parsed tokens without validating dialect or syntax.

Install it if you need to manipulate, format, or analyze SQL text programmatically.

BSD-3-Clausepure Python · 3.10+
148.9Mdownloads / mo
dbt-adapters With conditions
PyPI · Database · released Jul 2026

Provides base adapter protocols and shared functionality that database adapters use to integrate with dbt-core, handling connections, dialect translation, relation caching, and core interface management.

Apache-2.0pure Python · 3.10.0+
121.3Mdownloads / mo

See also langchain-astradb · llama-index-vector-stores-postgres · langchain-pinecone · langchain-qdrant · langchain-elasticsearch · langchain-milvus · langchain-chroma · langchain-google-vertexai · langchain-neo4j · langgraph-checkpoint-aws