Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

PyDebeziumAI

Real-time CDC Integration for LangChain & LangGraph using Debezium

Documentation Status CI Python 3.10+ License: Apache 2.0

PyDebeziumAI bridges Debezium CDC streams with LangChain and LangGraph, keeping your vector store automatically in sync with relational database changes — in real time.

Documentation: Complete user guides, tutorials, and API reference are available at debezium-ai-python.readthedocs.io.

Environment & Prerequisites

PyDebeziumAI requires Java 17+ for running the embedded Debezium JVM engine. Set your JAVA_HOME environment variable for your operating system:

# Linux
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64

# macOS
export JAVA_HOME=$(/usr/libexec/java_home -v17)

# Windows (PowerShell / Command Prompt)
set JAVA_HOME=C:\Program Files\Java\jdk-17

Download Debezium engine dependencies using the cross-platform setup script:

python tools/setup_jars.py

Why PyDebeziumAI?

Most RAG pipelines go stale because they rely on periodic batch reloads. PyDebeziumAI uses Debezium's Change Data Capture to push every INSERT, UPDATE, and DELETE into your vector store the moment it happens.

PostgreSQL ──► Debezium CDC ──► PyDebeziumAI ──► Chroma / PGVector / Milvus ──► LangChain RAG

Quick Start

# Install with Chroma + local sentence-transformers embeddings
pip install 'pydebeziumai[chroma,local-embeddings,debezium]'
from pydebeziumai import LiveContext

rag = LiveContext(
    debezium_config={
        "name": "my-pg-connector",
        "connector.class": "io.debezium.connector.postgresql.PostgresConnector",
        "database.hostname": "localhost",
        "database.port": "5432",
        "database.user": "postgres",
        "database.password": "postgrespassword",
        "database.dbname": "mydb",
        "database.server.name": "myserver",
        "topic.prefix": "myserver",
        "table.include.list": "public.products",
        "plugin.name": "pgoutput",
        "snapshot.mode": "initial",
    },
    vector_store="chroma",
    embedding_model="local",  # uses sentence-transformers, no API key needed
    id_strategy="table_pk",
)

# Start real-time sync in the background
rag.start()
retriever = rag.as_retriever(search_kwargs={"k": 5})

# Use it in any LangChain chain
docs = retriever.invoke("What products are available under $50?")

Offset Checkpoint Replay Behavior

On application restart, events processed since the last offset.flush.interval.ms (default 5000ms) checkpoint may be redelivered by the Debezium engine. PyDebeziumAI handles this safely because all writes are idempotent upserts keyed by primary-key document IDs.

Features

  • Real-time sync — Push-based WAL capture with low-latency delivery (typically ~280–500ms total vector indexing wall-clock time depending on embedding model & vector DB)
  • Deterministic IDs — same row always maps to same document ID (correct upsert/delete semantics)
  • Pluggable backends — Chroma, PGVector, Milvus (more coming)
  • Local embeddings — works offline with sentence-transformers, no API key needed
  • LangGraph support — reactive CDC-aware agent nodes
  • Schema evolution — additive columns and nullable changes handled gracefully
  • Retry + DLQ — exponential backoff and dead-letter queue for reliability
  • Connect mode — JPype-native SourceRecord for lower latency (no JSON round-trip)

Architecture

┌─────────────┐    ┌──────────────────┐    ┌──────────────────┐
│  Debezium   │───►│ IngestionHandler │───►│  DocumentBuilder │
│  (via       │    │  (JSON / Connect)│    │  (Projection     │
│  pydbzengine│    └──────────────────┘    │   Policy + ID)   │
└─────────────┘                            └────────┬─────────┘
                                                    │
                    ┌──────────────────┐    ┌───────▼─────────┐
                    │ LangChain /      │◄───│   SyncManager   │
                    │ LangGraph        │    │  (upsert/delete │
                    │ Retriever        │    │   + retry/DLQ)  │
                    └──────────────────┘    └───────┬─────────┘
                                                    │
                                           ┌────────▼─────────┐
                                           │  VectorStore     │
                                           │  Adapter         │
                                           │ (Chroma/PGVector │
                                           │  /Milvus)        │
                                           └──────────────────┘

Installation

Extra Description
chroma Chroma vector store backend
pgvector PostgreSQL PGVector backend
milvus Milvus vector store backend
local-embeddings sentence-transformers (no API key)
openai OpenAI embeddings
langgraph LangGraph node support
debezium pydbzengine JVM bridge
dev All dev/test dependencies

Contributing

Please see CONVENTIONS.md for coding styles, formatting, type check guidelines, and commit sign-off requirements.

License

Apache 2.0 — see LICENSE.txt

Metadata

Release files for pydebeziumai 0.1.0a1

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

Source distribution (sdist)

Source distribution for pydebeziumai 0.1.0a1
File Size Uploaded
pydebeziumai-0.1.0a1.tar.gz 78.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pydebeziumai 0.1.0a1
File Interpreter ABI Platform
pydebeziumai-0.1.0a1-py3-none-any.whl Python 3 none any Details

Total release size: 122.2 kB

Release files / pydebeziumai-0.1.0a1.tar.gz

Download URL pydebeziumai-0.1.0a1.tar.gz
Size 78.2 kB
Tags Source
SHA-256 checksum
How to use checksums
432be46c2dfd31a9134095d6cf83f23515563c58877bbe83f4bf7ad1a934b9ad
BLAKE2b-256 checksum
How to use checksums
d280b14fd9c9f9ccd1e14acc9086964856083e6419d9285c7ff2b43141042cf7
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 29, 2026.

Transparency log

Release files / pydebeziumai-0.1.0a1-py3-none-any.whl

Download URL pydebeziumai-0.1.0a1-py3-none-any.whl
Size 44.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
12f94e23f93fe27a72c98abe603caee633f7cbc5d2729ab597b4caf87c53ef6d
BLAKE2b-256 checksum
How to use checksums
8bd4b48fc25d0dadd6fd884564a9680fd884bdbcec3969d62c5ec135c12c280f
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 29, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.0

2 release files

This release

0.1.0a1 This release

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