new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

LangChain · LangGraph · all subjects

memory/store-access

13 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Stores persist application-defined data outside graph state

Stores persist application-defined data outside the graph state and are used for long-term, cross-thread memory. Use cases include user preferences, facts, and shared knowledge.

Store.search retrieves memories from a namespace

Use the store.search method to read memories from a namespace, which returns memories as a list up to the limit argument (default 10). With InMemoryStore, items are returned in insertion order (most recent last); other backends may order differently. PostgresStore and AsyncPostgresStore return results ordered by updated_at descending (most recently updated first).

Item object attributes in store results

Each memory returned from store.search is an Item object with attributes: value (the dictionary value), key (unique key), namespace (tuple of strings), created_at (creation timestamp), and updated_at (last update timestamp). Items can be converted to dictionaries with .dict() in Python.

Namespace prefix matching behavior

Namespace matching uses prefix matching, not exact matching. Calling store.search with namespace_prefix ('alice',) returns items under ('alice',), ('alice', 'memories'), ('alice', 'preferences'), and all other sub-namespaces. To restrict to a single level, pass the full namespace or filter returned items client-side on item.namespace.

Store search results limit and pagination

Results past the limit argument are silently truncated with no overflow signal. Set limit above expected maximum or paginate using the offset parameter. To discover namespaces that exist, use store.list_namespaces or store.alist_namespaces.

Access store and user_id from any node using Runtime

Access the store and context from any node by adding a Runtime parameter to the node function. LangGraph automatically injects the Runtime object. Use runtime.context.user_id to get the user ID and runtime.store to access the store for saving or searching memories.

Save memory from a node using runtime.store.aput

From a node, save memories using: await runtime.store.aput(namespace, memory_id, {'memory': memory}). This stores or overwrites a single item in the namespace with the given key.

Custom encryption for Store API value field

Added custom encryption for the Store API value field, allowing users to choose which keys to encrypt for enhanced security.

Store and checkpointer access via config in JS graph factories

Added support for accessing store and checkpointer via config in JS graph factories to facilitate deep agent initialization.

Support for ttl, index, and refresh_ttl in store HTTP API

Added support for ttl, index, and refresh_ttl parameters in store HTTP API endpoints to align with the SDK and in-process store interface.

Store put operation without AsyncBatchedStore fix

Agent server v0.5.26 resolved issues with store.put when used without AsyncBatchedStore in the JavaScript environment.

Access store through Runtime object in nodes

The recommended way to access the store inside node functions is through the Runtime object injected by LangGraph. Use runtime.store.search(), runtime.store.asearch(), runtime.store.put(), and runtime.store.aput() to query and store memories.

Store put and search methods

Store methods include: store.put(namespace, key, value) or store.aput() for storing items; store.search(namespace, query=text, limit=n) or store.asearch() for semantic search. Namespace is a tuple or list of strings identifying the storage location.

Give your agent this brain