Skip to main content
RAG agents retrieve relevant chunks from your documents before answering, grounding responses in your own knowledge.
The user asks from their documents; the agent retrieves relevant chunks and grounds the reply.
Indexing works but the agent won’t cite your docs? See Knowledge Troubleshooting.
Every stage below is now configurable from KnowledgeConfig after the fields were wired up.

Quick Start

1

Simple Usage

Pass file paths or directories — the agent indexes on first run, then retrieves on each query:
2

With Configuration

Use KnowledgeConfig for vector store, chunking, and reranking:

With a different embedder provider

Set embedder_config to embed with Gemini, Cohere, or a local Ollama model instead of OpenAI.
embedder="openai" is the default and means “no override”. See Knowledge → Use a non-OpenAI embedder for the full guide.

How It Works

For pre-indexed stores, pass vector config via task context or call agent.retrieve("query") directly.

Configuration Options

config={...} now updates the resolved retrieval config instead of replacing it — setting retrieval_k=20, config={"note":"mine"} keeps retrieval_k=20 (previously it silently reset to 5).
If you previously set chunk_size / chunking_strategy / vector_store and relied on the app running, those settings are now active and may require re-indexing to match new chunk boundaries or a different vector store.
Install knowledge extras: pip install "praisonaiagents[knowledge]"

How config= overrides work

config={...} merges on top of the values resolved from KnowledgeConfig fields — it patches individual keys instead of replacing the whole config.

Every knob wired up

Chunking, vector store, retrieval, and reranking are all set from one KnowledgeConfig.
rerank_model must include a provider prefix (e.g. "cohere/rerank-v3"). A bare model name like "rerank-v3" is used as its own provider — set it deliberately or it will not load.

Opting out of automatic context injection

Set auto_retrieve=False to retrieve manually instead of injecting context on every prompt.

Best Practices

Pass sources via knowledge=["file.pdf"] at agent creation — first run indexes, later runs retrieve without re-indexing.
Narrow questions retrieve better chunks than broad prompts like “tell me everything”.
Set vector_store with Chroma path, Qdrant, or Pinecone — avoid in-memory stores for production.
Pair knowledge= with web tools when you need both static documents and real-time data.

Vector Store

Pluggable embedding storage

Knowledge

Sources and retrieval strategies