Quick Start
1
Enable Agent Memory
2
Clear Memory
User Interaction Flow
Memory
Main memory manager for agents.Factory Methods
Instance Methods
MemoryConfig
Configuration for memory behavior.Configuration Options
ConversationHistory
Low-level message storage with automatic trimming.Methods
Note: When trimming, system messages are preserved - only user/assistant messages are removed.
MemoryAdapter Trait
Interface for custom memory backends.InMemoryAdapter
Default in-memory implementation.Methods
Custom Memory Adapter
Best Practices
Set appropriate max_messages
Set appropriate max_messages
Too many messages increase token usage and cost. Start with 50-100.
Clear memory for new contexts
Clear memory for new contexts
Use
clear_memory() when starting unrelated conversations.System messages are preserved
System messages are preserved
The trimming algorithm keeps system messages - only user/assistant messages are removed when exceeding limits.
Use search for relevant context
Use search for relevant context
For long histories, use
search() to find relevant past messages instead of loading everything.Related
Agent
Agent API
Sessions
Session persistence

