Creates a new UnifiedRetriever.
Dependency injection container. All dependencies are optional; the retriever gracefully skips sources whose deps are not provided.
const retriever = new UnifiedRetriever({
hybridSearcher: myHybridSearcher,
raptorTree: myRaptorTree,
graphEngine: myGraphEngine,
memoryManager: myMemoryManager,
rerank: myReranker,
});
Execute a retrieval plan across all enabled sources.
Flow:
The user's natural-language query.
The retrieval plan specifying which sources to query.
Optional topK: numberMaximum number of final results. Defaults to deps.defaultTopK (10).
Unified retrieval result with merged, reranked chunks and diagnostics.
Never — all source failures are caught and reported in diagnostics. The retriever always returns a result, even if empty.
const plan = buildDefaultPlan('moderate');
const result = await retriever.retrieve('How does auth work?', plan);
for (const chunk of result.chunks) {
console.log(`[${chunk.matchType}] ${chunk.relevanceScore.toFixed(3)}: ${chunk.content.slice(0, 80)}`);
}
Unified retrieval orchestrator that executes a RetrievalPlan across ALL available sources in parallel, merges results via RRF, reranks, and feeds back into cognitive memory.
This is the single entry point for ALL retrieval in AgentOS. It replaces the need to call RetrievalAugmentor, QueryDispatcher, CognitiveMemoryManager, and MultimodalIndexer separately.
All source queries are executed with
Promise.allSettledso partial failures degrade gracefully — a failed GraphRAG query does not prevent vector results from being returned.Example
See