Tutorial: Build a RAG Agent
From product documentation import to retrieval tuning, publish a traceable knowledge Q&A Agent
This tutorial builds a RAG Agent from a set of product documents, focusing on verifying chunking, hybrid retrieval, reranking, citations, and failure diagnostics.
Prerequisites
The current team has embedding and chat models, and optionally a rerank model. Prepare a product document in PDF, Markdown, or DOCX format; a single file must not exceed the site's current upload limit (default 50MB).
Final Result
The Agent answers questions from the documents and returns sources; the retrieval lab explains each result's scores across the vector, full-text, hybrid, and rerank stages.

Step 1: Create a Knowledge Base & Select Models
The embedding model determines the index dimensions, so confirm it before processing documents.
- Create a knowledge base and select the current team.
- Select the
embeddingmodel and optionally arerankmodel. - Use a chunk size of
1000and an overlap of100. - Save.
Step 2: Import & Process Documents
Preview the chunks first to make sure headings, paragraphs, and tables are not cut too finely.
- Select Upload documents and upload the product document.
- After the document enters Pending, select Preview chunks.
- Check the chunk count, overlap length, and text cleaning results.
- Select Start processing and wait until the status becomes Completed.

Step 3: Run the Retrieval Lab
Compare configurations with fixed questions instead of adjusting production parameters by feel.
- Open Hit testing and enter a question with a clear answer in the documents.
- Run vector, full-text, and hybrid retrieval separately.
- Compare result overlap counts, per-stage latency, final scores, and diagnostics.
- Save the best-performing local preset.
- Before selecting Apply to production, confirm at least one hybrid weight is greater than
0.
Step 4: Create & Link the Agent
- Create an Agent and select the
chatmodel. - Link the knowledge base you just created and use
hybrid. - Select Agentic RAG or Naive RAG as the RAG mode.
- Prompt: “answer based only on sources; state uncertainty when no answer can be found”.
- Preview and publish.
Acceptance & Troubleshooting
- Document questions cite the correct documents.
- Unanswerable questions do not produce unsupported claims.
- Retrieval lab diagnostics are empty or explainable.
- Rebuild the index after switching embedding models.
- If recall fails, check Qdrant, PostgreSQL/pg_search, model credentials, and document status.
How is this guide?