feat(agent-memory): add create_checkpointer() factory with TTL support for LangGraph agents#221
Open
santosh-nallur wants to merge 21 commits into
Open
feat(agent-memory): add create_checkpointer() factory with TTL support for LangGraph agents#221santosh-nallur wants to merge 21 commits into
santosh-nallur wants to merge 21 commits into
Conversation
…gents Adds factory/langgraph_checkpoint.py providing create_checkpointer() which returns LangGraph's InMemorySaver. The factory subpackage is structured to support future framework adapters (store, crewai) without namespace conflicts with the langgraph package itself. Persistent checkpointing backed by the Agent Memory Service is not yet supported. AGENTMAAS-410
Covers return type, ImportError on missing langgraph, and three LangGraph integration tests verifying compile, state persistence, and thread isolation. AGENTMAAS-410
…uide Adds a LangGraph Checkpointer section distinguishing the framework adapter from the core service client. Notes that the current implementation uses InMemorySaver and does not support persistence yet. AGENTMAAS-410
…create_checkpointer State loss on process exit is a relevant operational signal, not a routine info event. Message now names the function and describes the exact limitation. AGENTMAAS-410
Adds TimedInMemorySaver extending InMemorySaver with a daemon background sweep thread that evicts inactive threads based on ttl_seconds. Updates create_checkpointer(ttl_seconds=...) factory to return TimedInMemorySaver when ttl_seconds is provided, or plain InMemorySaver otherwise. TimedInMemorySaver is a temporary home in the SDK factory subpackage. It will migrate to langgraph-checkpoint-sap-agent-memory in Phase 2 — no code change required for consumers of create_checkpointer(). AGENTMAAS-410
…er guide Adds Thread TTL section to the LangGraph Checkpointer documentation covering ttl_seconds usage, TimedInMemorySaver eviction semantics, and the @agent_config decorator pattern for centralised TTL configuration. AGENTMAAS-410
… signature Removes TimedInMemorySaver and its tests. ttl_seconds is retained as a factory parameter for interface stability — TTL will be enforced by HanaAgentMemorySaver when available. InMemorySaver logs a clear warning when ttl_seconds is set explaining the current limitation. AGENTMAAS-410
The centralised TTL configuration via @agent_config is not yet available. Removed from both the factory docstring and the user guide. AGENTMAAS-410
Restores TimedInMemorySaver — InMemorySaver with background daemon sweep for production-grade TTL-based thread eviction. create_checkpointer() returns TimedInMemorySaver when ttl_seconds is set, InMemorySaver otherwise. AGENTMAAS-410
Documents ttl_seconds parameter, TimedInMemorySaver eviction semantics, and the process-exit limitation. Removes the placeholder text that said TTL has no effect. AGENTMAAS-410
NicoleMGomes
reviewed
Jul 9, 2026
NicoleMGomes
reviewed
Jul 9, 2026
Co-authored-by: Nicole Gomes <47161082+NicoleMGomes@users.noreply.github.com>
…equisites Adds langgraph>=0.2.0 to [project.optional-dependencies] so consumers can install via pip install sap-cloud-sdk[langgraph]. Updates the user guide prerequisites section to document both installation paths. AGENTMAAS-410
LangGraph 1.0 introduced the stable public API and current import paths. Pre-1.0 versions are not supported. AGENTMAAS-410
Shows how to expose ttl_seconds via agent_config decorator with key config.checkpointer.ttl_seconds for low-code UI integration. AGENTMAAS-410
Contributor
Author
|
Thanks @NicoleMGomes , @cassiofariasmachado, I realised that the new TTL field for checkpointer could be a configuration via decorators. Rather than introducing a new checkpointer specific decorator, reused the existing agent_config instead. Added an example in the user-guide.md |
cassiofariasmachado
approved these changes
Jul 10, 2026
| [project] | ||
| name = "sap-cloud-sdk" | ||
| version = "0.33.2" | ||
| version = "0.32.0" |
Member
There was a problem hiding this comment.
Please bump the version to 0.33.0
Suggested change
| version = "0.32.0" | |
| version = "0.33.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a
create_checkpointer()factory in theagent_memorymodule that returns a LangGraphBaseCheckpointSaverappropriate for the current environment. Enables LoB teams (e.g. IBD) to integrate LangGraph agent short-term memory without coupling their agent code to a specific checkpointer implementation.What ships in this PR:
src/sap_cloud_sdk/agent_memory/factory/langgraph_checkpoint.py—create_checkpointer()factory returningInMemorySaver(no TTL) orTimedInMemorySaver(with TTL)src/sap_cloud_sdk/agent_memory/factory/_timed_memory.py—TimedInMemorySaverextendingInMemorySaverwith a daemon background sweep thread for TTL-based thread evictionsrc/sap_cloud_sdk/agent_memory/factory/__init__.py— factory subpackagetests/agent_memory/unit/test_langgraph_checkpointer.py— factory unit teststests/agent_memory/unit/test_timed_memory.py—TimedInMemorySaverunit testssrc/sap_cloud_sdk/agent_memory/user-guide.md— LangGraph Checkpointer sectionusage:
TimedInMemorySaverdesign:_last_activedict updated input()/aput()ttl_secondsof inactivityttl_secondsparameter stable for Phase 2 whenHanaAgentMemorySavershipsType of Change
How to Test
Checklist
Breaking Changes
None. The
factorysubpackage is additive. No existing public API is changed.Additional Notes
TimedInMemorySaveris a temporary home in the SDK factory subpackage. It will migrate tolanggraph-checkpoint-sap-agent-memory(the separate checkpoint library in Phase 2 — no code change required for factory consumers.ttl_secondsparameter is accepted oncreate_checkpointer()regardless of which backend is active, ensuring interface stability for Phase 2.HanaAgentMemorySaverships) will detect the HANA binding at runtime and return it automatically