[PR #1457] [MERGED] feat(checkpoint-postgres): Add PostgresStore for LangGraph.js #1474

Closed
opened 2026-02-15 20:15:54 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/langgraphjs/pull/1457
Author: @abogacki
Created: 7/28/2025
Status: Merged
Merged: 7/30/2025
Merged by: @dqbd

Base: mainHead: langgraph-postgres-store


📝 Commits (10+)

📊 Changes

20 files changed (+3701 additions, -33 deletions)

View changed files

.changeset/nine-plums-teach.md (+5 -0)
📝 int-test-deps-docker-compose.yml (+1 -1)
📝 libs/checkpoint-postgres/.env.example (+7 -1)
📝 libs/checkpoint-postgres/.gitignore (+4 -0)
📝 libs/checkpoint-postgres/docker-compose.yml (+1 -1)
📝 libs/checkpoint-postgres/langchain.config.js (+2 -1)
📝 libs/checkpoint-postgres/package.json (+14 -1)
libs/checkpoint-postgres/src/store/index.ts (+652 -0)
libs/checkpoint-postgres/src/store/modules/crud-operations.ts (+103 -0)
libs/checkpoint-postgres/src/store/modules/database-core.ts (+69 -0)
libs/checkpoint-postgres/src/store/modules/query-builder.ts (+146 -0)
libs/checkpoint-postgres/src/store/modules/search-operations.ts (+491 -0)
libs/checkpoint-postgres/src/store/modules/ttl-manager.ts (+39 -0)
libs/checkpoint-postgres/src/store/modules/types.ts (+231 -0)
libs/checkpoint-postgres/src/store/modules/utils.ts (+33 -0)
libs/checkpoint-postgres/src/store/modules/vector-operations.ts (+195 -0)
libs/checkpoint-postgres/src/store/sql.ts (+13 -0)
libs/checkpoint-postgres/src/store/store-migrations.ts (+141 -0)
📝 libs/checkpoint-postgres/src/tests/checkpoints.int.test.ts (+25 -28)
libs/checkpoint-postgres/src/tests/store.int.test.ts (+1529 -0)

📄 Description

This is a copy of https://github.com/langchain-ai/langgraphjs/pull/1242 - reopened as requested by @dqbd

Implement PostgreSQL Store with Vector Search Capabilities

Overview

This PR implements a PostgreSQL-based store for LangGraph.js inspired by https://github.com/langchain-ai/langgraphjs/pull/887 and Python implementation. The implementation includes comprehensive vector similarity search, hybrid search (combining vector and text search), and TTL management for automatic data expiration.

Key Features

  • Modular architecture with specialized components for different responsibilities
  • Vector similarity search with support for multiple distance metrics (cosine, L2, inner product)
  • Hybrid search combining vector similarity and full-text search
  • Advanced filtering with rich query operators ($eq, $gt, $lt, $in, etc.)
  • Automatic TTL management with configurable expiration settings
  • Support for PostgreSQL's pgvector extension for efficient vector operations

Implementation Details

  • Split the monolithic implementation into specialized modules:
    • database-core.js: Core connection and transaction management
    • database-setup.js: Schema initialization and migration
    • crud-operations.js: Basic CRUD operations
    • search-operations.js: Advanced search capabilities
    • vector-operations.js: Vector embedding and similarity calculations
    • ttl-manager.js: Expiration and cleanup management
    • query-builder.js: SQL query construction
  • Added comprehensive TypeScript types for better developer experience
  • Implemented efficient text extraction from JSON documents using configurable field paths
  • Added extensive test coverage for all features

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/langgraphjs/pull/1457 **Author:** [@abogacki](https://github.com/abogacki) **Created:** 7/28/2025 **Status:** ✅ Merged **Merged:** 7/30/2025 **Merged by:** [@dqbd](https://github.com/dqbd) **Base:** `main` ← **Head:** `langgraph-postgres-store` --- ### 📝 Commits (10+) - [`7dcf3f2`](https://github.com/langchain-ai/langgraphjs/commit/7dcf3f2e677b12053481f74139177fbe3de42e07) Create new lib for postgres store - [`5148302`](https://github.com/langchain-ai/langgraphjs/commit/514830283bb935f8ecc9ca60cb31b29f91808487) init lock - [`00ac3ef`](https://github.com/langchain-ai/langgraphjs/commit/00ac3efd92b32e481f548117fa13b78ab79c4f59) Add postgres store - [`863fa4b`](https://github.com/langchain-ai/langgraphjs/commit/863fa4b4540d43baee9b0c937e306842721e579c) Add simple search with differentiation between vector and full text search - [`885f2cf`](https://github.com/langchain-ai/langgraphjs/commit/885f2cf83cb689f104c99b1d21e63800aa10a36c) Remove redundant file - [`9f53b3c`](https://github.com/langchain-ai/langgraphjs/commit/9f53b3c945d16c387bf957d1fd49ffd202861029) Modularize PostgresStore class - [`dc46d00`](https://github.com/langchain-ai/langgraphjs/commit/dc46d00924c2b366bf90f12c8fade8c8519ce301) Remove examples - [`265a028`](https://github.com/langchain-ai/langgraphjs/commit/265a0289b6051f7af6e008278a87d61194944a18) Adjust formatting - [`7067458`](https://github.com/langchain-ai/langgraphjs/commit/70674581b00953aae4abbdc32a0bd66de1ddd8ca) Split tests - [`e9aeaf2`](https://github.com/langchain-ai/langgraphjs/commit/e9aeaf2b40aead23d712631629b2209bf03ddd1a) Update readme ### 📊 Changes **20 files changed** (+3701 additions, -33 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/nine-plums-teach.md` (+5 -0) 📝 `int-test-deps-docker-compose.yml` (+1 -1) 📝 `libs/checkpoint-postgres/.env.example` (+7 -1) 📝 `libs/checkpoint-postgres/.gitignore` (+4 -0) 📝 `libs/checkpoint-postgres/docker-compose.yml` (+1 -1) 📝 `libs/checkpoint-postgres/langchain.config.js` (+2 -1) 📝 `libs/checkpoint-postgres/package.json` (+14 -1) ➕ `libs/checkpoint-postgres/src/store/index.ts` (+652 -0) ➕ `libs/checkpoint-postgres/src/store/modules/crud-operations.ts` (+103 -0) ➕ `libs/checkpoint-postgres/src/store/modules/database-core.ts` (+69 -0) ➕ `libs/checkpoint-postgres/src/store/modules/query-builder.ts` (+146 -0) ➕ `libs/checkpoint-postgres/src/store/modules/search-operations.ts` (+491 -0) ➕ `libs/checkpoint-postgres/src/store/modules/ttl-manager.ts` (+39 -0) ➕ `libs/checkpoint-postgres/src/store/modules/types.ts` (+231 -0) ➕ `libs/checkpoint-postgres/src/store/modules/utils.ts` (+33 -0) ➕ `libs/checkpoint-postgres/src/store/modules/vector-operations.ts` (+195 -0) ➕ `libs/checkpoint-postgres/src/store/sql.ts` (+13 -0) ➕ `libs/checkpoint-postgres/src/store/store-migrations.ts` (+141 -0) 📝 `libs/checkpoint-postgres/src/tests/checkpoints.int.test.ts` (+25 -28) ➕ `libs/checkpoint-postgres/src/tests/store.int.test.ts` (+1529 -0) </details> ### 📄 Description This is a copy of https://github.com/langchain-ai/langgraphjs/pull/1242 - reopened as requested by @dqbd # Implement PostgreSQL Store with Vector Search Capabilities ## Overview This PR implements a PostgreSQL-based store for LangGraph.js inspired by https://github.com/langchain-ai/langgraphjs/pull/887 and [Python implementation](https://github.com/langchain-ai/langgraph/tree/main/libs/checkpoint-postgres/langgraph/store/postgres). The implementation includes comprehensive vector similarity search, hybrid search (combining vector and text search), and TTL management for automatic data expiration. ## Key Features - Modular architecture with specialized components for different responsibilities - Vector similarity search with support for multiple distance metrics (cosine, L2, inner product) - Hybrid search combining vector similarity and full-text search - Advanced filtering with rich query operators ($eq, $gt, $lt, $in, etc.) - Automatic TTL management with configurable expiration settings - Support for PostgreSQL's pgvector extension for efficient vector operations ## Implementation Details - Split the monolithic implementation into specialized modules: - `database-core.js`: Core connection and transaction management - `database-setup.js`: Schema initialization and migration - `crud-operations.js`: Basic CRUD operations - `search-operations.js`: Advanced search capabilities - `vector-operations.js`: Vector embedding and similarity calculations - `ttl-manager.js`: Expiration and cleanup management - `query-builder.js`: SQL query construction - Added comprehensive TypeScript types for better developer experience - Implemented efficient text extraction from JSON documents using configurable field paths - Added extensive test coverage for all features --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 20:15:54 -05:00
yindo closed this issue 2026-02-15 20:15:54 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#1474