LangGraph checkpointers for SAP Agent Memory Service
About this project
This library provides an implementation of LangGraph's checkpoint saver backed by the SAP HANA Agent Memory Service. Use it when you want LangGraph state persistence backed by SAP Agent Memory Service for durable, long-running workflows and agents.
Supports conversation continuity, crash recovery, human-in-the-loop (HITL) pause/resume, and full state history — with no database to manage.
Requirements and Setup
- Python ≥ 3.10
- A running instance of the SAP HANA Agent Memory Service
- Understanding of LangGraph's checkpointer concepts
Installation
pip install langgraph-checkpoint-sap-agent-memory # Using pip
uv add langgraph-checkpoint-sap-agent-memory # Using uv
Quick start
Basic setup
Use HanaAgentMemorySaver() with automatic credential detection:
from langgraph.checkpoint.sap.agent_memory import HanaAgentMemorySaver
saver = HanaAgentMemorySaver()
graph = builder.compile(checkpointer=saver)
# First run — checkpoints are saved automatically at each node boundary
result = await graph.ainvoke(
{"messages": [HumanMessage("Plan my trip to Paris")]},
config={"configurable": {"thread_id": "trip-001"}},
)
# Resume after a crash — same thread_id restores the latest checkpoint
result = await graph.ainvoke(
None,
config={"configurable": {"thread_id": "trip-001"}},
)
HanaAgentMemorySaver() reads AGENT_MEMORY_BASE_URL, AGENT_MEMORY_TOKEN_URL,
AGENT_MEMORY_CLIENT_ID, and AGENT_MEMORY_CLIENT_SECRET automatically.
See Environment variables for details.
Custom configuration
Pass credentials directly if you prefer explicit configuration:
from langgraph.checkpoint.sap.agent_memory import HanaAgentMemorySaver
saver = HanaAgentMemorySaver(
base_url="https://<service-host>",
token_url="https://<tenant>.authentication.<region>/oauth/token",
client_id="<client-id>",
client_secret="<client-secret>",
)
graph = builder.compile(checkpointer=saver)
Common usage patterns
Crash recovery
Every node transition is saved. If the process crashes mid-run, restart with the same thread_id and LangGraph resumes from the last committed checkpoint — no special code required.
# Run 1 — crashes after node_2
graph.invoke(initial_state, config) # raises
# Run 2 — resumes from node_3, skips node_1 and node_2
graph.invoke(None, config)
Human-in-the-loop (HITL)
Use LangGraph's interrupt() to pause at a node and resume with human input. The checkpoint preserves the interrupted state across process boundaries.
from langgraph.types import interrupt, Command
def approval_node(state):
decision = interrupt({"question": "Approve this action?"})
return {"approved": decision["approved"]}
# Pause — graph.invoke raises NodeInterrupt
graph.invoke(initial_state, config)
# Resume with human input
graph.invoke(Command(resume={"approved": True}), config)
State history
# All checkpoints for a thread, newest first
for tup in graph.get_state_history(config):
print(tup.config["configurable"]["checkpoint_id"])
print(tup.metadata)
Subgraph support
Nested subgraphs work without any extra configuration. LangGraph sets checkpoint_ns automatically using a pipe-separated format ("outer_node:uuid|inner_node:uuid"), which maps directly to the snapshotScope field in the Agent Memory Service.
Configuration reference
HanaAgentMemorySaver
All four credentials are required. Each can be supplied as a constructor argument, an environment variable, or both (constructor wins).
| Parameter | Type | Environment variable | Default | Description |
|---|---|---|---|---|
base_url |
str | None |
AGENT_MEMORY_BASE_URL |
— | Agent Memory Service base URL, e.g. https://<host> |
token_url |
str | None |
AGENT_MEMORY_TOKEN_URL |
— | OAuth2 token endpoint (client_credentials grant) |
client_id |
str | None |
AGENT_MEMORY_CLIENT_ID |
— | OAuth2 client ID |
client_secret |
str | None |
AGENT_MEMORY_CLIENT_SECRET |
— | OAuth2 client secret |
timeout |
float |
— | 30.0 |
HTTP request timeout in seconds |
serde |
SerializerProtocol | None |
— | JsonPlusSerializer |
Custom serializer for checkpoint state |
Environment variables
AGENT_MEMORY_BASE_URL # Agent Memory Service base URL
AGENT_MEMORY_TOKEN_URL # OAuth2 token endpoint
AGENT_MEMORY_CLIENT_ID # OAuth2 client ID
AGENT_MEMORY_CLIENT_SECRET # OAuth2 client secret
Constructor arguments take priority over environment variables when both are supplied.
Support, Feedback, Contributing
This project is open to feature requests/suggestions, bug reports etc. via GitHub issues. Contribution and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our Contribution Guidelines.
Security / Disclosure
If you find any bug that may be a security problem, please follow our instructions at in our security policy on how to report it. Please do not create GitHub issues for security-related doubts or problems.
Code of Conduct
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone. By participating in this project, you agree to abide by its Code of Conduct at all times.
Licensing
Copyright 2026 SAP SE or an SAP affiliate company and langgraph-checkpoint-sap-agent-memory-service contributors. Please see our LICENSE for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available via the REUSE tool.
Metadata
Release files for langgraph-checkpoint-sap-agent-memory-service 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 | Actions |
|---|---|---|---|---|
| langgraph_checkpoint_sap_agent_memory_service-0.1.0.tar.gz | 181.5 kB | With provenance | Details for langgraph_checkpoint_sap_agent_memory_service-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| langgraph_checkpoint_sap_agent_memory_service-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for langgraph_checkpoint_sap_agent_memory_service-0.1.0-py3-none-any.whl |
Total release size: 204.6 kB
Release files / langgraph_checkpoint_sap_agent_memory_service-0.1.0.tar.gz
| Download URL | langgraph_checkpoint_sap_agent_memory_service-0.1.0.tar.gz |
|---|---|
| Size | 181.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7a15b86fccccaf508ba088f43c43a1abf45cb116cc4b5dcc3612f3e4f5f21999
|
|
BLAKE2b-256 checksum How to use checksums |
a238545f9f46666a2a0e13ab797dce0c4721f04b9dc972449c7a3168d6c5e9dc
|
| 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 Oct 28, 2026.
Transparency logRelease files / langgraph_checkpoint_sap_agent_memory_service-0.1.0-py3-none-any.whl
| Download URL | langgraph_checkpoint_sap_agent_memory_service-0.1.0-py3-none-any.whl |
|---|---|
| Size | 23.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c8d7a1a99281701ce77ead00cf0460f84a419b70e028ee0e321a4273f5a47994
|
|
BLAKE2b-256 checksum How to use checksums |
333cc2990678e4f86c49b5e015183360202ecd0abe649c44a0a667b831282cc2
|
| 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 Oct 28, 2026.
Transparency logSecurity for langgraph-checkpoint-sap-agent-memory-service 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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for langgraph_checkpoint_sap_agent_memory_service-0.1.0.tar.gz
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 Oct 28, 2026.
Transparency logA 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.