Documentation Index
Fetch the complete documentation index at: https://spacesail.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
The CSV URL Reader processes CSV files directly from URLs, allowing you to create knowledge bases from remote CSV data sources.
Code
examples/concepts/knowledge/readers/csv_reader_url_async.py
import asyncio
from agno.agent import Agent
from agno.knowledge.knowledge import Knowledge
from agno.vectordb.pgvector import PgVector
db_url = "postgresql+psycopg://ai:ai@localhost:5532/ai"
knowledge = Knowledge(
# Table name: ai.csv_documents
vector_db=PgVector(
table_name="csv_documents",
db_url=db_url,
),
)
# Initialize the Agent with the knowledge
agent = Agent(
knowledge=knowledge,
search_knowledge=True,
)
if __name__ == "__main__":
# Comment out after first run
asyncio.run(
knowledge.add_content_async(
url="https://agno-public.s3.amazonaws.com/demo_data/IMDB-Movie-Data.csv"
)
)
# Create and use the agent
asyncio.run(
agent.aprint_response("What genre of movies are present here?", markdown=True)
)
Usage
Create a virtual environment
Open the Terminal and create a python virtual environment.python3 -m venv .venv
source .venv/bin/activate
Install libraries
pip install -U pandas requests sqlalchemy psycopg pgvector agno
Run PgVector
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 \
agno/pgvector:16
Run Agent
python examples/concepts/knowledge/readers/csv_reader_url_async.py
Params
| Parameter | Type | Default | Description |
url | str | Required | URL pointing to a CSV file to download and read |