Knowledge Bases

Enhancing agents with specialized knowledge

Knowledge gives agents access to your documents, PDFs, and data – so they can answer questions about YOUR content.

Diagram

Knowledge Flow

📄 Your Documents

💾 Knowledge Base

🤖 Agent

❓ Question

✅ Answer from docs


Quick Start

python
from praisonaiagents import Agent

# Agent with knowledge from a PDF
agent = Agent(
    instructions="Answer questions from the document",
    knowledge=["company-handbook.pdf"]
)

agent.start("What is our vacation policy?")

Supported File Types

python
# Multiple sources
agent = Agent(
    instructions="Answer from all documents",
    knowledge=[
        "handbook.pdf",
        "policies.txt",
        "docs/",  # Entire folder
    ]
)

How It Works

Diagram

Knowledge Retrieval

❓ Question

🔍 Search

📄 Find Relevant

✅ Generate Answer

StepWhat Happens
LoadDocuments are processed and indexed
SearchAgent finds relevant sections
AnswerResponse is generated from found content

Advanced Configuration

  1. Basic – Just Files
    python
    agent = Agent(
        instructions="Answer questions",
        knowledge=["file.pdf"]
    )
  2. Custom Vector Store
    python
    agent = Agent(
        instructions="Answer questions",
        knowledge={
            "sources": ["docs/"],
            "vector_store": {
                "provider": "chroma",
                "config": {
                    "collection_name": "my_docs",
                    "path": ".praison"
                }
            }
        }
    )
  3. With Memory
    python
    agent = Agent(
        instructions="Answer questions and remember context",
        knowledge=["docs/"],
        memory=True  # Remember conversation
    )

Complete Example

python
from praisonaiagents import Agent

# Customer support agent with company knowledge
support_agent = Agent(
    name="SupportBot",
    instructions="""You are a customer support agent.
    Answer questions using the company documentation.
    If you don't find the answer, say so.""",
    knowledge=[
        "faq.pdf",
        "product-manual.pdf",
        "policies/"
    ]
)

# Ask questions about your documents
support_agent.start("How do I return a product?")
support_agent.start("What's the warranty period?")

Use Cases


Best Practices

Start Small

Begin with a few key documents, then expand

Quality Over Quantity

Well-organized documents work better than many messy ones

Keep Updated

Refresh knowledge when documents change

Test Thoroughly

Verify the agent finds correct information


Next: Agent Tasks

Learn how to define and manage agent tasks.