ARCHITECTURE · RETRIEVAL · 5 MIN READ

Retrieval that can ask a better question

Give the agent a bounded search-and-check loop over your own knowledge.

THE SYSTEM BLUEPRINTCOMPONENTS & DATA FLOW
questionquerycandidatesranked evidencesufficientrefine if neededUser questionScope and permissionsRetrieval plannerChoose query and sourceHybrid searchKeyword + vector retrievalGrounded answerClaims tied to evidenceEvidence checkRelevance + sufficiencyRerankingOrder useful passages
A conceptual architecture. Each connection represents a responsibility to implement and validate.

Build the corpus first

Parse documents, preserve provenance, chunk deliberately, and attach access-control metadata. Create embeddings and a keyword index as needed. Establish a reproducible ingestion path so updates and deletions reach the retrieval layer.

Bound the retrieval loop

The planner selects a query and source. Search returns candidates, a reranker prioritizes passages, and a sufficiency check decides whether to answer or refine. Cap the number of search rounds and return uncertainty when evidence remains incomplete.

Evaluate retrieval and generation separately

Measure whether the right passage was retrieved before evaluating the answer. Include access-filtered searches, exact identifiers, stale documents, and contradictory records. Preserve the selected evidence with the run for inspection.

Keep exploring

How do you know your agent works?Use PostgreSQL and pgvector for agent memoryA context pipeline for a long-running agent