Long-term key-value memory that outlives a single thread.
Checkpoints persist one conversation; a store persists knowledge
across conversations — user preferences, learned facts, past
decisions. Entries live under a hierarchical namespace (a list of
strings, e.g. ["memories", user_id]) with a string key.
Attaching a store to a graph
graph = Graph.compile(builder, store: LangEx.Store.ETS)
# or with backend config:
graph = Graph.compile(builder, store: {LangEx.Store.Postgres, repo: MyApp.Repo})Inside node functions and tools the attached store is reachable through the convenience API, no plumbing required:
Graph.add_node(:remember, fn state ->
:ok = LangEx.Store.put(["memories", state.user_id], "diet", "vegan")
%{}
end)Tool functions receive it as request.store in wrap_tool_call
interceptors and via the same convenience API.
Built-in backends
LangEx.Store.ETS— in-memory, per-VM (development / tests)LangEx.Store.Postgres— durable, via Ecto (seeLangEx.Migration)
Summary
Callbacks
Deletes a value.
Fetches a value.
Writes a value (upsert).
Lists {key, value} pairs in a namespace.
Functions
Returns the {module, config} store attached to the running graph,
or nil when none is configured.
Deletes a value from the store attached to the running graph.
Fetches a value from the store attached to the running graph.
Writes a value to the store attached to the running graph.
Searches the store attached to the running graph.
Types
Callbacks
Deletes a value.
Fetches a value.
Writes a value (upsert).
Lists {key, value} pairs in a namespace.
Options:
:prefix- key prefix filter (default""):limit- maximum entries returned (default100):query- natural-language query for semantic ranking. When the backend has an embedder configured (seeLangEx.Store.ETS), results are ordered by cosine similarity (highest first) instead of by key; backends without an embedder ignore it and fall back to prefix order.
Functions
Returns the {module, config} store attached to the running graph,
or nil when none is configured.
Deletes a value from the store attached to the running graph.
Fetches a value from the store attached to the running graph.
Writes a value to the store attached to the running graph.
Searches the store attached to the running graph.