search_memories
Retrieve relevant memories by natural language query to recall user preferences, project context, or past interactions, with optional filters for user, agent, or session.
Instructions
Search memories with semantic similarity and relevance filtering.
REQUIRED: 'query' - what to search for (natural language) OPTIONAL: 'user_id' OR 'agent_id' (if neither provided, auto-detects current user) OPTIONAL: 'run_id' - filter by session/run identifier OPTIONAL: 'limit' - max results to return (default: 10, also sets page_size if not specified) OPTIONAL: 'page' - page number for pagination (default: 1) OPTIONAL: 'page_size' - results per page (default: uses limit value)
Returns: Relevant memories filtered by maximum score threshold (configurable via MEM0_MAX_RELEVANCE_SCORE, default: 1000)
Score interpretation (FAISS uses L2 distance - lower is more similar):
0-100: Very high similarity (near-exact matches)
100-400: High similarity (closely related)
400-600: Moderate similarity (somewhat related)
600-1000: Low similarity (loosely related)
1000+: Very low similarity (likely unrelated)
Note: Default threshold of 1000 keeps reasonably similar results. Lower to 400-600 for stricter filtering.
Examples:
Search user memories: {"query": "React patterns", "user_id": "john"}
Auto-detect user: {"query": "my project status"}
Limit results: {"query": "API endpoints", "limit": 3}
Session-scoped: {"query": "current task", "run_id": "session_123"}
Pagination: {"query": "all tasks", "page": 2, "page_size": 5}
Use for: Finding relevant code, recalling user preferences, retrieving project context.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | ||
| limit | No | ||
| query | Yes | ||
| run_id | No | ||
| user_id | No | ||
| verbose | No | ||
| agent_id | No | ||
| page_size | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |