All chaptersChapter 3 of 3
Level

03Knowledge / Agentic RAG

Agentic RAG.

How your documents become grounded answers: ingested once, retrieved every time, cited always.

This is our RAG, retrieval-augmented generation: the ground truth everything else stands on.

AThe idea   Introductory

Instead of answering from memory alone, the agent looks things up in your material first.

A general model knows a lot in general. Grounding makes it answer from your specific documents, data and code. When someone asks why last quarter's study settled on that mesh density, the answer has to come from the study itself, not from a plausible guess.

Like a library with a perfect catalog. Every paragraph gets its own catalog card; a question pulls the right three cards, never the whole library.

Step one, before any question

INGEST ONCE your library becomes searchable, ahead of timeYour librarydocs, data, codesplitChunkssmall, self-contained piecesembedEmbeddings0.12 0.87 0.44 ...0.91 0.08 0.35 ...0.27 0.66 0.59 ...0.75 0.31 0.18 ...meaning as numbersstoreIndexnearest-meaning searchsimilar chunks sit closehappens once, ahead of time; every question afterwards searches this index in an instant
Ingested once, searchable forever. Documents are split into chunks, each chunk becomes an embedding (a list of numbers that captures its meaning), and everything lands in an index where similar meanings sit close together.
  1. Split. Every document is cut into chunks: small, self-contained pieces, roughly a paragraph each.
  2. Fingerprint. Each chunk gets an embedding, a list of numbers capturing its meaning, so "thermal limit" and "maximum temperature" land close together.
  3. File. All embeddings go into an index built for nearest-meaning search. Done once, ahead of time.

Step two, every question

RETRIEVE then answer from your sourcesDocsDataCodeRetrievefind passagesQuestionthe askasksGrounded answerfrom your sourcesanswersshows where each fact came from
Answer with the manuals open. The agent retrieves relevant passages from your sources and answers from them, showing where each fact came from.
  1. Take the question. It gets an embedding of its own, the same kind the chunks have.
  2. Retrieve. The index returns the chunks whose meaning sits nearest the question.
  3. Answer with sources. The agent answers from those chunks, and shows where each fact came from.

ExWhen you ask for it

  1. The ask. "What did we decide about mesh density last time?"
  2. The lookup. The agent does not grep and hope: it retrieves the March study, then follows the link from its conclusion to the convergence run that justified it.
  3. What comes back. The decision, the reason behind it, and citations to both the study and the convergence run, so you can check each one.

In plain terms

Answers grounded in your material, with the sources shown.

BHow it works   Intermediate

It retrieves, reads, and can hop across linked facts, so multi-part questions get a connected answer.

Some questions are not in any single document. They are assembled by following links between facts.

MULTI-HOP follow links across your corpusfaint nodes = corpuspatentssim logscodespecsQuestionthe askAfind ABlinked to BCand CAnswergroundedflat search: nearest passagestops short
Multi-hop over your knowledge. The agent follows links between facts across several sources to answer questions that no single document covers.
  1. Retrieve. Find the most relevant passages.
  2. Read. Extract the specific facts needed.
  3. Hop. Follow links from one fact to the next.
  4. Ground. Answer only from the evidence, with citations.

Retrieve

hybrid search
Search the chunk index two ways at once: by meaning (embeddings) and by exact keywords. For example, a question about damping pulls the three chunks that actually cover the damping model, even when they never use the word "damping".

Read

extract facts
Read the passages and extract the specific facts needed. For example, from a long test log it lifts out one number, the measured quality factor.

Multi-hop

follow links
Chain facts across documents to reach the answer. For example, a spec names a material, and the material's own datasheet holds the limit.

Ground

sources only
Answer only from retrieved evidence, with citations. For example, every claim in the answer carries the file and section it came from.

ExWorked example

Answer across documents

Asked whether a material is compatible with a process under a loss limit, the agent finds the material, hops to the process it links to, then to the loss figure in a third source, and answers with all three references, where a single nearest-passage search would have stopped at the first.

retrievereadmulti-hopground

What it gives you

Questions that need several documents get one connected, grounded answer.

CIn depth   Advanced

It uses GraphRAG traversal, hypothetical-document and hybrid retrieval, reranking, and a self-check gate that re-queries when evidence is thin.

Good retrieval is a pipeline over the same chunk-and-embedding index built at ingestion, not a single lookup, and it knows when it does not have enough to answer.

ONE QUESTION, FIVE STAGES then the answer, and a gate that can send it back to the startre-query if the evidence is thin, at most twice,so it can never loop foreverDecomposesplit thequestionRetrieveby keywordand by meaningTraverselinked factsRerankstrongestparagraphsSelf-checkevidenceenough?The answer, once the check passescarrying the paragraphs it used
Agentic RAG: five stages, and a gate that can send it back. RAG is retrieval-augmented generation: the answer is written only from what was retrieved. These are the stages the retrieval really runs, in this order: the question is split, searched by keyword and by meaning at the same time, walked across the facts that link to one another, and cut down to the strongest paragraphs. Only then does the self-check decide whether the evidence is enough, and only then is an answer written.

Hybrid retrieval

keywords + meaning
Combine exact-term and semantic search for better recall.

GraphRAG

traverse links
Follow relationships in a knowledge graph, not just similar text.

Rerank + compress

keep the best
Re-order candidates and keep only the strongest evidence.

Self-check gate

re-query if thin
If evidence is weak, search again before answering.

ExUnder the hood

The self-check gate, on one question

Before answering, the gate scores how well each sub-question is covered by the evidence that survived reranking. A sub-question with thin coverage does not get a guess; it gets a rewritten query and another pass, following references if the wording of the corpus differs from the wording of the ask.

coverage: q1 ok (3 strong passages), q2 thin (1 weak passage)
action: rewrite q2 "loss limit" as "maximum dissipation"
retry: hop from material page to its datasheet, limit found
gate: coverage ok on both, answer with citations

Hybrid + graph
keyword, meaning and linked-fact retrieval combined, so a question finds both the study and the run behind it.
Reranked
the strongest evidence is kept, the rest dropped: a short stack worth reading, not a pile.
Self-checked
if evidence is thin, it re-queries before answering instead of dressing up a guess.

What this buys you: you get answers that are grounded when the evidence is there, and that go back for more instead of guessing when it is not. When this goes wrong you would see a confident answer citing a passage that does not actually support it; the loop catches it by re-reading each cited passage against the claim at the self-check gate and re-querying when the support is not there.

Why it matters

Grounded, or it re-checks. If the evidence is thin, the agent goes back for more before answering.

Try it

1

Watch a two-hop retrieval.

Question: does design D-3 survive its own operating temperature? No single document says.

DecomposeThe question needs two facts: D-3's operating temperature, and the limit of the material it is built from.
Hop 1Retrieve D-3's spec sheet: it operates at up to 70 C.
GapThe spec names the material but not its limit. One fact is still missing.
Hop 2Follow the material reference to its datasheet: the limit is 90 C.
Combine70 C operating against a 90 C limit leaves a 20 C margin.
AnswerYes, with a 20 C margin, citing both documents.

Why flat search stops short

A flat nearest-passage search would have stopped at the spec sheet and shrugged; agentic retrieval follows the graph of references until the question is actually answerable.

That is the whole machine: message, memory, knowledge. Now watch it run at full scale.