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
| Name | Type | Description |
|---|---|---|
adapter | Box<dyn MemoryAdapter> | – |
config | MemoryConfig | – |
Methods
new
fn new(adapter: impl MemoryAdapter + 'static, config: MemoryConfig) -> SelfCreate a new memory with the given adapter
Parameters:
| Name | Type |
|---|---|
adapter | impl MemoryAdapter + 'static |
config | MemoryConfig |
in_memory
fn in_memory(config: MemoryConfig) -> SelfCreate a new in-memory memory
Parameters:
| Name | Type |
|---|---|
config | MemoryConfig |
default_memory
fn default_memory() -> SelfCreate with default config
store
async fn store(&mut self, message: Message) -> Result<()>Store a message
Parameters:
| Name | Type |
|---|---|
message | Message |
history
async fn history(&self) -> Result<Vec<Message>>Get conversation history
search
async fn search(&self, query: &str, limit: usize) -> Result<Vec<Message>>Search memory
Parameters:
| Name | Type |
|---|---|
query | &str |
limit | usize |
clear
async fn clear(&mut self) -> Result<()>Clear memory
config
fn config(&self) -> &MemoryConfigGet the config
Source
View on GitHubpraisonai/src/memory/mod.rs at line 151