Skip to main content
Retrieval-augmented generation (RAG) grounds an answer in the documents stored in a knowledge base. AutoSage searches at query time, gives the model only the most relevant passages, and returns source metadata with the answer.

Retrieval boundaries

Every knowledge base has an isolated retrieval boundary. A search is always executed against the knowledge base selected for the chat or agent, so passages from another knowledge base are not mixed into the result.
Tenant isolation controls who can reach a knowledge base; the knowledge-base partition controls what can be retrieved. See Tenancy for the full hierarchy.

From question to source

1

Discover available data

The runtime receives a short preview of processed document summaries and connected data. This helps it decide what to search without placing the full corpus in the prompt.
2

Form a search

In Deep mode, the agent decides when and how to search. It can refine the query and search more than once as it learns from earlier results.
3

Retrieve passages

AutoSage embeds the search query and finds the most semantically relevant passages in the knowledge base’s private partition.
4

Organize context

Results are deduplicated, grouped by document, and can be expanded to nearby pages when more context is useful.
5

Answer with citations

The passages return to the agent as tool results. The final response uses them as evidence and includes source references.
Quick mode uses a direct, single-pass retrieval path. Deep mode can repeat the lifecycle until it has enough evidence or reaches the run’s step limit. See Agent runtime.

Search filters

The retrieval tool can narrow a search when the model or your query already identifies the likely source:
FilterUse
DocumentSearch one document by identifier
FilenameFocus on a named source
PageRetrieve a specific page or page range
File typeLimit results to a document format
Source objects carry enough metadata to present useful citations, including the document identifier, filename, and page information when the source format provides it.

Connected databases

In Deep mode, connected databases complement document RAG. The agent can inspect available tables, run read-only SQL, and build charts from query results. Database results remain a separate tool result from document passages, so your client can present each source type appropriately.

Empty knowledge bases

A new knowledge base with no processed documents returns no passages. The runtime is told that there is nothing available to search, so it can answer from general reasoning when appropriate or ask for source documents.
Only documents with a processed status are searchable. Wait for ingestion to finish before evaluating retrieval quality.

Improving retrieval quality

Upload the original, well-titled source files instead of pasting very large blocks of text into a prompt. Clear headings, meaningful filenames, and focused sections give the ingestion pipeline better boundaries for chunking and retrieval.
For document processing details, see Ingestion lifecycle and the upload guide.

Next steps

Knowledge bases

Organize source documents, connected data, prompts, and agents.

Agent runtime

Understand the multi-step tool loop around retrieval.