Knowledge Overview

Give your agents access to documents and data

Knowledge Overview

Knowledge allows your agents to answer questions using your own documents – PDFs, text files, web pages, and more.

How It Works

Diagram

Documents

Index

Vector Store

Question

Agent

Answer + Citations

  1. Add documents → Chunked and indexed
  2. Ask questions → Agent retrieves relevant context
  3. Get answers → With source citations

Quick Start

python
from praisonaiagents import Agent

agent = Agent(
    name="Research Assistant",
    knowledge=["research.pdf", "docs/"]
)

response = agent.start("What are the key findings?")

That’s it! The agent can now answer questions using your documents.

When to Use

ApproachBest ForLink
Agent(knowledge=[...])Most use casesQuick Start →
Knowledge() classCustom indexingKnowledge API →
RAG() classCustom pipelinesRAG Module →

Knowledge vs Memory vs RAG

FeatureKnowledgeMemoryRAG
PurposeAnswer from documentsRemember conversationsRetrieve + Generate
Data SourceFiles, URLsConversationsKnowledge base
UpdatesManual (re-index)AutomaticUses Knowledge
Best ForQ&A, researchChat continuityCitations, search

What Knowledge.search() returns

Knowledge.search() returns a typed SearchResult from praisonaiagents.knowledge.models.

FieldTypeDescription
resultslist[SearchResultItem]Ranked items
metadatadictSearch-level metadata (always dict, never None)
querystrOriginal query string
total_countintTotal available (may exceed len(results) if paginated)
python
from praisonaiagents import Agent
from praisonaiagents.knowledge import Knowledge

knowledge = Knowledge()
knowledge.store("Paris is the capital of France.")

results = knowledge.search("capital of France", user_id="alice")

for item in results.results:
    print(f"[{item.score:.2f}] {item.text}  ({item.source or '-'})")

Next Steps