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

# Weaviate Vector Database

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

## Setup

Install Agno, the Weaviate client, the OpenAI client, and the PDF reader:

```shell theme={null}
uv pip install -U agno weaviate-client openai pypdf
```

Set your OpenAI API key for the default embedder and agent model:

```shell theme={null}
export OPENAI_API_KEY=xxx
```

Start Weaviate locally:

```shell theme={null}
docker run -d \
  -p 8080:8080 \
  -p 50051:50051 \
  --name weaviate \
  cr.weaviate.io/semitechnologies/weaviate:1.28.4
```

See Weaviate's [local Docker quickstart](https://docs.weaviate.io/weaviate/quickstart/local) for other deployment options.

## Example

```python agent_with_knowledge.py theme={null}
from agno.agent import Agent
from agno.knowledge.knowledge import Knowledge
from agno.vectordb.search import SearchType
from agno.vectordb.weaviate import Distance, VectorIndex, Weaviate

vector_db = Weaviate(
    collection="recipes",
    search_type=SearchType.hybrid,
    vector_index=VectorIndex.HNSW,
    distance=Distance.COSINE,
    local=True,  # Set to False if using Weaviate Cloud and True if using local instance
)
# Create knowledge base
knowledge_base = Knowledge(
    vector_db=vector_db,
)

# Create and use the agent
agent = Agent(
    knowledge=knowledge_base,
    search_knowledge=True,
)

if __name__ == "__main__":
    knowledge_base.insert(
        url="https://agno-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf"
    )

    agent.print_response("How to make Thai curry?", markdown=True)
```

> **Async Support**
>
> These methods await Weaviate client I/O. In Agno v3.0.4, PDF parsing and embedding still run synchronously and can block the event loop. Offload large ingestion jobs or slow embedding calls to a worker.
>
> ```python async_weaviate_db.py theme={null}
> import asyncio
>
> from agno.agent import Agent
> from agno.knowledge.knowledge import Knowledge
> from agno.vectordb.search import SearchType
> from agno.vectordb.weaviate import Distance, VectorIndex, Weaviate
>
> vector_db = Weaviate(
>     collection="recipes_async",
>     search_type=SearchType.hybrid,
>     vector_index=VectorIndex.HNSW,
>     distance=Distance.COSINE,
>     local=True,  # Set to False if using Weaviate Cloud and True if using local instance
> )
>
> # Create knowledge base
> knowledge_base = Knowledge(
>     vector_db=vector_db,
> )
>
> agent = Agent(
>     knowledge=knowledge_base,
>     search_knowledge=True,
> )
>
> async def main():
>     await knowledge_base.ainsert(
>         url="https://agno-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf"
>     )
>     await agent.aprint_response("How to make Tom Kha Gai", markdown=True)
>
> if __name__ == "__main__":
>     asyncio.run(main())
> ```
>
> > [!TIP]
> >
> > The async methods use `WeaviateAsyncClient` for non-blocking vector operations.

## Weaviate Params

<Snippet file="vectordb_weaviate_params.mdx" />


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