Documentation Index Fetch the complete documentation index at: https://agno-v2-shaloo-ai-support-link.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
v2.2.7
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.insert(
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_namestrRequired Name of the Redis index to store vector data redis_urlOptional[str]NoneRedis connection URL redis_clientOptional[Redis]NoneRedis client instance embedderOptional[Embedder]OpenAIEmbedder()Embedder instance to generate embeddings search_typeSearchTypeSearchType.vectorType of search to perform (vector, keyword, hybrid) distanceDistanceDistance.cosineDistance metric for vector comparisons vector_score_weightfloat0.7Weight for vector similarity in hybrid search **redis_kwargsAny- Additional Redis connection parameters