> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2-agui.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Redis Vector Database

> Use Redis as a vector database for your Knowledge Base.

<Badge icon="code-branch" color="orange">
  <Tooltip tip="Introduced in v2.2.7" cta="View release notes" href="https://github.com/agno-agi/agno/releases/tag/v2.2.7">v2.2.7</Tooltip>
</Badge>

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:

```shell theme={null}
docker run -d --name redis \
  -p 6379:6379 \
  -p 8001:8001 \
  redis/redis-stack:latest

docker start redis
```

## Example

```python agent_with_knowledge.py theme={null}

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

<Snippet file="vectordb_redis_params.mdx" />
