memory
Long-term memory trait ports.
Defines the interface for cross-conversation semantic memory backends
(e.g. Qdrant + embeddings). This module contains only trait definitions
and types — implementations live in agent_memory_store.
WASM-compatible: no async runtime dependencies.
Type Aliases
Section titled “Type Aliases”MemoryFuture
Section titled “MemoryFuture”type MemoryFuture = Pin<Box<dyn Future + Send>>;Boxed future type for native (requires Send).
Traits
Section titled “Traits”LongTermMemory
Section titled “LongTermMemory”Trait port for long-term memory backends.
Implementations handle embedding, storage, and semantic retrieval. The trait is object-safe and WASM-compatible.
Implementations
Section titled “Implementations”agent_memory_store::QdrantMemoryStore— Qdrant + embedding_provider_lib- In-memory store for testing
Required / Provided Methods
fn store(&self, entry: MemoryEntry) -> MemoryFuture<()>Store a memory entry (embedding + indexing happens internally).
fn recall(&self, query: &str, top_k: usize, filters: MemoryFilters) -> MemoryFuture<Vec<MemoryEntry>>Recall relevant memories by semantic similarity to a query.
Returns up to top_k entries sorted by relevance (highest first).
fn forget(&self, filters: MemoryFilters) -> MemoryFuture<u64>Delete memories matching the given filters.
Returns the number of entries deleted.
Structs
Section titled “Structs”MemoryEntry
Section titled “MemoryEntry”A single memory entry stored in the long-term memory backend.
Fields
| Field | Type | Description |
|---|---|---|
id | String | Unique ID for this memory entry. |
agent_id | String | Agent that created this memory. |
user_id | Option<String> | User this memory belongs to (for multi-tenant isolation). |
conversation_id | Option<String> | Conversation this memory was extracted from. |
content | String | The text content to embed and store. |
memory_type | MemoryType | Classification of this memory. |
timestamp | u64 | Unix timestamp (seconds) when this memory was created. |
score | f32 | Relevance score (set during retrieval, 0.0 to 1.0). |
metadata | HashMap<String, serde_json::Value> | Arbitrary metadata (e.g. source turn number, tags). |
MemoryFilters
Section titled “MemoryFilters”Filters for memory retrieval.
Fields
| Field | Type | Description |
|---|---|---|
agent_id | Option<String> | Filter by agent ID. |
user_id | Option<String> | Filter by user ID. |
conversation_id | Option<String> | Filter by conversation ID. |
memory_types | Vec<MemoryType> | Filter by memory type(s). |
after_timestamp | Option<u64> | Only return memories newer than this timestamp (seconds). |
NoOpMemory
Section titled “NoOpMemory”No-op memory backend (used when long-term memory is disabled).
MemoryType
Section titled “MemoryType”Type of memory entry — helps with filtering and relevance scoring.
Variants
| Variant | Description |
|---|---|
Summary | Summarized conversation segment. |
Fact | Extracted factual statement (e.g. “User prefers dark mode”). |
Instruction | User instruction or preference. |
ToolResult | Compressed tool result worth remembering. |
Custom(String) | Arbitrary user-defined type. |