langgraph-checkpoint-hana
LangGraph checkpoint saver for SAP HANA Cloud — persist AI agent state where your enterprise data already lives.
This package implements the LangGraph BaseCheckpointSaver interface for SAP HANA Cloud, enabling conversation memory, human-in-the-loop workflows, time travel, and fault recovery for LangGraph agents running on SAP BTP.
Why HANA?
LangGraph provides official checkpointers for PostgreSQL, SQLite, and Redis. But if your enterprise runs on SAP, your business data is in HANA — and your AI agents should persist their state there too.
Benefits of keeping agent state in HANA Cloud:
- Co-located with business data — agent state lives alongside financial documents, master data, and transactional records. One database to manage, back up, and secure.
- Enterprise-grade security — leverage HANA's native audit logging, role-based access control, and encryption at rest.
- BTP-native deployment — deploy LangGraph agents on SAP BTP (Kyma / Cloud Foundry) with HANA Cloud as the persistence layer. No external database dependencies.
- Unified querying — join agent decision traces with business data using standard SQL.
Installation
pip install langgraph-checkpoint-hana
Requirements:
- Python 3.10+
- SAP HANA Cloud instance (or HANA on-premise 2.0 SPS 05+)
hdbclidriver (installed automatically)
Quick Start
from langgraph_checkpoint_hana import HANASaver
from langgraph.graph import StateGraph, MessagesState, START, END
# Create checkpointer from connection parameters
with HANASaver.from_conn_info(
address="your-instance.hanacloud.ondemand.com",
port=443,
user="DBADMIN",
password="your-password",
) as checkpointer:
# Build your graph
workflow = StateGraph(MessagesState)
workflow.add_node("chatbot", chatbot_node)
workflow.add_edge(START, "chatbot")
workflow.add_edge("chatbot", END)
# Compile with HANA persistence
graph = workflow.compile(checkpointer=checkpointer)
# Invoke — state is automatically persisted to HANA
config = {"configurable": {"thread_id": "user-session-42"}}
result = graph.invoke(
{"messages": [("human", "What's our AP aging?")]},
config,
)
# State survives restarts — resume anytime
state = graph.get_state(config)
Usage with Environment Variables
Convenient for containerised deployments on Kyma or Cloud Foundry:
import os
os.environ["HANA_HOST"] = "your-instance.hanacloud.ondemand.com"
os.environ["HANA_PORT"] = "443"
os.environ["HANA_USER"] = "DBADMIN"
os.environ["HANA_PASSWORD"] = "your-password"
checkpointer = HANASaver.from_env()
checkpointer.setup()
Usage with Existing Connection
If you already manage HANA connections in your application (e.g. via a connection pool or SAP CAP service bindings):
from hdbcli import dbapi
from langgraph_checkpoint_hana import HANASaver
conn = dbapi.connect(address="...", port=443, user="...", password="...")
checkpointer = HANASaver(conn=conn)
checkpointer.setup() # creates tables if needed
# Use with your graph
graph = workflow.compile(checkpointer=checkpointer)
Tables Created
HANASaver.setup() creates two tables (if they don't already exist):
| Table | Purpose |
|---|---|
LANGGRAPH_CHECKPOINTS |
Stores graph state snapshots (one row per checkpoint) |
LANGGRAPH_CHECKPOINT_WRITES |
Stores pending writes for fault recovery |
Both tables use NCLOB columns for serialised data and are keyed by (thread_id, checkpoint_ns, checkpoint_id).
Thread Management
# Delete all state for a thread (cleanup, GDPR, error recovery)
checkpointer.delete_thread("user-session-42")
# List checkpoint history
for cp in checkpointer.list(config, limit=10):
print(cp.checkpoint["id"], cp.metadata)
# Time travel — get a specific checkpoint
historical_config = {
"configurable": {
"thread_id": "user-session-42",
"checkpoint_id": "1ef4f797-8335-6428-8001-8a1503f9b875",
}
}
past_state = graph.get_state(historical_config)
Async Support
The hdbcli driver is synchronous. Async methods (aget_tuple, alist, aput, aput_writes, adelete_thread) delegate to their sync counterparts. For high-concurrency async deployments, consider wrapping calls with asyncio.to_thread().
Development
git clone https://github.com/stubborncoder/langgraph-checkpoint-hana.git
cd langgraph-checkpoint-hana
pip install -e ".[dev]"
pytest
Compatibility
| Component | Tested Versions |
|---|---|
| LangGraph | 0.2.x, 0.3.x |
langgraph-checkpoint |
2.x |
| SAP HANA Cloud | 2024.x, 2025.x |
| Python | 3.10, 3.11, 3.12 |
License
MIT
Contributing
Contributions welcome. Please open an issue to discuss before submitting a PR.
Metadata
Release files for langgraph-checkpoint-hana 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| langgraph_checkpoint_hana-0.1.0.tar.gz | 16.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langgraph_checkpoint_hana-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.0 kB
Release files / langgraph_checkpoint_hana-0.1.0.tar.gz
| Download URL | langgraph_checkpoint_hana-0.1.0.tar.gz |
|---|---|
| Size | 16.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
85b21d37a84ce56ced714843f1d9b93c1d2bb6fe67cb6b238634ac576f2df1eb
|
|
BLAKE2b-256 checksum How to use checksums |
2b02c8d2be03ae9f53230b0e3c639f02a7a44e6efbf53c0c0a819fa5aedf534d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.4
|
Release files / langgraph_checkpoint_hana-0.1.0-py3-none-any.whl
| Download URL | langgraph_checkpoint_hana-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c3a29cf7a079a03d0f54ccafab354d6a55f0778543db8f9dbea3fc9636e7b04c
|
|
BLAKE2b-256 checksum How to use checksums |
f91dbee56d4e1ba5b5e956f7057ba6f1771cc0d50998d240e8df2fd04374f0ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.4
|
Security for langgraph-checkpoint-hana 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.