MemoryStore
Storage backend for agent memories.
MemoryStore provides the interface for persisting and retrieving memories. Implementations can be in-memory (for testing), file-based, database-backed, or use vector databases for semantic search.
The trait follows functional principles - operations return new instances rather than mutating state.
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
Members list
Value members
Abstract methods
Clear all memories from the store.
Clear all memories from the store.
Attributes
- Returns
-
Empty store or error
Count memories matching a filter.
Count memories matching a filter.
Value parameters
- filter
-
Criteria for counting memories
Attributes
- Returns
-
Count or error
Delete a memory by its ID.
Delete a memory by its ID.
Value parameters
- id
-
The memory identifier
Attributes
- Returns
-
Updated store or error
Delete all memories matching a filter.
Delete all memories matching a filter.
Value parameters
- filter
-
Criteria for selecting memories to delete
Attributes
- Returns
-
Updated store or error
Retrieve a memory by its ID.
Retrieve a memory by its ID.
Value parameters
- id
-
The memory identifier
Attributes
- Returns
-
The memory if found, or error
Recall memories matching a filter.
Recall memories matching a filter.
This is the primary retrieval method for most use cases. Returns memories sorted by relevance (most relevant first).
Value parameters
- filter
-
Criteria for filtering memories
- limit
-
Maximum number of memories to return
Attributes
- Returns
-
Matching memories or error
Get the most recent memories.
Get the most recent memories.
Value parameters
- filter
-
Additional filter criteria
- limit
-
Maximum number of memories
Attributes
- Returns
-
Most recent memories
Semantic search for memories similar to a query.
Semantic search for memories similar to a query.
This method uses embeddings for semantic similarity search. Falls back to keyword search if embeddings are not available.
Value parameters
- filter
-
Additional filter criteria
- query
-
The search query
- topK
-
Number of results to return
Attributes
- Returns
-
Most similar memories or error
Store a new memory.
Store a new memory.
Value parameters
- memory
-
The memory to store
Attributes
- Returns
-
Updated store or error
Concrete methods
Check if a memory exists.
Check if a memory exists.
Value parameters
- id
-
The memory identifier
Attributes
- Returns
-
True if memory exists
Get conversation history.
Get conversation history.
Value parameters
- conversationId
-
The conversation identifier
- limit
-
Maximum messages to return
Attributes
- Returns
-
Conversation memories in chronological order
Get all memories for a specific entity.
Get all memories for a specific entity.
Value parameters
- entityId
-
The entity identifier
Attributes
- Returns
-
All memories related to this entity
Get high-importance memories.
Get high-importance memories.
Value parameters
- limit
-
Maximum number of memories
- threshold
-
Minimum importance score (0.0 to 1.0)
Attributes
- Returns
-
Important memories
Store multiple memories in a batch.
Store multiple memories in a batch.
Value parameters
- memories
-
The memories to store
Attributes
- Returns
-
Updated store or error