Skip to main content
from agno.agent import Agent
from agno.knowledge.knowledge import Knowledge
from agno.knowledge.reader.docling_reader import DoclingReader
from agno.vectordb.pgvector import PgVector

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

# Create a knowledge base with docling reader
knowledge = Knowledge(
    vector_db=PgVector(
        table_name="docling_documents",
        db_url=db_url,
    )
)

# Add documents using DoclingReader
knowledge.insert(
    path="cookbook/07_knowledge/testing_resources/cv_1.pdf",
    reader=DoclingReader(),
)

# Create an agent with the knowledge base
agent = Agent(
    knowledge=knowledge,
    search_knowledge=True,
)

# Query the knowledge base
agent.print_response(
    "Summarize the candidate's experience",
    markdown=True,
)

Run the Example

# Clone and setup repo
git clone https://github.com/agno-agi/agno.git
cd agno/cookbook/07_knowledge/05_integrations/readers

# Create and activate virtual environment
./scripts/demo_setup.sh
source .venvs/demo/bin/activate

# Optional: Run PgVector (needs docker)
./cookbook/scripts/run_pgvector.sh

python docling_reader.py