Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
19 changes: 17 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim

# OCI labels for Docker Hub and container registries
LABEL org.opencontainers.image.title="Redis Agent Memory Server"
LABEL org.opencontainers.image.description="A memory layer for AI agents using Redis as the vector database. Provides REST API and MCP server interfaces with semantic search, topic extraction, and conversation summarization."
LABEL org.opencontainers.image.url="https://github.com/redis/agent-memory-server"
LABEL org.opencontainers.image.source="https://github.com/redis/agent-memory-server"
LABEL org.opencontainers.image.documentation="https://redis.github.io/agent-memory-server/"
LABEL org.opencontainers.image.vendor="Redis"
LABEL org.opencontainers.image.licenses="Apache-2.0"

WORKDIR /app

Expand Down Expand Up @@ -33,7 +41,14 @@ EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD curl -f http://localhost:8000/v1/health || exit 1

# Disable auth by default. Can be overridden with environment variable.
# Disable auth by default for easier local development.
# Override with DISABLE_AUTH=false in production.
ENV DISABLE_AUTH=true

CMD ["agent-memory", "api", "--host", "0.0.0.0", "--port", "8000"]
# Default to development mode (no separate worker needed).
# For production, override the command to remove --no-worker and run a separate task-worker container.
# Examples:
# Development: docker run -p 8000:8000 redislabs/agent-memory-server
# Production API: docker run -p 8000:8000 redislabs/agent-memory-server agent-memory api --host 0.0.0.0 --port 8000
# Production Worker: docker run redislabs/agent-memory-server agent-memory task-worker --concurrency 10
CMD ["agent-memory", "api", "--host", "0.0.0.0", "--port", "8000", "--no-worker"]
77 changes: 50 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,56 @@ A memory layer for AI agents using Redis as the vector database.

### 1. Installation

#### Using Docker

Pre-built Docker images are available from:
- **Docker Hub**: [redislabs/agent-memory-server](https://hub.docker.com/r/redislabs/agent-memory-server)
- **GitHub Packages**: [ghcr.io/redis/agent-memory-server](https://github.com/redis/agent-memory-server/pkgs/container/agent-memory-server)

**Quick Start (Development Mode)**:
```bash
# Start with docker-compose (includes Redis, API, MCP, and worker)
docker-compose up

# Or run just the API server (requires separate Redis)
docker run -p 8000:8000 \
-e REDIS_URL=redis://your-redis:6379 \
-e OPENAI_API_KEY=your-key \
redislabs/agent-memory-server:latest
```

The default image runs in development mode (`--no-worker`), which is perfect for testing and development.

**Production Deployment**:

For production, run separate containers for the API and background workers:

```bash
# API Server (without background worker)
docker run -p 8000:8000 \
-e REDIS_URL=redis://your-redis:6379 \
-e OPENAI_API_KEY=your-key \
-e DISABLE_AUTH=false \
redislabs/agent-memory-server:latest \
agent-memory api --host 0.0.0.0 --port 8000

# Background Worker (separate container)
docker run \
-e REDIS_URL=redis://your-redis:6379 \
-e OPENAI_API_KEY=your-key \
redislabs/agent-memory-server:latest \
agent-memory task-worker --concurrency 10

# MCP Server (if needed)
docker run -p 9000:9000 \
-e REDIS_URL=redis://your-redis:6379 \
-e OPENAI_API_KEY=your-key \
redislabs/agent-memory-server:latest \
agent-memory mcp --mode sse --port 9000
```

#### From Source

```bash
# Install dependencies
pip install uv
Expand Down Expand Up @@ -159,33 +209,6 @@ uv run ruff check
# Start development stack
docker-compose up
```

## Production Deployment

For production environments, use Docket workers for better reliability and scale:

```bash
# Start the API server (production mode)
uv run agent-memory api

# Start MCP server (production mode - SSE)
uv run agent-memory mcp --mode sse --port 9000

# Start background workers (required for production)
uv run agent-memory task-worker --concurrency 10
```

**Production features:**
- **Authentication**: OAuth2/JWT with multiple providers (Auth0, AWS Cognito, etc.)
- **Redis**: Requires Redis 8 or Redis with RediSearch module (RedisStack recommended)
- **Background Processing**: Docket workers handle memory indexing, summarization, and compaction
- **Scaling**: Supports Redis clustering and horizontal worker scaling
- **Monitoring**: Structured logging and health checks included

**Development vs Production:**
- **Development**: Use `--no-worker` flags for quick setup, tasks run inline
- **Production**: Use separate worker processes for better performance and reliability

## License

Apache License 2.0 - see [LICENSE](LICENSE) file for details.
Expand Down
10 changes: 1 addition & 9 deletions agent_memory_server/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from enum import Enum
from typing import Any, Literal

from agent_memory_client.models import ClientMemoryRecord
from mcp.server.fastmcp.prompts import base
from mcp.types import AudioContent, EmbeddedResource, ImageContent, TextContent
from pydantic import BaseModel, Field
Expand Down Expand Up @@ -209,15 +210,6 @@ class ExtractedMemoryRecord(MemoryRecord):
)


class ClientMemoryRecord(MemoryRecord):
"""A memory record with a client-provided ID"""

id: str = Field(
default_factory=lambda: str(ULID()),
description="Client-provided ID for deduplication and overwrites",
)


class WorkingMemory(BaseModel):
"""Working memory for a session - contains both messages and structured memory records"""

Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ services:
interval: 30s
timeout: 10s
retries: 3
# Uses default CMD from Dockerfile (--no-worker for development)

mcp:
build:
Expand Down