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

# Redis Agent Knowledge

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.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

<Snippet file="vectordb_redis_params.mdx" />

## Developer Resources

* View [Cookbook](https://github.com/agno-agi/agno/blob/main/cookbook/knowledge/vector_db/redis_db/redis_db.py)
