Repository navigation
Conversation
…d memory memory_store() returns DatabricksMemoryStore, a LangGraph BaseStore over the managed memory API, so LangGraph and LangMem code that takes store= gets cross-conversation memory with no Postgres connection to run. The user comes from each run's config (thread_config), so one store serves every user of an app; entries are kept under the storage actor "<actor>:langgraph", and the session and memory helpers refuse actors with that suffix. Values are kept in a small JSON envelope, with optional client-side TTL and a per-user sweep. Includes unit tests over a wire-level fake of the memory API, a gated live suite, a README section, and a migration page from DatabricksStore. Co-authored-by: Isaac <no-reply@databricks.com>
Author
|
/trigger all |
thread_config, memory_tools and the session helpers reject actors ending in ':langgraph' so automatic memory pipelines never see the LangGraph store's storage actor, but the typed session SDK still let callers create a session under that id directly. A session for <actor>:langgraph makes it discoverable to pipelines, which can rewrite the store's JSON envelopes. Apply check_actor in _add_session and _fork_session so the SDK enforces the same rule, and cover both paths with unit tests. Generated with [Devin](https://devin.ai) Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This branch has not been deployed
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.
Summary
Adds
memory_store()todatabricks_agentkit.langgraph. It returnsDatabricksMemoryStore, a LangGraphBaseStoreon Agent Bricks managed memory. LangGraph and LangMem code that takesstore=, such ascreate_agent(..., store=memory_store()), then gets memory that lasts across conversations, with no Postgres connection, schema or embedding endpoint to run.Why: AgentKit's LangGraph helpers already cover sessions (
checkpointer()) and memory tools (memory_tools()). LangGraph's own long-term memory interface isBaseStore, though, and LangMem and many LangGraph agents are written against it. On Databricks today that meansdatabricks_langchain.DatabricksStore, aPostgresStoreon a Lakebase database the team owns and operates. This PR puts the same interface on the managed memory service that AgentKit already uses.In short, the store should:
thread_config(session_id, actor)), and raises rather than mixes users when an explicitactor=and the run disagree.memory_tools, sessions and automatic memory pipeline runs by storing them under the storage actor<actor>:langgraph.Changes
langgraph/store.py(new):DatabricksMemoryStoreandmemory_store()./langgraph/<namespace>/<key>, with each segment percent-encoded. The entry holds the value in a small JSON envelope ({"lg": 1, "v": ...}, plus"x", the expiry, for TTL items) and a plain-text description.sweep_ttl(actor=...)deletes one user's expired items.InMemoryStore(MIT) and credited in the source and inNOTICE.Reserved actor suffix (
_actors.py, new): these now refuse actor ids ending in:langgraph, so no session or memory-tools actor can reach another user's store entries:thread_config;memory_tools;session_storeandmemory_tools.This is a behaviour change for any existing caller whose actor or session id ends with that suffix. Other ids, including non-string ones, pass through unchanged.
Docs:
docs/migrate-from-databricks-store.md.Tests:
tests/suites/test_langgraph_store.py, run withRUN_LANGGRAPH_STORE_TESTS=1.It lives in
databricks_agentkit.langgraph, next tocheckpointer()andmemory_tools(), because it's built on AgentKit's memory client, anddatabricks-langchaindoesn't depend ondatabricks-agentbricks.DatabricksStoreis unchanged, for teams that want their own Postgres and embeddings.Known limitations
putis last-writer-wins, and overwriting an existing key takes three API calls.<actor>:langgraph. That relies on current pipeline behaviour and isn't tested here against a live pipeline.agent-langgraphtemplate takesinput.actorfrom the request body, and the README says not to add the store until the actor comes from the forwarded identity.MemoryStore._put_memorydoesn't retry an update that hits NOT_FOUND. A strict xfail marks it.Testing
langgraphextra, as in CI's 3.10 unit job.ty checkreports only the existingmodel_upgrades/optimization.pydiagnostic.ReflectionExecutorran against a live store.Requesting review from @nihit, @qinxinw-db, @elainewang-db and @junchoi-db.
This pull request and its description were written by Isaac.