Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ A memory layer for AI agents.
- **Dual Interface**: REST API and Model Context Protocol (MCP) server
- **Two-Tier Memory**: Working memory (session-scoped) and long-term memory (persistent)
- **Configurable Memory Strategies**: Customize how memories are extracted (discrete, summary, preferences, custom)
- **Semantic Search**: Vector-based similarity search with metadata filtering
- **Semantic, Keyword & Hybrid Search**: Vector-based similarity, full-text keyword, and combined hybrid search with metadata filtering
- **Flexible Backends**: Pluggable memory vector database factory system
- **Multi-Provider LLM Support**: OpenAI, Anthropic, AWS Bedrock, Ollama, Azure, Gemini via [LiteLLM](https://docs.litellm.ai/)
- **AI Integration**: Automatic topic extraction, entity recognition, and conversation summarization
Expand Down Expand Up @@ -268,10 +268,10 @@ See **[LLM Providers](https://redis.github.io/agent-memory-server/llm-providers/
```
Working Memory (Session-scoped) → Long-term Memory (Persistent)
↓ ↓
- Messages - Semantic search
- Structured memories - Topic modeling
- Summary of past messages - Entity recognition
- Metadata - Deduplication
|- Messages - Semantic, keyword & hybrid search
|- Structured memories - Topic modeling
|- Summary of past messages - Entity recognition
|- Metadata - Deduplication
```

## Use Cases
Expand Down
26 changes: 21 additions & 5 deletions agent-memory-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ working_memory = WorkingMemory(
response = await client.put_working_memory("user-session-123", working_memory)

# Retrieve working memory
memory = await client.get_working_memory("user-session-123")
created, memory = await client.get_or_create_working_memory("user-session-123")

# Convenience method for data storage
await client.set_working_memory_data(
Expand Down Expand Up @@ -201,6 +201,21 @@ results = await client.search_long_term_memory(
user_id=UserId(eq="user-123"),
limit=20
)

# Keyword search - full-text matching
results = await client.search_long_term_memory(
text="science fiction",
search_mode="keyword",
limit=20
)

# Hybrid search - combines semantic and keyword matching
results = await client.search_long_term_memory(
text="science fiction",
search_mode="hybrid",
hybrid_alpha=0.7, # 0.0=keyword, 1.0=semantic
limit=20
)
```

## Enhanced Features
Expand Down Expand Up @@ -328,14 +343,15 @@ results = await client.search_long_term_memory(
from agent_memory_client.exceptions import (
MemoryClientError,
MemoryValidationError,
MemoryNotFoundError,
MemoryServerError
)

try:
memory = await client.get_working_memory("nonexistent-session")
except MemoryNotFoundError:
print("Session not found")
created, memory = await client.get_or_create_working_memory("my-session")
if created:
print("New session created")
except MemoryValidationError as e:
print(f"Validation error: {e}")
except MemoryServerError as e:
print(f"Server error {e.status_code}: {e}")
except MemoryClientError as e:
Expand Down
17 changes: 16 additions & 1 deletion agent-memory-client/agent-memory-client-js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,29 @@ await client.createLongTermMemory([
},
]);

// Search with filters
// Search with filters (default: semantic search)
const results = await client.searchLongTermMemory({
text: "science fiction",
topics: new Topics({ any: ["books", "entertainment"] }),
userId: new UserId({ eq: "user-123" }),
limit: 20,
});

// Keyword search - full-text matching
const keywordResults = await client.searchLongTermMemory({
text: "science fiction",
searchMode: "keyword",
limit: 20,
});

// Hybrid search - combines semantic and keyword matching
const hybridResults = await client.searchLongTermMemory({
text: "science fiction",
searchMode: "hybrid",
hybridAlpha: 0.7, // 0.0=keyword, 1.0=semantic
limit: 20,
});

// Get by ID
const memory = await client.getLongTermMemory("memory-id");

Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ For contributors and advanced users:

| Feature | REST API | MCP Server | CLI | Documentation |
|---------|----------|------------|-----|---------------|
| **Memory Search** | ✅ `/v1/long-term-memory/search` | ✅ `search_long_term_memory` | | [REST API](api.md), [MCP](mcp.md) |
| **Memory Search** (semantic, keyword, hybrid) | ✅ `/v1/long-term-memory/search` | ✅ `search_long_term_memory` | ✅ `agent-memory search` | [REST API](api.md), [MCP](mcp.md), [CLI](cli.md) |
| **Memory Editing** | ✅ `PATCH /v1/long-term-memory/{id}` | ✅ `edit_long_term_memory` | ❌ | [Memory Editing](memory-lifecycle.md#memory-editing) |
| **Query Optimization** | ✅ `optimize_query` param | ✅ `optimize_query` param | ❌ | [Query Optimization](query-optimization.md) |
| **Recency Boost** | ✅ Default enabled | ✅ Available | ❌ | [Recency Boost](recency-boost.md) |
Expand Down
4 changes: 2 additions & 2 deletions docs/agent-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ A comprehensive travel assistant that demonstrates the most complete integration
- **Automatic Tool Discovery**: Uses `MemoryAPIClient.get_all_memory_tool_schemas()` to automatically discover and integrate all available memory tools
- **Unified Tool Resolution**: Leverages `client.resolve_tool_call()` to handle all memory tool calls uniformly across different LLM providers
- **Working Memory Management**: Session-based conversation state and structured memory storage
- **Long-term Memory**: Persistent memory storage and semantic search capabilities
- **Long-term Memory**: Persistent memory storage with semantic, keyword, and hybrid search capabilities
- **Optional Web Search**: Cached web search using Tavily API with Redis caching

### Available Tools
Expand Down Expand Up @@ -402,7 +402,7 @@ from agent_memory_client import create_memory_client
client = await create_memory_client(base_url="http://localhost:8000")

# Get only the 3 most recent messages
memory = await client.get_working_memory(
_created, memory = await client.get_or_create_working_memory(
session_id="my-session",
namespace="demo",
context_window_max=3
Expand Down
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Transform your AI agents from goldfish 🐠 into elephants 🐘 with Redis-power
Redis Agent Memory Server is a production-ready memory system for AI agents and applications that:

- **🧠 Remembers everything**: Stores conversation history, user preferences, and important facts across sessions
- **🔍 Finds relevant context**: Uses semantic search to surface the right information at the right time
- **🔍 Finds relevant context**: Uses semantic, keyword, and hybrid search to surface the right information at the right time
- **📈 Gets smarter over time**: Automatically extracts, organizes, and deduplicates memories from interactions
- **🔌 Works with any AI model**: REST API and MCP interfaces compatible with OpenAI, Anthropic, and others
- **🌐 Multi-provider support**: Use [100+ LLM providers](llm-providers.md) via LiteLLM (OpenAI, Anthropic, AWS Bedrock, Ollama, Azure, Gemini, and more)
Expand Down Expand Up @@ -95,11 +95,11 @@ print(f"Found: {results.memories[0].text}")

!!! success "Long-Term Memory (Persistent)"
- User preferences, facts, and important information
- Semantic search with vector embeddings
- Flexible search: semantic (vector embeddings), keyword (full-text), and hybrid (combined)
- Advanced filtering by time, topics, entities, users

### 🔍 Intelligent Search
- **Semantic similarity**: Find memories by meaning, not just keywords
- **Multiple search modes**: Semantic (vector similarity), keyword (full-text), and hybrid (combined) search
- **Advanced filters**: Search by user, session, time, topics, entities
- **Query optimization**: AI-powered query refinement for better results
- **Recency boost**: Time-aware ranking that surfaces relevant recent information
Expand Down
15 changes: 15 additions & 0 deletions docs/java-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,21 @@ MemoryRecordResults results = client.longTermMemory().searchLongTermMemories(req
// Simple text search
MemoryRecordResults simpleResults = client.longTermMemory()
.searchLongTermMemories("user preferences");

// Keyword search - full-text matching
SearchRequest keywordRequest = SearchRequest.builder()
.text("TechCorp engineer")
.searchMode("keyword")
.limit(10)
.build();

// Hybrid search - combines semantic and keyword matching
SearchRequest hybridRequest = SearchRequest.builder()
.text("user preferences")
.searchMode("hybrid")
.hybridAlpha(0.7) // 0.0=keyword, 1.0=semantic
.limit(10)
.build();
```

### Get, Edit, and Delete
Expand Down
35 changes: 28 additions & 7 deletions docs/long-term-memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ Long-term memory is **persistent**, **cross-session** storage designed for knowl

## Overview

Long-term memory provides persistent storage that survives server restarts and session expiration. It's optimized for semantic search, deduplication, and rich metadata to enable intelligent retrieval of relevant information.
Long-term memory provides persistent storage that survives server restarts and session expiration. It's optimized for semantic, keyword, and hybrid search, deduplication, and rich metadata to enable intelligent retrieval of relevant information.

| Feature | Details |
|---------|---------|
| **Scope** | Cross-session, persistent |
Comment on lines +7 to 11
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated overview/table emphasize keyword + hybrid search and full-text indexing, but the “Characteristics” list immediately below still says “Vector Indexed: Semantic search …”, which now reads as semantic-only. Consider updating that bullet to be search-mode-agnostic (or explicitly mention full-text + hybrid support) for internal consistency on this page.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the "Vector Indexed" bullet in the Characteristics list to "Multi-Modal Search" which now reads: Semantic (vector), keyword (BM25 full-text), and hybrid search — configurable embeddings (OpenAI, Bedrock, Ollama, and more via LiteLLM). This makes it consistent with the table above which already mentioned all three search modes. Commit: ad27fb6.

| **Lifespan** | Permanent until manually deleted |
| **Storage** | Redis with vector indexing |
| **Search** | Semantic vector search |
| **Storage** | Redis with vector and full-text indexing |
| **Search** | Semantic, keyword, and hybrid search |
| **Capacity** | Unlimited (with compaction) |
| **Use Case** | Knowledge base, user preferences |
| **Indexing** | Vector embeddings + metadata |
| **Indexing** | Vector embeddings + full-text index + metadata |
| **Deduplication** | Hash-based and semantic |

## Characteristics

- **Cross-Session**: Accessible from any session
- **Persistent**: Survives server restarts and session expiration
- **Vector Indexed**: Semantic search with configurable embeddings (OpenAI, Bedrock, Ollama, and more via [LiteLLM](llm-providers.md))
- **Multi-Modal Search**: Semantic (vector), keyword (BM25 full-text), and hybrid search configurable embeddings (OpenAI, Bedrock, Ollama, and more via [LiteLLM](llm-providers.md))
- **Deduplication**: Automatic hash-based and semantic deduplication
- **Rich Metadata**: Topics, entities, timestamps, memory types
- **Compaction**: Automatic cleanup and merging of duplicates
Expand Down Expand Up @@ -126,17 +126,38 @@ POST /v1/long-term-memory/search

## Search Capabilities

Long-term memory provides powerful search features:
Long-term memory supports three search modes: **semantic** (vector similarity), **keyword** (full-text matching), and **hybrid** (combined).

### Semantic Vector Search
### Semantic Search (Default)
```json
{
"text": "python programming help",
"search_mode": "semantic",
"limit": 10,
"distance_threshold": 0.8
}
```

### Keyword Search
```json
{
"text": "TechCorp engineer",
"search_mode": "keyword",
"limit": 10
}
```

### Hybrid Search
Combines vector similarity with full-text keyword matching. Use `hybrid_alpha` to control the balance (0.0 = pure keyword, 1.0 = pure semantic, default 0.7).
```json
{
"text": "python programming help",
"search_mode": "hybrid",
"hybrid_alpha": 0.7,
"limit": 10
}
```

### Advanced Filtering
```json
{
Expand Down
6 changes: 3 additions & 3 deletions docs/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ await memory_client.create_long_term_memory([

## Step 7: Search Your Memories

Search across all stored memories with semantic similarity:
Search across all stored memories using semantic similarity, keyword matching, or hybrid search:

```python
# Search for work-related information
Expand Down Expand Up @@ -331,7 +331,7 @@ You've just worked with both types of memory:
- **Scope**: Cross-session, persistent
- **Lifetime**: Permanent until deleted
- **Use case**: User preferences, facts, knowledge
- **Search**: Semantic vector search with advanced filtering
- **Search**: Semantic, keyword, and hybrid search with advanced filtering

## Next Steps

Expand Down Expand Up @@ -537,7 +537,7 @@ redis-cli -h localhost -p 6379

You now have a working AI agent memory system! Your memories will:
- ✅ Persist across sessions
- ✅ Be searchable with semantic similarity
- ✅ Be searchable with semantic, keyword, or hybrid search
- ✅ Automatically extract context from conversations
- ✅ Provide relevant context to AI responses

Expand Down
17 changes: 16 additions & 1 deletion docs/typescript-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,27 @@ import {
MemoryType,
} from "agent-memory-client";

// Basic search
// Basic semantic search (default)
const results = await client.searchLongTermMemory({
text: "user preferences",
limit: 10,
});

// Keyword search - full-text matching
const keywordResults = await client.searchLongTermMemory({
text: "TechCorp engineer",
searchMode: "keyword",
limit: 10,
});

// Hybrid search - combines semantic and keyword matching
const hybridResults = await client.searchLongTermMemory({
text: "user preferences",
searchMode: "hybrid",
hybridAlpha: 0.7, // 0.0=keyword, 1.0=semantic
limit: 10,
});

// With filters
const filtered = await client.searchLongTermMemory({
text: "programming languages",
Expand Down
2 changes: 1 addition & 1 deletion docs/use-cases.md
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ guidance = await health.get_contextual_health_guidance(
### Search Optimization
- **Enable recency boost**: For time-sensitive domains like support or health
- **Use query optimization**: For natural language queries from end users
- **Filter strategically**: Combine semantic search with metadata filters
- **Filter strategically**: Combine semantic, keyword, or hybrid search with metadata filters

### Privacy and Security
- **User isolation**: Always filter by user_id for personal data
Expand Down
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ A comprehensive travel assistant that demonstrates:
- **Automatic Tool Discovery**: Uses `MemoryAPIClient.get_all_memory_tool_schemas()` to automatically discover and integrate all available memory tools
- **Unified Tool Resolution**: Leverages `client.resolve_tool_call()` to handle all memory tool calls uniformly across different LLM providers
- **Working Memory Management**: Session-based conversation state and structured memory storage
- **Long-term Memory**: Persistent memory storage and semantic search capabilities
- **Long-term Memory**: Persistent memory storage with semantic, keyword, and hybrid search capabilities
- **Optional Web Search**: Cached web search using Tavily API with Redis caching

### Available Tools
Expand Down
Loading