pub struct EpisodicStore { /* private fields */ }Expand description
Stores episodic (event-based) memories for agents, ordered by insertion time.
§Guarantees
- Thread-safe via
Arc<Mutex<_>> - Ordered: recall returns items in descending importance order
- Bounded by optional capacity
Implementations§
Source§impl EpisodicStore
impl EpisodicStore
Sourcepub fn with_decay(policy: DecayPolicy) -> Self
pub fn with_decay(policy: DecayPolicy) -> Self
Create a new episodic store with the given decay policy.
Sourcepub fn with_recall_policy(policy: RecallPolicy) -> Self
pub fn with_recall_policy(policy: RecallPolicy) -> Self
Create a new episodic store with the given recall policy.
Sourcepub fn with_per_agent_capacity(capacity: usize) -> Self
pub fn with_per_agent_capacity(capacity: usize) -> Self
Create a new episodic store with the given per-agent capacity limit.
When an agent exceeds this capacity, the lowest-importance item for that agent is evicted.
Sourcepub fn add_episode(
&self,
agent_id: AgentId,
content: impl Into<String> + Debug,
importance: f32,
) -> Result<MemoryId, AgentRuntimeError>
pub fn add_episode( &self, agent_id: AgentId, content: impl Into<String> + Debug, importance: f32, ) -> Result<MemoryId, AgentRuntimeError>
Sourcepub fn add_episode_at(
&self,
agent_id: AgentId,
content: impl Into<String> + Debug,
importance: f32,
timestamp: DateTime<Utc>,
) -> Result<MemoryId, AgentRuntimeError>
pub fn add_episode_at( &self, agent_id: AgentId, content: impl Into<String> + Debug, importance: f32, timestamp: DateTime<Utc>, ) -> Result<MemoryId, AgentRuntimeError>
Add an episode with an explicit timestamp.
Sourcepub fn recall(
&self,
agent_id: &AgentId,
limit: usize,
) -> Result<Vec<MemoryItem>, AgentRuntimeError>
pub fn recall( &self, agent_id: &AgentId, limit: usize, ) -> Result<Vec<MemoryItem>, AgentRuntimeError>
Recall up to limit memories for the given agent.
Applies decay if configured, increments recall_count for each recalled
item in-place, then returns items sorted according to the configured
RecallPolicy (default: descending importance).
Sourcepub fn len(&self) -> Result<usize, AgentRuntimeError>
pub fn len(&self) -> Result<usize, AgentRuntimeError>
Return the total number of stored episodes across all agents.
Sourcepub fn is_empty(&self) -> Result<bool, AgentRuntimeError>
pub fn is_empty(&self) -> Result<bool, AgentRuntimeError>
Return true if no episodes have been stored.
Trait Implementations§
Source§impl Clone for EpisodicStore
impl Clone for EpisodicStore
Source§fn clone(&self) -> EpisodicStore
fn clone(&self) -> EpisodicStore
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EpisodicStore
impl Debug for EpisodicStore
Auto Trait Implementations§
impl Freeze for EpisodicStore
impl RefUnwindSafe for EpisodicStore
impl Send for EpisodicStore
impl Sync for EpisodicStore
impl Unpin for EpisodicStore
impl UnsafeUnpin for EpisodicStore
impl UnwindSafe for EpisodicStore
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