Skip to main content

LangGraph Oracle Persistence (Checkpoint + Store)

PyPI - Version PyPI - Downloads License

⭐ If this package is useful to you, consider starring the repository — it helps other developers discover these integrations.

Oracle-backed implementations for:

  • Checkpoints: OracleSaver (sync) and AsyncOracleSaver (async)
  • Key/Value Store with optional vector search: OracleStore (sync) and AsyncOracleStore (async)

Supports:

  • Oracle Database for AI Vector Search
  • Python 3.10+ and oracledb driver

Quickstart

Checkpoints (Async)

import os
import asyncio
from dotenv import load_dotenv
from langgraph_oracledb.checkpoint.oracle import AsyncOracleSaver

load_dotenv()

async def main():
    conn_string = f"{os.environ['ORACLE_USERNAME']}/{os.environ['ORACLE_PASSWORD']}@{os.environ['ORACLE_DSN']}"
    async with AsyncOracleSaver.from_conn_string(conn_string) as checkpointer:
        await checkpointer.setup()  # Create tables & apply migrations once

        # Then pass to your graph compile (example)
        # graph = app.compile(checkpointer=checkpointer)
        # await graph.ainvoke(...)

if __name__ == "__main__":
    asyncio.run(main())

Sync variant:

from langgraph_oracledb.checkpoint.oracle import OracleSaver

conn_string = "user/password@localhost:1521/FREEPDB1"
with OracleSaver.from_conn_string(conn_string) as checkpointer:
    checkpointer.setup()
    # graph = app.compile(checkpointer=checkpointer)
    # graph.invoke(...)

Store (Async, basic key/value)

import asyncio
from langgraph_oracledb.store.oracle import AsyncOracleStore

async def main():
    conn_string = "user/password@localhost:1521/FREEPDB1"
    async with AsyncOracleStore.from_conn_string(conn_string) as store:
        await store.setup()  # Create tables & apply migrations once

        ns = ("readme", "example")
        await store.aput(ns, "doc1", {"text": "hello"})
        item = await store.aget(ns, "doc1")
        print(item.value)  # {"text": "hello"}

        # Non-vector search (lists items by namespace)
        results = await store.asearch(ns, limit=10)
        print(len(results) >= 1)

if __name__ == "__main__":
    asyncio.run(main())

Sync variant:

from langgraph_oracledb.store.oracle import OracleStore

conn_string = "user/password@localhost:1521/FREEPDB1"
with OracleStore.from_conn_string(conn_string) as store:
    store.setup()
    ns = ("readme", "example")
    store.put(ns, "doc1", {"text": "hello"})
    item = store.get(ns, "doc1")
    print(item.value)
    results = store.search(ns, limit=10)

Vector Search (optional)

Vector search is enabled by passing an index configuration with:

  • dims: embedding dimension
  • embed: a LangChain Embeddings implementation (e.g., OpenAI, HF, or your own)
  • optional fields: which JSON fields to embed (default: whole document)
  • optional index_type: HNSW/IVF and parameters

Example (async):

# Pseudo-embeddings for illustration; use any LangChain Embeddings implementation
from langchain_core.embeddings import Embeddings
from langgraph_oracledb.store.oracle import AsyncOracleStore

class FakeEmbeddings(Embeddings):
    def embed_documents(self, texts): return [[0.0]*8 for _ in texts]
    def embed_query(self, text): return [0.0]*8

async with AsyncOracleStore.from_conn_string(
    "user/password@localhost:1521/FREEPDB1",
    index={
        "dims": 8,
        "embed": FakeEmbeddings(),
        "fields": ["text"],  # embed only the 'text' field
        "index_type": {"type": "hnsw", "neighbors": 16, "efconstruction": 200, "distance_metric": "COSINE"},
    },
) as store:
    await store.setup()
    ns = ("docs",)
    await store.aput(ns, "a", {"text": "alpha"})
    await store.aput(ns, "b", {"text": "beta"})
    results = await store.asearch(ns, query="alphabet", limit=2)

Notes:

  • Call setup() once per database/schema to create/upgrade tables.
  • Vector search requires Oracle 23c/23ai+ with AI Vector Search enabled.

Testing the Examples

The repository's tests will skip automatically if an Oracle instance is not reachable.

  • Place your Oracle credentials in .env (see Configuration)
  • Run: pytest -q

This repository includes tests that validate the examples above:

  • Async checkpoint setup works
  • Async store put/get/search works

Metadata

Release files for langgraph-oracledb 1.0.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 langgraph-oracledb 1.0.2
File Size Uploaded
langgraph_oracledb-1.0.2.tar.gz 40.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langgraph-oracledb 1.0.2
File Interpreter ABI Platform
langgraph_oracledb-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 86.1 kB

Release files / langgraph_oracledb-1.0.2.tar.gz

Download URL langgraph_oracledb-1.0.2.tar.gz
Size 40.9 kB
Tags Source
SHA-256 checksum
How to use checksums
99b6b610b217cd162fd20b221704c7ab43ee700eef43523af378b4a02d278b4d
BLAKE2b-256 checksum
How to use checksums
a138da2fd16480c3ef072faaa76538293fc8fb6f4936c9215e6b3c7f04dd3ed0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release files / langgraph_oracledb-1.0.2-py3-none-any.whl

Download URL langgraph_oracledb-1.0.2-py3-none-any.whl
Size 45.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
687c88d034fa0a394779c80cce6dc02042a80916411bfe8ab6c3b03c88a04d80
BLAKE2b-256 checksum
How to use checksums
3876d5096078d1689f244ff719d9936471d072e2c866015e09fac2ab1e5f6f21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

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