pub struct StandardContextManager { /* private fields */ }Expand description
Standard implementation of ContextManager
Implementations§
Source§impl StandardContextManager
impl StandardContextManager
Sourcepub async fn new(
config: ContextManagerConfig,
agent_id: &str,
) -> Result<Self, ContextError>
pub async fn new( config: ContextManagerConfig, agent_id: &str, ) -> Result<Self, ContextError>
Create a new StandardContextManager
Sourcepub fn secrets(&self) -> &(dyn SecretStore + Send + Sync)
pub fn secrets(&self) -> &(dyn SecretStore + Send + Sync)
Get access to the secrets store
Sourcepub async fn initialize(&self) -> Result<(), ContextError>
pub async fn initialize(&self) -> Result<(), ContextError>
Initialize the context manager
Sourcepub async fn shutdown(&self) -> Result<(), ContextError>
pub async fn shutdown(&self) -> Result<(), ContextError>
Shutdown the context manager gracefully
Sourcepub async fn add_background_task(&self, task: JoinHandle<()>)
pub async fn add_background_task(&self, task: JoinHandle<()>)
Add a background task to be tracked for shutdown
Sourcepub async fn is_shutdown(&self) -> bool
pub async fn is_shutdown(&self) -> bool
Check if the context manager is shutdown
Sourcepub async fn create_session(
&self,
agent_id: AgentId,
) -> Result<SessionId, ContextError>
pub async fn create_session( &self, agent_id: AgentId, ) -> Result<SessionId, ContextError>
Create a new session for an agent
Trait Implementations§
Source§impl ContextManager for StandardContextManager
impl ContextManager for StandardContextManager
Source§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 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
Source§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 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
Source§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 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
Source§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 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
Source§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 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
Source§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 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
Source§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 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
Source§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 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
Auto Trait Implementations§
impl Freeze for StandardContextManager
impl !RefUnwindSafe for StandardContextManager
impl Send for StandardContextManager
impl Sync for StandardContextManager
impl Unpin for StandardContextManager
impl !UnwindSafe for StandardContextManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more