Skip to main content

MemoryRuntime

Struct MemoryRuntime 

Source
pub struct MemoryRuntime {
    pub session_store: Box<dyn SessionStore>,
    pub semantic_store: Option<Box<dyn SemanticMemory>>,
    pub extractor: MemoryExtractor,
    pub restore_policy: RestorePolicy,
    pub restore_config: RestoreConfig,
}

Fields§

§session_store: Box<dyn SessionStore>§semantic_store: Option<Box<dyn SemanticMemory>>§extractor: MemoryExtractor§restore_policy: RestorePolicy§restore_config: RestoreConfig

Implementations§

Source§

impl MemoryRuntime

Source

pub fn new( session_store: Box<dyn SessionStore>, semantic_store: Option<Box<dyn SemanticMemory>>, extractor: MemoryExtractor, restore_policy: RestorePolicy, ) -> Self

Source

pub fn on_run_start(&self, session_id: &str, _goal: &str) -> Vec<Message>

Load session history and apply restore policy to build initial context.

Source

pub fn on_turn_end(&mut self, user_msg: &Message, assistant_msg: &Message)

Extract memories from the current turn and store in semantic memory.

Source

pub fn on_tool_result(&mut self, _tool_name: &str, result: &str)

Optionally store a tool result in semantic memory.

Source

pub fn on_run_end( &mut self, session_id: &str, agent_id: &str, messages: &[Message], now_ms: u64, )

Extract memories from the run and persist the session. now_ms is injected by the SDK layer — the kernel never reads system time.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.