Skip to main content
The knowledge system lets agents retrieve relevant information from PDFs, documents, and text before answering, grounding responses in your own sources.
The user asks about their documents; the agent embeds, searches, and answers from your PDFs and text.

Key Features

Process PDFs, documents, spreadsheets, images, and raw text
Multiple strategies for optimal text segmentation
Vector-based search with optional reranking
User, agent, and run-specific knowledge scoping
Optional relationship extraction and storage
Automatic quality assessment for stored knowledge

Quick Start

1

Level 1 — List of sources (simplest)

Pass a list of files, directories, or inline text and the agent answers from them.
Agent(knowledge=[…]) accepts file paths, directory paths, and inline text — not URLs. Since PraisonAI PR #4004 any http(s):// entry in the list is logged with a warning and skipped instead of silently dropped. To ingest a web page, fetch and pass its text, or download it to a local file first.
AgentTeam(knowledge=…) is not wired yet (PraisonAI #4004) — set knowledge=… on each Agent(...) in the team instead.
2

Level 2 — Dict (inline config)

Use a dict to pick a vector store while still passing sources inline.
3

Level 3 — Config class (full control)

Use KnowledgeConfig for typed control over chunking, retrieval, and reranking.

Use a non-OpenAI embedder

By default your knowledge base embeds with OpenAI. Point it at Gemini, Cohere, Ollama, or any mem0-supported provider by setting embedder or embedder_config.
embedder="openai" is the default and means “no override” — it keeps mem0’s built-in embedder. Any other value (e.g. "gemini") switches the provider.
Pass the provider name to use its default embedding model.
When to use which form. embedder="<name>" is the shortcut when the provider’s default model is fine. embedder_config={"provider": ..., "config": {...}} is the full form — use it to pin a model, set a base URL, or pass provider-specific settings. Set both and they merge: the shorthand fills in provider when the full dict omits it.
Supported providers include openai, gemini, cohere, huggingface, ollama, voyage, and together.

How It Works


Configuration Options

KnowledgeConfig SDK Reference

Full parameter reference for KnowledgeConfig
The most common options at a glance:

Basic Configuration

path is optional. Omit it and data is stored under an absolute per-project directory: <project>/.praisonai/knowledge/chroma. See Knowledge Storage for details.
Set vector_store.provider explicitly and a fallback (e.g. to SQLite) is logged at WARNING level with Retrieval quality may be reduced so you notice it. Rely on the default (no explicit provider) and a fallback stays at DEBUG, because that path is expected (PR #2982).

If your configured backend seems ignored

Configure a mem0 or mongodb vector store on a release before 2026-07-14 and find that searches feel like keyword matching? Your Knowledge instance may have been silently falling back to SQLite. This was a bug (fixed in PR #2982) where the adapter constructors rejected an internal verbose keyword and the resulting TypeError was swallowed. Check which adapter you actually got:
Upgrade to a release built from main after commit 69d7ecf to fix it. An explicitly-configured backend that fails to initialise now emits a WARNING log — no more silent degradation:
The configured backend is honoured on releases built after commit 69d7ecf; before that, the same code silently ran on SQLite.

Advanced Configuration with Graph Store

Choosing Sources and Chunking

Pick a source type, then a chunking strategy that matches your content. The chosen chunker applies to every text source uniformly — no extension bypasses it (since PraisonAI PR #4831).

Chunking Strategies

Document Processing

Supported File Types

  • PDF (.pdf)
  • Word (.doc, .docx)
  • Text (.txt)
  • Markdown (.md)
  • RTF (.rtf)
  • Excel (.xls, .xlsx)
  • CSV (.csv)
  • JSON (.json)
  • XML (.xml)
  • Images (OCR)
  • Local HTML files (.html, .htm)
  • Raw text strings
Any UTF-8 text file — source code (.py, .js, .ts, .go, .rs, .java), config files (.yaml, .toml, .sh, .ipynb, .rst), and suffix-less files like Dockerfile or .gitignore. Content is read and chunked; metadata records the real extension.
All supported UTF-8 text extensions — .txt, .md, .csv, .json, .xml, .html, .htm — are chunked with the configured chunker (respecting chunk_size and chunk_overlap), and the original case is preserved. Behaviour matches every other file type (PDF/DOCX/media via MarkItDown, source files via the unlisted-extension branch). Since PraisonAI PR #4831.
Empty files and non-UTF-8 (binary) files raise ValueError instead of being silently indexed. Since PraisonAI PR #4788.

Indexing a Codebase

Point knowledge=[...] at source files, configs, and suffix-less files — each UTF-8 text file is read and chunked.

Processing Options

Remote URLs are not yet ingested. Knowledge.add(url) raises NotImplementedError("URL processing not yet implemented") and Agent(knowledge=[url]) warns and skips. Download the file first, then add the local path:

Handling indexing failures

Indexing errors are surfaced, not swallowed. When the embedding call fails, the CLI exits non-zero and the Python API raises.
Knowledge.add(source) from Python raises RuntimeError on the first source whose embedding fails. Wrap batch calls in try / except to keep going.
The lower-level ChromaKnowledgeAdapter.add() returns an AddResult instead of raising:
Search degrades gracefully — a failed embedding is logged at WARNING and the call returns an empty SearchResult rather than raising, so an embedding outage cannot bring down the calling agent.

Search Features

Advanced Search Options

Memory Integration

When used with agents, knowledge automatically integrates with memory:

Graph Store Features

Graph stores add relationship extraction and connection queries on top of semantic search.

Configuration

Relationship Queries

Best Practices

Use smaller chunks (100-200 tokens) for precise fact retrieval. Use larger chunks (500-1000 tokens) when answers need more context. Semantic chunking works best for research papers and long-form documents.
Use a different collection_name per knowledge domain (e.g., product_docs, legal_contracts). This prevents cross-contamination and allows targeted filtering by domain.
Add metadata when indexing documents to enable filters= in searches. Filter by category, year, or author to narrow results without changing query text.
Set rerank=True in kb.search() when you need top-quality results. Reranking retrieves more candidates then scores them for relevance — best for Q&A and research assistants.

Example: Research Assistant

Troubleshooting

Async safety

Knowledge search runs on a worker thread when called from an async agent (agent.astart(...) or agent.astream(...)). It never blocks the event loop, so multiple async agents — or an asyncio.gather(...) of tasks — that all query the same knowledge base progress in parallel instead of serialising on the slowest lookup. No user-facing change: the async path automatically dispatches the underlying (synchronous) embedding + vector-store call via asyncio.to_thread.
See Async Safety for the full set of async guarantees.

RAG

Build retrieval-augmented generation pipelines

Vector Store

Store and query embeddings with a pluggable, namespace-aware backend

Async Safety

How knowledge search, memory writes, and the in-memory adapter behave under concurrent tasks