How to use it?
Basic Command Structure
Parameters
Required:action
- Operation to perform (save, get, update, search)userId
- User identifier for memory storage and retrieval
memoryId
- Unique memory document ID (for updates)message
- Memory content/message to storesortField
- Custom identifier for organizing memoriesagentId
- Agent identifier that created the memorycompiled
- Output format (true for plain text, false for structured JSON)limit
- Maximum number of results for search operations
Response Format
Single memory:Tools
Save Memory
Store a new memory or update an existing one for a specific user. If a sortField is provided and already exists, the memory will be updated. Parameters:action
(required) - Set to “save”userId
(required) - User identifiermessage
(required) - Memory content to storesortField
(optional) - Custom identifier for the memoryagentId
(optional) - Agent that created this memory
Get User Memories
Retrieve all memories for a specific user with optional filtering by agent Parameters:action
(required) - Set to “get”userId
(required) - User identifieragentId
(optional) - Filter memories by specific agentcompiled
(optional) - Set to true for plain text format, false for JSON
Update Memory
Update an existing memory using its unique memory ID Parameters:action
(required) - Set to “update”memoryId
(required) - Unique memory document IDmessage
(required) - Updated memory content
Search Memories
Search through a user’s memories with query matching Parameters:action
(required) - Set to “search”userId
(required) - User identifierquery
(required) - Search query stringagentId
(optional) - Filter by specific agentlimit
(optional) - Maximum results (default: 50)
What can you do with it?
Store, retrieve, and search user-specific memories that persist across conversations and sessions. Perfect for maintaining context about user preferences, past interactions, project details, and personalized information. Enables AI agents to provide more contextual and personalized responses by remembering important details about each user.Memory Storage Fundamentals
Important Rules
- Memories are stored per user and isolated by organization context
- Each memory is uniquely identified by
userId
+sortField
combination - If you don’t specify a
sortField
, one will be automatically generated with timestamp - Memories can be associated with specific agents for better organization
- All memories are stored in non-quota collections, so they don’t count toward billing limits
Memory Key Patterns
Long-term memories use structured keys for organization:-
User-Only Memory
- General user memory not tied to specific agent
- Good for: User preferences, general context
-
Agent-Specific Memory
- Memory created by specific agent
- Good for: Agent-specific learnings, specialized context
Sort Field Patterns
-
Auto-Generated (Timestamp-Based)
- Automatically created when not specified
- Good for: General memory storage
-
Custom Descriptive
- Human-readable identifier
- Good for: Specific, retrievable memories
-
Date-Based
- Time-organized memories
- Good for: Time-series user interactions
Examples
User Preference Memory
Project Context Memory
Meeting Summary Memory
Personal Assistant Memory
Learning Progress Memory
Memory Management Best Practices
Organization Strategies
Agent-Specific Memories: Use different agents for different contextscoding-assistant
for development preferencesproject-manager-bot
for project contextmeeting-assistant
for meeting summariespersonal-assistant
for scheduling/preferences
user_preferences
for general settingsproject_current_status
for active project infomeeting_YYYY-MM-DD_topic
for meeting memoriesskill_assessment_topic
for learning progress
Memory Content Guidelines
Be Specific and Actionable: Store memories that help provide better responsesSearch and Retrieval
Use Compiled Format for quick context overview:Advanced Features
Cross-Agent Memory Sharing
Memories can be accessed by any agent within the same organization, enabling seamless handoffs:Memory Updates and Evolution
Memories can evolve over time by updating existing sortFields:Contextual Memory Compilation
Use compiled format to get a quick overview for context injection:Notes
- Memories are automatically stored in non-quota collections (
agents_memories
type) - Each user’s memories are isolated by organization context for security
- Memories persist indefinitely until manually deleted or updated
- The system automatically handles memory collection creation and management
- Search functionality works across all memory content and metadata
- Agent-specific filtering helps organize memories by context and purpose
- Use meaningful sortField values for easier memory management and retrieval
- Memory updates preserve the original creation timestamp while updating the modification time
- All memory operations require valid organization authentication context