yb-rag-langchain

Installation
SKILL.md

YugabyteDB + LangChain — Agent Guide

Use PGVectorStore (the v2 integration) for new RAG and hybrid-search applications. PGVector is the older integration. The examples below target langchain-postgres 0.0.17; check the installed release before relying on filtering or hybrid-search behavior.

Connection & dependencies

  • For new deployments, use a supported YugabyteDB release with the required pgvector features; 2025.2 or later is the baseline for these examples. On an older release (2.20, 2.23, 2024.x), stop and advise an upgrade before debugging vector-index behavior: ybhnsw is either unavailable or subject to limitations fixed in later releases. Check the pgvector support and limitations for the deployed version before upgrading or troubleshooting an existing cluster.
  • YSQL normally listens on 5433. Use the actual configured endpoint.
  • langchain-postgres declares upstream psycopg[binary] as a dependency; use postgresql+psycopg:// in SQLAlchemy URLs.
  • Check for the smart driver before installing RAG dependencies. Keep psycopg-yugabytedb separate from upstream psycopg, psycopg-binary, and psycopg-c. If present, preserve the working environment and surface the choice: isolate RAG in another environment/process, or explicitly migrate the shared workload to upstream psycopg. Before migrating, fetch the fork’s options and restrictions and upstream libpq options: remove or translate every fork-only setting and alias in connection strings and keyword arguments. Package replacement alone is not a migration.
  • PGVectorStore requires a PGEngine, not a raw connection string. The following is a local-development example; configure credentials and TLS for deployment.
from langchain_postgres import PGEngine, PGVectorStore

engine = PGEngine.from_connection_string(
    "postgresql+psycopg://yugabyte:yugabyte@localhost:5433/yugabyte"
)
Installs
28
GitHub Stars
10
First Seen
Jun 11, 2026