|
1 | | -# 🔮 Redis Agent Memory Server |
| 1 | +# Redis Agent Memory Server |
2 | 2 |
|
3 | | -A Redis-powered memory server built for AI agents and applications. It manages both conversational context and long-term memories, offering semantic search, automatic summarization, and flexible APIs through both REST and MCP interfaces. |
| 3 | +A memory layer for AI agents using Redis as the vector database. |
4 | 4 |
|
5 | 5 | ## Features |
6 | 6 |
|
7 | | -- **Working Memory** |
| 7 | +- **Dual Interface**: REST API and Model Context Protocol (MCP) server |
| 8 | +- **Two-Tier Memory**: Working memory (session-scoped) and long-term memory (persistent) |
| 9 | +- **Semantic Search**: Vector-based similarity search with metadata filtering |
| 10 | +- **Flexible Backends**: Pluggable vector store factory system |
| 11 | +- **AI Integration**: Automatic topic extraction, entity recognition, and conversation summarization |
| 12 | +- **Python SDK**: Easy integration with AI applications |
8 | 13 |
|
9 | | - - Session-scoped storage for messages, structured memories, context, and metadata |
10 | | - - Automatically summarizes conversations when they exceed a client-configured (or server-managed) window size |
11 | | - - Supports all major OpenAI and Anthropic models |
12 | | - - Automatic (background) promotion of structured memories to long-term storage |
| 14 | +## Quick Start |
13 | 15 |
|
14 | | -- **Long-Term Memory** |
| 16 | +### 1. Installation |
15 | 17 |
|
16 | | - - Persistent storage for memories across sessions |
17 | | - - Pluggable vector store backends - support for any LangChain VectorStore (defaults to Redis) |
18 | | - - Semantic search to retrieve memories with advanced filtering |
19 | | - - Filter by session, user ID, namespace, topics, entities, timestamps, and more |
20 | | - - Supports both exact match and semantic similarity search |
21 | | - - Automatic topic modeling for stored memories with BERTopic or configured LLM |
22 | | - - Automatic Entity Recognition using BERT or configured LLM |
23 | | - - Memory deduplication and compaction |
| 18 | +```bash |
| 19 | +# Install dependencies |
| 20 | +pip install uv |
| 21 | +uv install --all-extras |
24 | 22 |
|
25 | | -- **Production-Grade Memory Isolation** |
26 | | - - OAuth2/JWT Bearer token authentication |
27 | | - - Supports RBAC permissions |
28 | | - - Top-level support for user ID and session ID isolation |
| 23 | +# Start Redis |
| 24 | +docker-compose up redis |
29 | 25 |
|
30 | | -- **Other Features** |
31 | | - - Dedicated SDK offering direct access to API calls _and_ memory operations as tools to pass to your LLM |
32 | | - - Both a REST interface and MCP server |
33 | | - - Heavy operations run as background tasks |
| 26 | +# Start the server |
| 27 | +uv run agent-memory api |
| 28 | +``` |
34 | 29 |
|
35 | | -For detailed information about memory types, their differences, and when to use each, see the [Memory Types Guide](docs/memory-types.md). |
| 30 | +### 2. Python SDK |
36 | 31 |
|
37 | | -## Authentication |
| 32 | +```bash |
| 33 | +# Install the client |
| 34 | +pip install agent-memory-client |
| 35 | +``` |
38 | 36 |
|
39 | | -The Redis Agent Memory Server supports OAuth2/JWT Bearer token authentication for secure API access. It's compatible with Auth0, AWS Cognito, Okta, Azure AD, and other standard OAuth2 providers. |
| 37 | +```python |
| 38 | +from agent_memory_client import MemoryAPIClient |
40 | 39 |
|
41 | | -For complete authentication setup, configuration, and usage examples, see [Authentication Documentation](docs/authentication.md). |
| 40 | +# Connect to server |
| 41 | +client = MemoryAPIClient(base_url="http://localhost:8000") |
42 | 42 |
|
43 | | -For manual Auth0 testing, see the [manual OAuth testing guide](manual_oauth_qa/README.md). |
| 43 | +# Store memories |
| 44 | +await client.create_long_term_memories([ |
| 45 | + { |
| 46 | + "text": "User prefers morning meetings", |
| 47 | + "user_id": "user123", |
| 48 | + "memory_type": "preference" |
| 49 | + } |
| 50 | +]) |
44 | 51 |
|
45 | | -## System Diagram |
| 52 | +# Search memories |
| 53 | +results = await client.search_long_term_memory( |
| 54 | + text="What time does the user like meetings?", |
| 55 | + user_id="user123" |
| 56 | +) |
| 57 | +``` |
46 | 58 |
|
47 | | - |
| 59 | +### 3. MCP Integration |
48 | 60 |
|
49 | | -## Project Status and Roadmap |
| 61 | +```bash |
| 62 | +# Start MCP server |
| 63 | +uv run agent-memory mcp |
50 | 64 |
|
51 | | -### Project Status: Experimental |
| 65 | +# Or with SSE mode |
| 66 | +uv run agent-memory mcp --mode sse --port 9000 |
| 67 | +``` |
52 | 68 |
|
53 | | -This project is under active development and is **experimental** software. We do not officially support it, nor are there long-term plans to maintain it. |
| 69 | +## Documentation |
54 | 70 |
|
55 | | -### Roadmap |
| 71 | +📚 **[Full Documentation](https://redis.github.io/redis-memory-server/)** - Complete guides, API reference, and examples |
56 | 72 |
|
57 | | -- [] Easier RBAC customization: role definitions, more hooks |
| 73 | +### Key Documentation Sections: |
58 | 74 |
|
59 | | -## REST API Endpoints |
| 75 | +- **[Quick Start Guide](docs/quick-start.md)** - Get up and running in minutes |
| 76 | +- **[Python SDK](docs/python-sdk.md)** - Complete SDK reference with examples |
| 77 | +- **[Vector Store Backends](docs/vector-store-backends.md)** - Configure different vector databases |
| 78 | +- **[Authentication](docs/authentication.md)** - OAuth2/JWT setup for production |
| 79 | +- **[Memory Types](docs/memory-types.md)** - Understanding semantic vs episodic memory |
| 80 | +- **[API Reference](docs/api.md)** - REST API endpoints |
| 81 | +- **[MCP Protocol](docs/mcp.md)** - Model Context Protocol integration |
60 | 82 |
|
61 | | -The server provides REST endpoints for managing working memory, long-term memory, and memory search. Key endpoints include session management, memory storage/retrieval, semantic search, and memory-enriched prompts. |
| 83 | +## Architecture |
62 | 84 |
|
63 | | -For complete API documentation with examples, see [REST API Documentation](docs/api.md). |
| 85 | +``` |
| 86 | +Working Memory (Session-scoped) → Long-term Memory (Persistent) |
| 87 | + ↓ ↓ |
| 88 | +- Messages - Semantic search |
| 89 | +- Context - Topic modeling |
| 90 | +- Structured memories - Entity recognition |
| 91 | +- Metadata - Deduplication |
| 92 | +``` |
64 | 93 |
|
65 | | -## MCP Server Interface |
| 94 | +## Use Cases |
66 | 95 |
|
67 | | -Agent Memory Server offers an MCP (Model Context Protocol) server interface powered by FastMCP, providing tool-based memory management for LLMs and agents. Includes tools for working memory, long-term memory, semantic search, and memory-enriched prompts. |
| 96 | +- **AI Assistants**: Persistent memory across conversations |
| 97 | +- **Customer Support**: Context from previous interactions |
| 98 | +- **Personal AI**: Learning user preferences and history |
| 99 | +- **Research Assistants**: Accumulating knowledge over time |
| 100 | +- **Chatbots**: Maintaining context and personalization |
68 | 101 |
|
69 | | -For complete MCP setup and usage examples, see [MCP Documentation](docs/mcp.md). |
70 | | - |
71 | | -## Command Line Interface |
72 | | - |
73 | | -The `agent-memory-server` provides a comprehensive CLI for managing servers and tasks. Key commands include starting API/MCP servers, scheduling background tasks, running workers, and managing migrations. |
74 | | - |
75 | | -For complete CLI documentation and examples, see [CLI Documentation](docs/cli.md). |
| 102 | +## Development |
76 | 103 |
|
77 | | -## Getting Started |
| 104 | +```bash |
| 105 | +# Install dependencies |
| 106 | +uv install --all-extras |
78 | 107 |
|
79 | | -For complete setup instructions, see [Getting Started Guide](docs/getting-started.md). |
| 108 | +# Run tests |
| 109 | +uv run pytest |
80 | 110 |
|
81 | | -## Configuration |
| 111 | +# Format code |
| 112 | +uv run ruff format |
| 113 | +uv run ruff check |
82 | 114 |
|
83 | | -Configure servers and workers using environment variables. Includes background task management, memory compaction, and data migrations. |
| 115 | +# Start development stack |
| 116 | +docker-compose up |
| 117 | +``` |
84 | 118 |
|
85 | | -For complete configuration details, see [Configuration Guide](docs/configuration.md). |
| 119 | +## Production Deployment |
86 | 120 |
|
87 | | -For vector store backend options and setup, see [Vector Store Backends](docs/vector-store-backends.md). |
| 121 | +- **Authentication**: OAuth2/JWT with multiple providers (Auth0, AWS Cognito, etc.) |
| 122 | +- **Redis**: Requires Redis with RediSearch module (RedisStack recommended) |
| 123 | +- **Scaling**: Supports Redis clustering and background task processing |
| 124 | +- **Monitoring**: Structured logging and health checks included |
88 | 125 |
|
89 | 126 | ## License |
90 | 127 |
|
91 | | -Apache 2.0 License - see [LICENSE](LICENSE) file for details. |
| 128 | +Apache License 2.0 - see [LICENSE](LICENSE) file for details. |
92 | 129 |
|
93 | | -## Development |
| 130 | +## Contributing |
94 | 131 |
|
95 | | -For development setup, testing, and contributing guidelines, see [Development Guide](docs/development.md). |
| 132 | +We welcome contributions! Please see the [development documentation](docs/development.md) for guidelines. |
0 commit comments