Overview
The Agent-first retrieval system provides a unified way to configure how agents retrieve and use knowledge. All retrieval behavior is controlled through theknowledge parameter.
Quick Start
Want Gemini, Cohere, or a local Ollama model instead of OpenAI? See Knowledge → Use a non-OpenAI embedder.
Knowledge Configuration
Full Configuration Options
Using Dict Configuration
Agent Methods
agent.chat() - Conversational Interface
The default method for conversation with automatic retrieval.
agent.query() - Structured Answer with Citations
Returns a structured result with answer, citations, and metadata.
agent.retrieve() - Retrieval Only (No LLM)
Returns context without LLM generation. Useful for conditional retrieval workflows.
Multi-Agent with Shared Knowledge
Multiple agents can share the same knowledge base:Reranking
Reranking reorders retrieved chunks by relevance to the query before the LLM sees them. Turn it on in one line:rerank=True is wired through the agent’s RAG pipeline — earlier releases accepted it without reranking anything.
How to tell it ran:
metadata["reranked"] reports whether a reranker actually ran, not just whether it was requested.
rerank_model, reranked is True only when the knowledge backend declares a reranker, e.g. mem0 configured with {"reranker": {"default_rerank": True, "provider": ...}}.
SimpleReranker scores by keyword overlap — no embeddings. For semantic reranking, set a rerank_model on a backend that supports it. It reads dict hits ("text"), mem0-style hits ("memory"), and SearchResultItem objects.Handling Retrieval Failures
A failed vector-store call returns emptychunks with retrieval_failed=True and an error message on the RetrievalResult — it does not raise. Check the flag before trusting an empty result so a broken store never looks like a genuine no-match. See Detect Retrieval Failures for the full pattern.
Next Steps
- CLI Retrieval Commands - Use retrieval from the command line
- Knowledge Concepts - Learn about knowledge bases
- Memory - Combine with agent memory

