Skip to content
← All guides

Building Agents

MDX

Retrieval-Augmented Agents

How agents search private knowledge, decide what to retrieve, and ground answers in evidence.

4 min readAgentic Systems Editorial Team

Editorial review: clarity, operational relevance, safety boundaries, and source quality.

Retrieval supplies context

A retrieval system finds relevant passages or records at decision time instead of placing an entire knowledge base in the prompt. The agent can search iteratively as its understanding of the task improves.

Retrieval quality begins before embedding. Split material along semantic boundaries, retain document hierarchy, and store metadata for owner, audience, version, validity date, and permissions. A highly similar obsolete paragraph can be more harmful than a slightly less similar current policy.

Search is a tool

Treat retrieval like any other tool with query, filter, and result contracts. Metadata filters, access controls, and source dates are as important as semantic similarity.

Agents benefit from iterative search when the first result changes the vocabulary of the problem. Bound that flexibility with query limits and filters. Log queries, selected passages, and discarded results so a weak answer can be diagnosed as a search, ranking, context, or synthesis failure.

Require evidence

Ask the agent to connect important claims to retrieved sources and to say when evidence is insufficient. Citation correctness needs its own evaluation rather than being assumed from fluent output.

Grounding requires claim-level discipline. Important statements should reference passages that actually entail them, and the response should distinguish source facts from conclusions. Evaluate citation completeness and correctness separately. A citation beside a sentence is not useful if the linked passage discusses only a related topic.

Practical example

Answering an internal leave-policy question

The agent filters documents by the employee's country and employment type, retrieves the current policy plus its effective date, then searches again for a term introduced by the policy. It cites the passages supporting eligibility and approval steps. When two versions conflict and neither is marked current, it reports the conflict and routes the question to HR instead of blending them.

Field checklist

Apply it in practice

  • Chunk with hierarchy and retain governance metadata.
  • Apply access and freshness filters before ranking.
  • Log the full query-to-passage path.
  • Score citation entailment, coverage, and abstention.

Decision framework

Questions to answer before you build

Retrieval quality depends on document preparation, governance metadata, query strategy, and claim-level evidence—not on embeddings alone.

Is the corpus decision-ready?

Preserve hierarchy, effective dates, ownership, audience, and access metadata. Remove or clearly supersede obsolete versions.

Should search be iterative?

Allow a bounded second query when early evidence introduces new terminology or reveals a missing dimension of the question.

What evidence standard applies?

Require important claims to reference passages that entail them, and require abstention or escalation when sources conflict.

Common failure signals

Watch for these warning signs

  • Ranking a semantically similar but obsolete policy above the current one.
  • Passing large retrieved documents without selecting decision-relevant passages.
  • Scoring citation presence without checking whether the cited text supports the claim.

Selected primary references

Continue with the source material

These sources inform the wider editorial perspective for this topic. They are not presented as line-by-line citations for every statement.

↑ Back to top