microsoft/autogen · error · ImportError
To use Redis Memory RedisVL must be installed. Run `pip inst
Error message
To use Redis Memory RedisVL must be installed. Run `pip install autogen-ext[redisvl]`
What it means
RedisMemory depends on the redisvl package (plus redis), which is an optional dependency shipped as the autogen-ext[redisvl] extra. Importing autogen_ext.memory.redis without it raises ImportError with the exact pip command needed. This is the standard optional-dependency gate pattern used across autogen-ext.
Source
Thrown at python/packages/autogen-ext/src/autogen_ext/memory/redis/_redis_memory.py:18
import logging
from typing import Any, List, Literal
from autogen_core import CancellationToken, Component
from autogen_core.memory import Memory, MemoryContent, MemoryMimeType, MemoryQueryResult, UpdateContextResult
from autogen_core.model_context import ChatCompletionContext
from autogen_core.models import SystemMessage
from pydantic import BaseModel, Field
logger = logging.getLogger(__name__)
try:
from redis import Redis
from redisvl.extensions.message_history import MessageHistory, SemanticMessageHistory
from redisvl.utils.utils import deserialize, serialize
from redisvl.utils.vectorize import HFTextVectorizer
except ImportError as e:
raise ImportError("To use Redis Memory RedisVL must be installed. Run `pip install autogen-ext[redisvl]`") from e
class RedisMemoryConfig(BaseModel):
"""
Configuration for Redis-based vector memory.
This class defines the configuration options for using Redis as a vector memory store,
supporting semantic memory. It allows customization of the Redis connection, index settings,
similarity search parameters, and embedding model.
"""
redis_url: str = Field(default="redis://localhost:6379", description="url of the Redis instance")
index_name: str = Field(default="chat_history", description="Name of the Redis collection")
prefix: str = Field(default="memory", description="prefix of the Redis collection")
sequential: bool = Field(
default=False, description="ignore semantic similarity and simply return memories in sequential order"
)
distance_metric: Literal["cosine", "ip", "l2"] = "cosine"View on GitHub (pinned to 027ecf0a37)
Solutions
- Install the extra: pip install autogen-ext[redisvl].
- Or install the dependency directly: pip install redisvl.
- Add the extra to requirements.txt/pyproject so environments are reproducible.
Example fix
# before # ImportError: To use Redis Memory RedisVL must be installed... from autogen_ext.memory.redis import RedisMemory # after (shell) # pip install autogen-ext[redisvl] from autogen_ext.memory.redis import RedisMemory
Defensive patterns
Strategy: try-catch
Validate before calling
try:
import redisvl # noqa: F401
HAVE_REDISVL = True
except ImportError:
HAVE_REDISVL = False
if not HAVE_REDISVL:
raise SystemExit('Run: pip install autogen-ext[redisvl]') Try / catch
try:
from autogen_ext.memory.redis import RedisMemory
except ImportError as e:
if 'redisvl' in str(e):
LOG.error('missing optional dep; run pip install autogen-ext[redisvl]')
raise SystemExit(2) from e
raise Prevention
- Pin autogen-ext[redisvl] in requirements/pyproject
- Fail at process start with the install hint instead of mid-run
- Include extras in Docker/CI environment definitions
When it happens
Trigger: import autogen_ext.memory.redis (or any module transitively importing it) without redisvl installed; a fresh environment where autogen-ext was installed without extras; partial installs where redis is present but redisvl is not.
Common situations: New project scaffolding that copies a RedisMemory example; Docker images built from a slim requirements list without the extra; CI cache serving an environment created before RedisMemory was added to the codebase.
Related errors
- To use the GRPC runtime the grpc extra must be installed. Ru
- Distributed runtime features require additional dependencies
- Dependencies for MagenticOneCoderAgent not found. Please ins
- Powershell or pwsh is not installed. Please install one of t
- Failed to get list of available packages: {ret.output.strip(
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/85bf2d29fb500d5d.
Report an issue: GitHub.