Skip to main content

MemoryStorage

Trait MemoryStorage 

pub trait MemoryStorage: Send + Sync {
Show 53 methods // Required methods fn create_entity<'life0, 'async_trait>( &'life0 self, entity: Entity, ) -> Pin<Box<dyn Future<Output = Result<Entity, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn create_entities<'life0, 'async_trait>( &'life0 self, entities: Vec<Entity>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Entity>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn get_entity<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Entity>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn update_entity<'life0, 'async_trait>( &'life0 self, entity: Entity, ) -> Pin<Box<dyn Future<Output = Result<Entity, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn delete_entity<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn search_entities<'life0, 'life1, 'async_trait>( &'life0 self, query: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Entity>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn create_relation<'life0, 'async_trait>( &'life0 self, relation: Relation, ) -> Pin<Box<dyn Future<Output = Result<Relation, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn create_relations<'life0, 'async_trait>( &'life0 self, relations: Vec<Relation>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Relation>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn get_relations<'life0, 'life1, 'async_trait>( &'life0 self, entity_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Relation>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn delete_relation<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, from: &'life1 str, to: &'life2 str, relation_type: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait; fn get_graph<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<KnowledgeGraph, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn add_observations<'life0, 'life1, 'async_trait>( &'life0 self, entity_name: &'life1 str, observations: Vec<String>, ) -> Pin<Box<dyn Future<Output = Result<Entity, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn semantic_search<'life0, 'life1, 'async_trait>( &'life0 self, query: &'life1 str, limit: usize, threshold: f32, ) -> Pin<Box<dyn Future<Output = Result<Vec<SemanticSearchResult>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn add_memory<'life0, 'async_trait>( &'life0 self, memory: Memory, ) -> Pin<Box<dyn Future<Output = Result<Memory, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn get_memory<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Memory>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn update_memory<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, content: String, ) -> Pin<Box<dyn Future<Output = Result<Memory, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn delete_memory<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn delete_all_memories<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, user_id: Option<&'life1 str>, agent_id: Option<&'life2 str>, session_id: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait; fn get_all_memories<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, user_id: Option<&'life1 str>, agent_id: Option<&'life2 str>, session_id: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Memory>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait; fn search_memories<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, query: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, session_id: Option<&'life4 str>, categories: Option<&'life5 [String]>, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<Memory>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, Self: 'async_trait; fn get_memory_history<'life0, 'life1, 'async_trait>( &'life0 self, memory_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryHistory>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn hybrid_search_memories<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, query: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, session_id: Option<&'life4 str>, limit: usize, vector_weight: f32, bm25_weight: f32, ) -> Pin<Box<dyn Future<Output = Result<Vec<Memory>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, Self: 'async_trait; fn compress_memories<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, user_id: Option<&'life1 str>, agent_id: Option<&'life2 str>, session_id: Option<&'life3 str>, older_than_days: u32, ) -> Pin<Box<dyn Future<Output = Result<Option<Memory>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait; fn add_memories_from_conversation<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, messages: Vec<Value>, user_id: Option<&'life1 str>, agent_id: Option<&'life2 str>, session_id: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Memory>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait; fn expire_stale_memories<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn create_task_stream<'life0, 'async_trait>( &'life0 self, stream: TaskStream, ) -> Pin<Box<dyn Future<Output = Result<TaskStream, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn get_task_stream<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<Option<TaskStream>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait; fn add_to_task_stream<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, stream_name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, memory: Memory, ) -> Pin<Box<dyn Future<Output = Result<Memory, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait; fn get_context_for_task<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, stream_name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, model_name: &'life4 str, max_tokens: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<ContextWindow, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, Self: 'async_trait; fn list_task_streams<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, agent_id: Option<&'life1 str>, user_id: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<TaskStream>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait; fn delete_task_stream<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait; fn archive_task_stream<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<TaskStream, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait; fn pause_task_stream<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<TaskStream, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait; fn add_task_step<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, stream_name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, step: TaskStep, ) -> Pin<Box<dyn Future<Output = Result<TaskStep, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait; fn update_task_step_status<'life0, 'life1, 'async_trait>( &'life0 self, idempotency_key: &'life1 str, status: TaskStepStatus, result: Option<String>, error: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<TaskStep, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn get_task_steps<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, stream_name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<TaskStep>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait; fn get_current_step<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, stream_name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<Option<TaskStep>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait; fn complete_step<'life0, 'life1, 'async_trait>( &'life0 self, idempotency_key: &'life1 str, result: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<TaskStep, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn create_mindmap<'life0, 'async_trait>( &'life0 self, mindmap: MindMap, ) -> Pin<Box<dyn Future<Output = Result<MindMap, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn get_mindmap<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<Option<MindMap>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait; fn add_mindmap_node<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, mindmap_name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, node: MindMapNode, ) -> Pin<Box<dyn Future<Output = Result<MindMap, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait; fn add_mindmap_edge<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, mindmap_name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, edge: MindMapEdge, ) -> Pin<Box<dyn Future<Output = Result<MindMap, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait; fn delete_mindmap_node<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, mindmap_name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, node_id: &'life4 str, ) -> Pin<Box<dyn Future<Output = Result<MindMap, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, Self: 'async_trait; fn list_mindmaps<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, user_id: Option<&'life1 str>, agent_id: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<MindMap>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait; fn delete_mindmap<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait; fn auto_summarize_task_stream<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, stream_name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, model_id: &'life4 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Memory>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, Self: 'async_trait; fn try_update_persona_mindmap<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, user_id: &'life1 str, memory: &'life2 Memory, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait; fn find_path<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, from: &'life1 str, to: &'life2 str, max_depth: u8, ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<String>>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait; fn expand_neighbors<'life0, 'life1, 'async_trait>( &'life0 self, entity_name: &'life1 str, depth: u8, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<KnowledgeGraph, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn get_related<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, entity_name: &'life1 str, relation_type: Option<&'life2 str>, direction: &'life3 str, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<Entity>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait; fn get_entity_history<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryHistory>, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn get_graph_at_time<'life0, 'life1, 'async_trait>( &'life0 self, before_rfc3339: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<KnowledgeGraph, Error>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn as_any(&self) -> &(dyn Any + 'static);
}
Expand description

The unified storage interface for the surreal-memory platform.

Implemented by SurrealStorage. All methods are async and return anyhow::Result<T> for ergonomic error propagation.

Required Methods§

fn create_entity<'life0, 'async_trait>( &'life0 self, entity: Entity, ) -> Pin<Box<dyn Future<Output = Result<Entity, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

fn create_entities<'life0, 'async_trait>( &'life0 self, entities: Vec<Entity>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Entity>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

fn get_entity<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Entity>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

fn update_entity<'life0, 'async_trait>( &'life0 self, entity: Entity, ) -> Pin<Box<dyn Future<Output = Result<Entity, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

fn delete_entity<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

fn search_entities<'life0, 'life1, 'async_trait>( &'life0 self, query: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Entity>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

fn create_relation<'life0, 'async_trait>( &'life0 self, relation: Relation, ) -> Pin<Box<dyn Future<Output = Result<Relation, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

fn create_relations<'life0, 'async_trait>( &'life0 self, relations: Vec<Relation>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Relation>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

fn get_relations<'life0, 'life1, 'async_trait>( &'life0 self, entity_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Relation>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

fn delete_relation<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, from: &'life1 str, to: &'life2 str, relation_type: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

fn get_graph<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<KnowledgeGraph, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

fn add_observations<'life0, 'life1, 'async_trait>( &'life0 self, entity_name: &'life1 str, observations: Vec<String>, ) -> Pin<Box<dyn Future<Output = Result<Entity, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

fn add_memory<'life0, 'async_trait>( &'life0 self, memory: Memory, ) -> Pin<Box<dyn Future<Output = Result<Memory, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

fn get_memory<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Memory>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

fn update_memory<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, content: String, ) -> Pin<Box<dyn Future<Output = Result<Memory, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

fn delete_memory<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

fn delete_all_memories<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, user_id: Option<&'life1 str>, agent_id: Option<&'life2 str>, session_id: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

fn get_all_memories<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, user_id: Option<&'life1 str>, agent_id: Option<&'life2 str>, session_id: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Memory>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

fn search_memories<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>( &'life0 self, query: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, session_id: Option<&'life4 str>, categories: Option<&'life5 [String]>, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<Memory>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, 'life5: 'async_trait, Self: 'async_trait,

fn get_memory_history<'life0, 'life1, 'async_trait>( &'life0 self, memory_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryHistory>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

fn hybrid_search_memories<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, query: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, session_id: Option<&'life4 str>, limit: usize, vector_weight: f32, bm25_weight: f32, ) -> Pin<Box<dyn Future<Output = Result<Vec<Memory>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, Self: 'async_trait,

Hybrid BM25 + HNSW vector search. Scores merged as: vector_weight * vec_score + bm25_weight * bm25_score.

fn compress_memories<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, user_id: Option<&'life1 str>, agent_id: Option<&'life2 str>, session_id: Option<&'life3 str>, older_than_days: u32, ) -> Pin<Box<dyn Future<Output = Result<Option<Memory>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

Compress memories older than older_than_days into a single summary.

fn add_memories_from_conversation<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, messages: Vec<Value>, user_id: Option<&'life1 str>, agent_id: Option<&'life2 str>, session_id: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Memory>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

Auto-extract semantic memories from raw conversation messages. messages: [{"role": "user"|"assistant", "content": "..."}]

fn expire_stale_memories<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Mark memories with valid_until < now() as expired. Returns count.

fn create_task_stream<'life0, 'async_trait>( &'life0 self, stream: TaskStream, ) -> Pin<Box<dyn Future<Output = Result<TaskStream, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

fn get_task_stream<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<Option<TaskStream>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

fn add_to_task_stream<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, stream_name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, memory: Memory, ) -> Pin<Box<dyn Future<Output = Result<Memory, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

fn get_context_for_task<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, stream_name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, model_name: &'life4 str, max_tokens: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<ContextWindow, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, Self: 'async_trait,

fn list_task_streams<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, agent_id: Option<&'life1 str>, user_id: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<TaskStream>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

fn delete_task_stream<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

fn archive_task_stream<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<TaskStream, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

fn pause_task_stream<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<TaskStream, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

Pause an active TaskStream, suspending further additions without archiving it.

fn add_task_step<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, stream_name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, step: TaskStep, ) -> Pin<Box<dyn Future<Output = Result<TaskStep, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

Add an ordered step to a stream. Idempotent on idempotency_key: if a step with that key already exists, the existing step is returned and no duplicate is created.

fn update_task_step_status<'life0, 'life1, 'async_trait>( &'life0 self, idempotency_key: &'life1 str, status: TaskStepStatus, result: Option<String>, error: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<TaskStep, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Update a step’s status, recording result/error and started/completed timestamps as appropriate. Looked up by idempotency_key.

fn get_task_steps<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, stream_name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<TaskStep>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

Return all steps of a stream ordered by ordinal.

fn get_current_step<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, stream_name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<Option<TaskStep>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

Returns the lowest-ordinal step whose status is not Completed or Skipped. A Failed or Running step is returned as current so the caller can resolve it (retry, skip, or complete) before advancing — a failed step intentionally blocks progress until resolved.

fn complete_step<'life0, 'life1, 'async_trait>( &'life0 self, idempotency_key: &'life1 str, result: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<TaskStep, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Mark a step completed. Idempotent: completing an already-completed step returns it unchanged without re-applying the result.

fn create_mindmap<'life0, 'async_trait>( &'life0 self, mindmap: MindMap, ) -> Pin<Box<dyn Future<Output = Result<MindMap, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

fn get_mindmap<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<Option<MindMap>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

fn add_mindmap_node<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, mindmap_name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, node: MindMapNode, ) -> Pin<Box<dyn Future<Output = Result<MindMap, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

fn add_mindmap_edge<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, mindmap_name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, edge: MindMapEdge, ) -> Pin<Box<dyn Future<Output = Result<MindMap, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

fn delete_mindmap_node<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, mindmap_name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, node_id: &'life4 str, ) -> Pin<Box<dyn Future<Output = Result<MindMap, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, Self: 'async_trait,

fn list_mindmaps<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, user_id: Option<&'life1 str>, agent_id: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<MindMap>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

fn delete_mindmap<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

fn auto_summarize_task_stream<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, stream_name: &'life1 str, user_id: Option<&'life2 str>, agent_id: Option<&'life3 str>, model_id: &'life4 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Memory>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, Self: 'async_trait,

Rolling auto-summarization: compress the oldest half of a TaskStream’s memories when total_tokens exceeds the model’s summarization threshold. Returns the new summary memory, or None if no action was needed.

fn try_update_persona_mindmap<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, user_id: &'life1 str, memory: &'life2 Memory, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Non-fatally update the user’s persona mindmap after a new memory is added. Errors are logged but not propagated — add_memory must remain fast.

fn find_path<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, from: &'life1 str, to: &'life2 str, max_depth: u8, ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<String>>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Find shortest paths between two entities up to max_depth hops. Returns a list of paths, where each path is a Vec of entity names.

fn expand_neighbors<'life0, 'life1, 'async_trait>( &'life0 self, entity_name: &'life1 str, depth: u8, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<KnowledgeGraph, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Return the subgraph of entities within depth hops of entity_name.

Return entities connected to entity_name by relations, optionally filtered by relation_type and/or direction (“in” | “out” | “both”).

fn get_entity_history<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<MemoryHistory>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Return the full observation-change history for an entity, ordered newest-first.

fn get_graph_at_time<'life0, 'life1, 'async_trait>( &'life0 self, before_rfc3339: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<KnowledgeGraph, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Return the knowledge graph as it existed at or before before_rfc3339. before_rfc3339 must be an RFC-3339 timestamp string (e.g. “2025-01-01T00:00:00Z”).

fn as_any(&self) -> &(dyn Any + 'static)

Downcast helper — allows MCP handlers to recover concrete types (e.g. SurrealStorage) from Arc<dyn MemoryStorage>.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

§

impl MemoryStorage for SurrealStorage