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.
Quick Start
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
# Multiple sources
agent = Agent(
instructions="Answer from all documents",
knowledge=[
"handbook.pdf",
"policies.txt",
"docs/", # Entire folder
]
)How It Works
| Step | What Happens |
|---|---|
| Load | Documents are processed and indexed |
| Search | Agent finds relevant sections |
| Answer | Response is generated from found content |
Advanced Configuration
- Basic – Just Files
python agent = Agent( instructions="Answer questions", knowledge=["file.pdf"] ) - Custom Vector Store
python agent = Agent( instructions="Answer questions", knowledge={ "sources": ["docs/"], "vector_store": { "provider": "chroma", "config": { "collection_name": "my_docs", "path": ".praison" } } } ) - With Memory
python agent = Agent( instructions="Answer questions and remember context", knowledge=["docs/"], memory=True # Remember conversation )
Complete Example
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
Customer Support
Answer questions from FAQs and manuals
HR AssistantAnswer policy questions from handbooks
ResearchQuery research papers and reports
DocumentationSearch technical documentation
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.