Knowledge Source Types

What Agent(knowledge=…) accepts today — file paths, plain text, and cloud storage URIs

Agent(knowledge=...) accepts local file paths (any UTF-8 text file), plain text, and cloud storage URIs (s3://, gs://, az://, Azure Blob HTTPS) — arbitrary web URLs are not ingested and are skipped with a warning.

python
from praisonaiagents import Agent

agent = Agent(
    name="Reader",
    instructions="Answer from the provided notes.",
    knowledge=["notes.pdf", "Key fact: launch is in March."],
)
agent.start("When is the launch?")
Diagram

Knowledge routing (per source in Agent(knowledge=[…]))

Yes

No

Yes

No

Yes

No

Yes, UTF-8 text

Yes, binary

No

📥 Input string

Cloud URI?
s3:// gs:// az://
or Azure blob URL

☁️ Download & re-enter

http:// or
https://?

⚠️ Warn & skip

Extension in
.pdf .doc .docx .txt
.md .csv .json .xml
.html or media/zip?

📖 Dedicated handler

Path exists
on disk?

📄 Read + chunk as text
metadata: file_type, filename

🚨 ValueError:
Cannot read as UTF-8

📝 Store as raw text

🗃️ Vector store

What Each Source Does

_process_knowledge inspects every item and routes it by type.

SourceExampleBehaviour
Known-extension file"notes.pdf"Dedicated handler (.pdf .doc .docx .txt .md .csv .json .xml .html, media, .zip) — read and indexed
Other existing file"src/auth.py", "Dockerfile"Read as UTF-8 and chunked — metadata records file_type and filename. Since PraisonAI PR #4788.
Plain string (not a path)"Key fact: ..."Knowledge.store(text) — stored as text
Cloud URI"s3://bucket/handbook.pdf", "gs://…", "az://…", Azure blob URLDownloaded to temp, indexed with the same reader as local files. Original URI preserved in metadata. See Cloud Sources.
Web URL"https://example.com"Warns and skips — not ingested

Indexing Source and Text Together

Mix source files, documents, suffix-less files, and raw strings in one list.

python
from praisonaiagents import Agent

agent = Agent(
    name="Codebase Assistant",
    instructions="Answer from the indexed files.",
    knowledge=[
        "src/auth.py",                  # source file: read as UTF-8
        "docs/architecture.md",         # markdown: dedicated handler
        "Dockerfile",                   # suffix-less: read as UTF-8
        "Key fact: launch is in March", # raw string: stored as text
    ],
)
agent.start("Summarise how auth is set up.")

Fetch, Then Pass Text

Fetch the page yourself and pass the text as a knowledge source.

python
import requests
from praisonaiagents import Agent

text = requests.get("https://example.com/article").text
agent = Agent(name="Reader", instructions="Summarise the article.", knowledge=[text])
agent.start("Summarise it.")

Best Practices

Convert web content to text before ingesting

Fetch pages with requests, httpx, or a scraper, then pass the extracted text as a knowledge string.

Prefer local files for documents

Save PDFs and docs locally and pass the path — Knowledge.add(path) reads and chunks them for you.

Check logs if a source seems missing

A skipped URL logs a warning; if answers lack a source you expected, confirm it was a file or text, not a URL.

Related