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

# Agent with Knowledge

> Query PDF knowledge stored in PgVector with a Vercel v0 agent.

## Code

```python knowledge.py theme={null}
from agno.agent import Agent
from agno.knowledge.knowledge import Knowledge
from agno.models.vercel import V0
from agno.vectordb.pgvector import PgVector

db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai"

knowledge = Knowledge(
    vector_db=PgVector(table_name="recipes", db_url=db_url),
)
# Add content to the knowledge
knowledge.insert(
    url="https://agno-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf"
)

agent = Agent(model=V0(id="v0-1.0-md"), knowledge=knowledge)
agent.print_response("How to make Thai curry?", markdown=True)
```

<Warning>
  Vercel retired the v0 Model API endpoint (`https://api.v0.dev/v1/`) that this integration targets, in favor of the Platform API. Requests made with `V0` will fail until Agno updates this integration. See [Vercel's community announcement](https://community.vercel.com/t/has-the-v0-api-model-been-updated/32229).
</Warning>

`PgVector` defaults to `OpenAIEmbedder` for embeddings, so this example also needs `OPENAI_API_KEY`.

## Usage

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Set your API keys">
    ```bash theme={null}
    export V0_API_KEY=xxx
    export OPENAI_API_KEY=xxx
    ```
  </Step>

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U sqlalchemy psycopg pgvector pypdf openai agno
    ```
  </Step>

  <Step title="Run PgVector">
    ```bash theme={null}
    docker run -d \
      -e POSTGRES_DB=ai \
      -e POSTGRES_USER=ai \
      -e POSTGRES_PASSWORD=ai \
      -e PGDATA=/var/lib/postgresql/data/pgdata \
      -v pgvolume:/var/lib/postgresql/data \
      -p 5532:5432 \
      --name pgvector \
      agnohq/pgvector:18
    ```
  </Step>

  <Step title="Run Agent">
    Save the code above as `knowledge.py`, then run:

    ```bash theme={null}
    python knowledge.py
    ```
  </Step>
</Steps>
