pub trait ContextManager: Send + Sync {
// Required methods
fn store_context<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
context: AgentContext,
) -> Pin<Box<dyn Future<Output = Result<ContextId, ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn retrieve_context<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
session_id: Option<SessionId>,
) -> Pin<Box<dyn Future<Output = Result<Option<AgentContext>, ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn query_context<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
query: ContextQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<ContextItem>, ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn update_memory<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
memory_updates: Vec<MemoryUpdate>,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn add_knowledge<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
knowledge: Knowledge,
) -> Pin<Box<dyn Future<Output = Result<KnowledgeId, ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn search_knowledge<'life0, 'life1, 'async_trait>(
&'life0 self,
agent_id: AgentId,
query: &'life1 str,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<KnowledgeItem>, ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn share_knowledge<'life0, 'async_trait>(
&'life0 self,
from_agent: AgentId,
to_agent: AgentId,
knowledge_id: KnowledgeId,
access_level: AccessLevel,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_shared_knowledge<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
) -> Pin<Box<dyn Future<Output = Result<Vec<SharedKnowledgeRef>, ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn archive_context<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
before: SystemTime,
) -> Pin<Box<dyn Future<Output = Result<u32, ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_context_stats<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
) -> Pin<Box<dyn Future<Output = Result<ContextStats, ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Context Manager trait for agent memory and knowledge management
Required Methods§
Sourcefn store_context<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
context: AgentContext,
) -> Pin<Box<dyn Future<Output = Result<ContextId, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn store_context<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
context: AgentContext,
) -> Pin<Box<dyn Future<Output = Result<ContextId, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Store agent context
Sourcefn retrieve_context<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
session_id: Option<SessionId>,
) -> Pin<Box<dyn Future<Output = Result<Option<AgentContext>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn retrieve_context<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
session_id: Option<SessionId>,
) -> Pin<Box<dyn Future<Output = Result<Option<AgentContext>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieve agent context
Sourcefn query_context<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
query: ContextQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<ContextItem>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn query_context<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
query: ContextQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<ContextItem>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Query context with semantic search
Sourcefn update_memory<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
memory_updates: Vec<MemoryUpdate>,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_memory<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
memory_updates: Vec<MemoryUpdate>,
) -> Pin<Box<dyn Future<Output = Result<(), ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Update specific memory items
Sourcefn add_knowledge<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
knowledge: Knowledge,
) -> Pin<Box<dyn Future<Output = Result<KnowledgeId, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add_knowledge<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
knowledge: Knowledge,
) -> Pin<Box<dyn Future<Output = Result<KnowledgeId, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Add knowledge to agent’s knowledge base
Sourcefn search_knowledge<'life0, 'life1, 'async_trait>(
&'life0 self,
agent_id: AgentId,
query: &'life1 str,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<KnowledgeItem>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn search_knowledge<'life0, 'life1, 'async_trait>(
&'life0 self,
agent_id: AgentId,
query: &'life1 str,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<KnowledgeItem>, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Search knowledge base
Share knowledge between agents
Get shared knowledge available to agent
Sourcefn archive_context<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
before: SystemTime,
) -> Pin<Box<dyn Future<Output = Result<u32, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn archive_context<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
before: SystemTime,
) -> Pin<Box<dyn Future<Output = Result<u32, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Archive old context based on retention policy
Sourcefn get_context_stats<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
) -> Pin<Box<dyn Future<Output = Result<ContextStats, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_context_stats<'life0, 'async_trait>(
&'life0 self,
agent_id: AgentId,
) -> Pin<Box<dyn Future<Output = Result<ContextStats, ContextError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get context statistics