Search and answer from knowledge
Retrieve relevant chunks, tune search quality, and synthesize an answer grounded in stored knowledge.
Search your knowledge collections, inspect the retrieved evidence, and generate an answer grounded in that evidence. You can tune the collection, result count, similarity threshold, ranking method, and parent-context expansion for the question you need to answer.
Before you begin
You must be signed in and have at least one ingested document. For a meaningful result, choose a query whose subject appears in the selected collection. If the configured embedding or language model is unavailable, retrieval or answer generation can fail.
Agent Studio supports three search outcomes:
| Mode | Use it for | Result |
|---|---|---|
| Search | Inspecting evidence directly | Ranked context chunks |
| Augmented prompt | Sending retrieved context to another generation step | A base prompt enriched with context |
| Grounded answer | Answering the query in Agent Studio | An answer with sources, followed by a quality evaluation when available |
The Hybrid Search & RAG interface exposes search and grounded-answer workflows. The augmented-prompt mode is available through POST /api/rag/search.
Search stored knowledge
From Knowledge Base & pgvector RAG Engine, select 2. Hybrid Search & RAG.
The natural-language query field appears with Collection, Top-K, and Min Similarity controls.

Enter a natural-language question, such as What is the onboarding approval process?.
Use terms that distinguish the needed policy or subject. A blank query cannot be submitted.
Choose a specific Collection when you know where the source belongs, or keep All Collections to search the full account-scoped knowledge base. Set Top-K to 3, 5, 10, or 20 chunks.
Use a smaller Top-K for a narrow question and a larger value when the answer may span several sections. The default API result limit is 5.
Set Min Similarity to control which chunks qualify. The API default is 0.2; raising the value favors closer matches but can remove useful context.
Keep Hybrid RRF Ranking selected to combine dense and sparse retrieval. Select Small-to-Big Context when a matching child chunk needs its broader parent context.
Select Search. Review each returned chunk's title, section when present, ranking type, relevance percentage, content, and collection. Use Copy Context Chunk when you need the exact retrieved passage elsewhere.
If no chunk passes the threshold, the result panel reports zero retrieved chunks and suggests ingesting documents or adjusting the threshold.

After reviewing the query and retrieval settings, select Synthesize Grounded RAG Answer. Agent Studio generates an answer with sources and then requests a RAG Triad evaluation.
Review the answer against its cited source snippets. Treat the evaluation as a quality signal, not a substitute for checking consequential facts against the source document.
Run augmented-prompt mode
Use the authenticated POST /api/rag/search operation when an application needs retrieved context inserted into a prompt without generating the final answer. Send augmentPrompt: true, the query, and a base prompt:
{
"query": "What is the onboarding approval process?",
"collection": "employee-handbook",
"limit": 5,
"minScore": 0.2,
"augmentPrompt": true,
"basePrompt": "Answer from the supplied policy context. Identify any missing information.",
"useHybridSearch": true,
"expandToParent": true
}A successful response has mode: "augmented_prompt" and includes the augmented prompt produced from matching context. Set generateAnswer: true instead to request mode: "qa"; when both flags are false, the route returns mode: "search".
Verify search quality
Confirm that the highest-ranked chunks directly address the query and come from the intended collection. For a grounded answer, compare its statements with the listed sources and inspect the RAG Triad results before relying on it.
Troubleshoot search
Next steps
Use Visualize and evaluate RAG quality to inspect embedding clusters and interpret the answer-quality audit, or Manage knowledge documents to review the underlying chunks.