agentlib-memory
Advanced memory management for AI agents. This crate provides various implementations of the MemoryProvider trait to manage conversation history of varying lengths and complexities.
Providers
- BufferMemory: Simple in-memory storage with optional message limits.
- SlidingWindowMemory: Maintains a fixed number of recent conversation turns while respecting a token budget.
- SummarizingMemory: Uses an LLM to compress older parts of the conversation into a summary once a window threshold is reached.
- CompositeMemory: Chains multiple memory providers together (e.g., a local buffer followed by a vector database).
Usage
use BufferMemory;
use Arc;
let memory = new; // Store last 50 messages
Implementation Details
The memory system handles:
- Token estimation for messages.
- Session isolation.
- Metadata tagging for indexed retrieval.