Skip to main content
RAG enables agents to retrieve relevant information from documents before generating responses, producing accurate, grounded answers with citations.

Quick Start

1

Install

2

Create Agent with Knowledge

3

Get Answer with Citations


How RAG Works

The RAG Process


Agent Methods for RAG

Example: All Methods


Knowledge Configuration

Basic: File List

Advanced: Full Configuration

Configuration Options


Retrieval Strategies

PraisonAI automatically selects the optimal strategy based on corpus size:

Force a Strategy


RAG vs Knowledge vs Memory vs Context

Comparison Table

When to Use What


Agent with Knowledge (Simple)

For small document sets where you don’t need advanced retrieval:

Agent with RAG (Advanced)

For large document sets requiring sophisticated retrieval:

Multi-Agent RAG

Share knowledge across multiple agents:

Supported File Types

Documents

PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX

Text

TXT, CSV, JSON, XML, MD, HTML

Media

Images (with OCR), Audio (with transcription)

Vector Store Backends


Citations

RAG automatically provides source citations:

Citation Modes


Best Practices

Chunk Size

Use 500-1000 tokens per chunk. Too small = lost context. Too large = noise.

Overlap

Use 10-20% overlap to preserve context across chunk boundaries.

Reranking

Enable reranking for large corpora to improve relevance.

Top-K

Start with k=5, increase if answers lack detail.

Troubleshooting

  • Check if documents were indexed: knowledge.stats()
  • Lower the similarity threshold
  • Try different chunking strategy
  • Reduce retrieval_k
  • Disable reranking for faster results
  • Use persistent vector store
  • Increase chunk overlap
  • Use semantic chunking
  • Increase retrieval_k

Knowledge

Document loading and indexing

Memory

Persistent agent memory

Context

Runtime data flow

Quality RAG

Advanced quality patterns