Documentation Index
Fetch the complete documentation index at: https://spacesail.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
You can use Redis as a vector database with Agno.
Setup
For connecting to a remote Redis instance, pass your Redis connection string to the redis_url parameter and the index name to the index_name parameter of the RedisDB constructor.
For a local docker setup, you can use the following command:
docker run -d --name redis \
-p 6379:6379 \
-p 8001:8001 \
redis/redis-stack:latest
docker start redis
Example
import os
from agno.agent import Agent
from agno.knowledge.knowledge import Knowledge
from agno.vectordb.redis import RedisDB
from agno.vectordb.search import SearchType
# Configure Redis connection (from environment variables if available, otherwise use local defaults)
REDIS_URL = os.getenv("REDIS_URL", "redis://localhost:6379/0")
INDEX_NAME = os.getenv("REDIS_INDEX", "agno_cookbook_vectors")
# Initialize Redis Vector DB
vector_db = RedisDB(
index_name=INDEX_NAME,
redis_url=REDIS_URL,
search_type=SearchType.vector, # try SearchType.hybrid for hybrid search
)
# Build a Knowledge base backed by Redis
knowledge = Knowledge(
name="My Redis Vector Knowledge Base",
description="This knowledge base uses Redis + RedisVL as the vector store",
vector_db=vector_db,
)
# Add content (ingestion + chunking + embedding handled by Knowledge)
knowledge.add_content(
name="Recipes",
url="https://agno-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf",
metadata={"doc_type": "recipe_book"},
skip_if_exists=True,
)
# Query with an Agent
agent = Agent(knowledge=knowledge)
agent.print_response("List down the ingredients to make Massaman Gai", markdown=True)
Redis Params
| Parameter | Type | Default | Description |
index_name | str | Required | Name of the Redis index to store vector data |
redis_url | Optional[str] | None | Redis connection URL |
redis_client | Optional[Redis] | None | Redis client instance |
embedder | Optional[Embedder] | OpenAIEmbedder() | Embedder instance to generate embeddings |
search_type | SearchType | SearchType.vector | Type of search to perform (vector, keyword, hybrid) |
distance | Distance | Distance.cosine | Distance metric for vector comparisons |
vector_score_weight | float | 0.7 | Weight for vector similarity in hybrid search |
**redis_kwargs | Any | - | Additional Redis connection parameters |
Developer Resources