Memory • Rust AI Agent SDK

Memory: Memory manager for agents

Memory

Defined in the memory module.

Rust AI Agent SDK

Memory manager for agents

Fields

NameTypeDescription
adapterBox<dyn MemoryAdapter>–
configMemoryConfig–

Methods

new

rust
fn new(adapter: impl MemoryAdapter + 'static, config: MemoryConfig) -> Self

Create a new memory with the given adapter

Parameters:

NameType
adapterimpl MemoryAdapter + 'static
configMemoryConfig

in_memory

rust
fn in_memory(config: MemoryConfig) -> Self

Create a new in-memory memory

Parameters:

NameType
configMemoryConfig

default_memory

rust
fn default_memory() -> Self

Create with default config

store

rust
async fn store(&mut self, message: Message) -> Result<()>

Store a message

Parameters:

NameType
messageMessage

history

rust
async fn history(&self) -> Result<Vec<Message>>

Get conversation history

search

rust
async fn search(&self, query: &str, limit: usize) -> Result<Vec<Message>>

Search memory

Parameters:

NameType
query&str
limitusize

clear

rust
async fn clear(&mut self) -> Result<()>

Clear memory

config

rust
fn config(&self) -> &MemoryConfig

Get the config

Source

View on GitHub

praisonai/src/memory/mod.rs at line 151


Related Documentation