Retrieval Config • AI Agent SDK
RetrievalConfig: Unified configuration for Agent retrieval behavior.
RetrievalConfig
Defined in the Retrieval Config module.
AI Agent
Unified configuration for Agent retrieval behavior.
This is the SINGLE configuration surface that replaces:
- knowledge_config
- rag_config
Attributes: enabled: Whether retrieval is enabled (default: True if knowledge provided) policy: When to retrieve (auto, always, never) top_k: Number of chunks to retrieve min_score: Minimum relevance score threshold (0.0-1.0) max_context_tokens: Maximum tokens for retrieved context rerank: Whether to rerank results for better relevance hybrid: Whether to use hybrid retrieval (dense + keyword) citations: Whether to include source citations citations_mode: How to include citations (append, inline, hidden)
# Vector store configuration vector_store_provider: Vector store provider (chroma, mongodb, etc.) vector_store_config: Provider-specific configuration collection_name: Collection/index name persist_path: Path for persistent storage
# Embedding configuration embedder_provider: Embedding provider embedder_model: Embedding model name
# Advanced options auto_keywords: Keywords that trigger retrieval in auto mode auto_min_length: Minimum query length for auto retrieval context_template: Template for formatting retrieved context system_separation: Whether to use system prompt separation for safety
Properties
boolNo description available.
RetrievalPolicyNo description available.
intNo description available.
floatNo description available.
intNo description available.
boolNo description available.
Optional[str]No description available.
boolNo description available.
boolNo description available.
CitationsModeNo description available.
Optional[int]No description available.
intNo description available.
boolNo description available.
strNo description available.
boolNo description available.
floatNo description available.
Optional[list]No description available.
Optional[list]No description available.
Optional[str]No description available.
strNo description available.
intNo description available.
intNo description available.
strNo description available.
Dict[str, Any]No description available.
Optional[str]No description available.
strNo description available.
Optional[str]No description available.
Optional[str]No description available.
OptionalNo description available.
frozensetNo description available.
intNo description available.
strNo description available.
boolNo description available.
Methods
Get TokenBudget instance for this config.
get_strategy()Get retrieval strategy based on config and corpus stats.
to_knowledge_config()Convert to Knowledge-compatible config.
to_rag_config()Convert to RAG pipeline config.
should_retrieve()Determine if retrieval should be performed for a query.
Internal & Generic Methods
- from_dict: Create from dictionary.
- to_dict: Convert to dictionary.
Source
View on GitHubpraisonaiagents/rag/retrieval_config.py at line 28