Skip to main content

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 Reader processes local CSV files and converts them into documents that can be used with Agno’s knowledge system.

Code

examples/concepts/knowledge/readers/csv_reader.py
from pathlib import Path

from agno.knowledge.reader.csv_reader import CSVReader

reader = CSVReader()

csv_path = Path("tmp/test.csv")

try:
    print("Starting read...")
    documents = reader.read(csv_path)

    if documents:
        for doc in documents:
            print(doc.name)
            # print(doc.content)
            print(f"Content length: {len(doc.content)}")
            print("-" * 80)
    else:
        print("No documents were returned")

except Exception as e:
    print(f"Error type: {type(e)}")
    print(f"Error occurred: {str(e)}")

Usage

1

Create a virtual environment

Open the Terminal and create a python virtual environment.
python3 -m venv .venv
source .venv/bin/activate
2

Install libraries

pip install -U pandas agno
3

Run Agent

python examples/concepts/knowledge/readers/csv_reader.py

Params

ParameterTypeDefaultDescription
fileUnion[Path, IO[Any]]RequiredPath to CSV file or file-like object
delimiterstr","Character used to separate fields in the CSV
quotecharstr'"'Character used to quote fields in the CSV