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

# Valkey Vector Database

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

v2.7.3 (Introduced in v2.7.3)

You can use Valkey as a vector database with Agno using the valkey-search module.

## Setup

Install dependencies:

```bash theme={null}
uv pip install -U agno openai pypdf valkey-glide-sync
```

Set the API key used by the default OpenAI embedder and agent model:

```bash Mac/Linux theme={null}
export OPENAI_API_KEY="your_openai_api_key_here"
```

```bash Windows theme={null}
$Env:OPENAI_API_KEY="your_openai_api_key_here"
```

Valkey vector search requires the valkey-search module. Use the `valkey/valkey-bundle` Docker image which includes it:

```shell theme={null}
docker run -d --name my-valkey \
  -p 6379:6379 \
  valkey/valkey-bundle
```

## Example

```python agent_with_knowledge.py theme={null}
from agno.agent import Agent
from agno.knowledge.knowledge import Knowledge
from agno.vectordb.valkey import ValkeyDB
from agno.vectordb.search import SearchType

# Initialize Valkey Vector DB
vector_db = ValkeyDB(
    index_name="agno_docs",
    host="localhost",
    port=6379,
    search_type=SearchType.vector,
)

# Build a Knowledge base backed by Valkey
knowledge = Knowledge(
    name="My Valkey Knowledge Base",
    description="Knowledge base using Valkey as the vector store",
    vector_db=vector_db,
)

# Add content
knowledge.insert(
    name="Recipes",
    url="https://agno-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf",
    metadata={"category": "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)
```

## Valkey Params

<Snippet file="vectordb_valkey_params.mdx" />


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.