A RAG (retrieval-augmented generation) project answers questions from your own documents. You ingest files or websites into its knowledge base, and the project retrieves the most relevant chunks for each question and answers from them. A RAG project can be called directly through its API, or used as a knowledge source by an agent.
Create a RAG project
- Go to Projects and click New project.
- Under What do you want to build?, choose Knowledge base ("A knowledge base agent", creates a RAG project). The type is fixed once the project is created; a project cannot be converted to another type later.
- Enter a Project name (letters, numbers, hyphens, underscores, dots and colons only) and select the Team.
- Once a team is selected, the LLM, Embeddings and Vector store fields appear. Select the LLM, the model that writes the answers. The list shows the models available to the selected team.
- Select the Embeddings model, the vector encoder used for retrieval.
- Select the Vector store, where the embedded chunks are stored. The stores offered depend on your Tensic instance; pgvector is the default.
- Check the Live spec summary on the right and click Create project.
A RAG project has a Knowledge tab, where you manage the documents. Agent projects do not have this tab. They use a RAG project as their knowledge instead (see "Connect an agent to a knowledge base").
Ingest documents into a knowledge base
The Knowledge tab has a status strip at the top (In the knowledge base: documents, chunks, embeddings model and vector store; Being added; Needs attention) and three sub-tabs: Data, Ingestion and Retrieval.
- Open the RAG project, go to the Knowledge tab and click Ingestion.
- Under Add content, stay on Files and drop your files, or click to browse. Use the URL tab to ingest a single web page once. Supported file types:
.pdf,.docx,.pptx,.xlsx,.xls,.csv,.txt,.md,.html,.xml,.json,.eml,.epuband.odt. - Optionally click Change next to Method and choose the Ingestion Method: Auto (tries Docling, then MarkItDown, then Classic), Docling (deep-learning extraction, best for complex PDFs), MarkItDown (broad format support such as DOCX, XLSX and PPTX) or Classic (basic text extraction). Auto is the default.
- Click Ingest.
- The file appears under Activity and moves from queued to Done. All ingestion goes through a queue, so you can load thousands of documents (for example overnight) as well as a single file. A small file is usually done within a minute, depending on the queue. A finished row shows the number of documents and chunks created and a View in Data link. Use the All, In progress, Failed and Done filters to narrow the list.
Retry a failed ingest
When a file cannot be processed, its Activity row shows Failed with the error message (click the copy icon to copy it) and the note File kept 7 days for retry. The Needs attention box in the status strip counts failed ingests.
- Open Knowledge > Ingestion and find the failed row (filter with Failed).
- Click the retry icon in the Actions column. The file is queued again from the stored copy, so you do not need to upload it again. Consider choosing a different Ingestion Method first if the error came from the extractor.
- Or click the bin icon to remove the row from Activity.
A failed upload can be retried for 7 days. After that, or when the file is no longer stored, upload it again. Only failed rows can be retried.
Through the API, POST /projects/{id}/ingest-bulk/{job id}/retry queues a failed job again and returns 202. It returns 409 when the job did not fail or its file is no longer stored. GET /projects/{id}/ingest-bulk lists the jobs (uploads, URL ingests and sync runs) with status, error_message, retryable and kind (upload or sync), plus counts for each filter.
List and search the documents in a knowledge base
The Data sub-tab lists every document in the knowledge base with its Origin (Upload, URL, or the sync source and its type, for example "news · Web URL"), its number of Chunks and when it was Ingested.
- Open Knowledge > Data.
- Type in Search... to filter by document name, or use Origin to show only uploads, URLs or one sync source.
- Click a column heading to sort. Select rows and delete them, or click the bin icon next to a single document.
- Click Add content to jump to Ingestion.
The list is paged, so it works for large knowledge bases. Through the API, GET /projects/{id}/embeddings/documents returns one page (25 documents by default) with documents (each with source, chunks, ingested_at and origin, an object such as {"kind": "upload"} or {"kind": "sync", "source_name": "news", "source_type": "url"}), total (documents matching the filter), document_count and chunks (the whole knowledge base). Parameters: q (name contains), origin (upload, url or sync:<source name>) and limit.
Test retrieval in the Knowledge workbench
The Test a query panel on the Retrieval sub-tab shows exactly what retrieval returns for a query, before you expose the project to users. It uses the saved Retrieval settings next to it, so change a setting, click Save (a bar shows "1 unsaved change" with Discard and Save), run the same query again and compare.
- In Query, type a question and click Run.
- Retrieved · raw similarity lists the chunks found, each with its document name, a text preview and a similarity score between 0 and 1. Only chunks above the cutoff are shown.
- Answer · full pipeline shows the answer the project gives a real caller, with the model, response time and tokens used. Reranking applies here, not to the raw similarity list.
A low score means the chunk is not really related to the question. In the example, an unrelated question ("What is the weather in Paris today?") retrieves chunks with scores of 0.14 and lower. With a cutoff of 0, the project still passes those chunks to the model, and the model may answer from its own general knowledge instead of from your documents. The answer can then be outdated or invented. The next section shows how to stop that.
Set a score cutoff to fence a RAG project
The Score cutoff is the most important RAG setting. It is the minimum similarity a chunk needs to be used. When no chunk reaches it, the project does not answer from general model knowledge; it returns the Default fallback answer instead. Setting it is called fencing the knowledge base.
Find the right cutoff by testing:
- On the Retrieval sub-tab, ask several questions you know are not covered by your documents, with Score cutoff set to 0. Note the scores. In the example, the unrelated question scored about 0.14.
- Ask questions that are covered and note their scores. In the example, covered questions scored 0.5 to 0.6.
- Choose a cutoff above the unrelated scores and below the relevant ones, for example 0.30.
- Under Retrieval settings, enter it in Score cutoff (0–1; higher is stricter) and click Save. The cutoff is checked against the similarity of each chunk before any reranking.
- Open the Guards tab and set the Default fallback answer, the message returned when no chunk meets the cutoff (for example "I don't know the answer to that. Please contact support.").
- Run the query again in Test a query: with the cutoff above the scores, the list shows no chunks and the answer is the fallback. Then re-test in the Playground or through the API: small talk such as "hi" and off-topic questions get the fallback answer, while questions about the documents are answered.
Fencing cannot be automated reliably, because only you know what is and is not in your documents. Repeat the test whenever you add a lot of new content. For anything customer-facing, such as a website widget, always set a cutoff.
Choose Top-K and rerank
- Top-K (chunks retrieved per query) sets how many of the highest-scoring chunks are used for each question. A higher Top-K gives the model more context and usually better answers, but each extra chunk adds processing, so answers take longer and cost more. Start with a small value such as 4 and change it only when the evals or tests show a need.
- Rerank re-orders the retrieved chunks by relevance before they are used. It has three settings:
- Off: chunks keep their similarity order.
- Reranker model: a dedicated reranking model (a cross-encoder) re-orders the chunks. Select it in Reranker model. It is billed per token and is more accurate than similarity alone. Rerankers are granted to a team like other models; when none is granted to the project's team, only Off and LLM make sense.
- LLM: an LLM re-scores the chunks, at the cost of one extra model call per query. Rerank LLM defaults to the project's own LLM.
- The score cutoff is checked against the similarity before reranking. The scores returned with the sources of a reranked answer are the reranker's rating, not the 0 to 1 similarity (a reranker model rates 0 to 1, an LLM rerank 0 to 10), so test your retrieval again after you change the rerank setting.
Measure the effect of any retrieval change with an eval. RAG projects offer the extra Faithfulness metric. See Run evals and manage prompt versions.
Rank your own documents with the rerank API
An inference project (see Create an inference project) that has a reranker model can rerank any list of texts for your application, without a knowledge base.
- Grant a reranker model to the project's team and set it as the project's
reranker. To offer several rerankers from one project, list more of them inoptions.additional_rerankers(project API,PATCH /projects/{id}). - Call
POST /projects/{id}/v1/rerankwith thequery, thedocuments(strings, or objects withtext), and optionallytop_n,return_documentsandmodel. Withoutmodel, the project's default reranker is used. Amodelthat the project does not serve returns404 model_not_found. - The response lists
resultsbest first, each with theindexof the document in your request and arelevance_score(and thedocumentwhenreturn_documentsis true), plususagewith the cost. The call is billed per input token.
{"query": "return window", "documents": ["Shipping takes 3 days", "Return within 30 days"], "top_n": 1}
This endpoint is served only by inference projects. A RAG project reranks inside its own retrieval, as described above.
Ingest a website and keep it in sync
To index a website and keep the index current, add it as a sync source:
- On the Knowledge tab, open Ingestion, find Sync sources and click Add source.
- Enter a Name for the source, for example
news. - Set Type. Options are Web URL, Amazon S3, Confluence, SharePoint and Google Drive. For a website, choose Web URL and enter the URL.
- Choose the Sync interval: every 15 min, 30 min, hour, 6 hours, 12 hours or 24 hours (the default is every hour).
- Choose the Splitter (Sentence or Token) and Chunk size (for example 512).
- Click Save. Saving commits only this source; the retrieval settings are not changed.
- Turn on Auto-sync on schedule so each source runs on its interval, or click the refresh icon on a source (or Sync all now) to run it immediately.
- If the site needs a login, add the credentials to the source. Credentials are matched to the source by name, so create a new source rather than renaming one.
Each source shows its last result, for example "Synced 3m ago · 1 document, 1 chunk", or the error when the last run failed. Every sync run also appears in Activity with the kind "Sync". The synced content appears in the Data tab, named after the source, with the source as its Origin. Through the API, each source in options.sync_sources reports last_status (syncing, ok or error), last_attempt, last_sync, last_documents, last_chunks and last_error. To be notified when a sync finishes, subscribe to the sync_completed event under Integrations > Event webhooks.
For a one-time import without syncing, use the URL tab under Add content instead.
Connect an agent to a knowledge base
An agent can use one RAG project as its knowledge base. The agent sends its search to the RAG project, which applies its own Top-K, score cutoff and fallback behaviour. This setup is called agentic RAG: the agent decides when to search, and the RAG project handles retrieval.
- Open the agent project and go to the Tools & MCP tab.
- Under Behaviour > Built-in tools, add search_knowledge and click Save.
- Go to the Orchestration tab. In the wiring diagram, click the Knowledge node (add knowledge).
- Under Knowledge edge, select your RAG project in Knowledge source and click Save. The list offers the RAG projects of the agent's team.
- Tell the agent in its prompt what the knowledge base contains and when to use it, for example: "You have access to a knowledge base with invoices. Use the search_knowledge tool to answer questions about them." An agent with many tools may otherwise not know when to search.
- Test in the agent's Playground with a question that only the documents can answer.
You can combine the knowledge base with other built-in tools, such as web search, on the same agent, so it can answer from both your documents and the web.
Search a knowledge base through the API
Use the API to check what a knowledge base returns, for example from a test script. The calls use the same API key as the rest of the project API.
POST /projects/{id}/embeddings/searchwith{"text": "your query"}returnsembeddings, a list of hits ordered by relevance. Each hit hassource(the document name),score,similarity(cosine similarity),idandtext(the chunk's text, so no second call is needed). When an agent answers from a knowledge base, thesourcesof its answer carry the same fields plusknowledge_project(the RAG project that was searched) andtool_call.scoreis the reranker's relevance when a reranker model ordered the hits, otherwise it equals the similarity. The response also names thererankerthat was used, ornull.GET /projects/{id}/embeddings/id/{chunk id}returns the text of one chunk.GET /projects/{id}/embeddings/documentslists the documents (see "List and search the documents in a knowledge base").POST /projects/{id}/embeddings/ingest/textingests raw text with asourcename, andPOST /projects/{id}/questionasks the full pipeline a question.
A sentence copied word for word from a document ranks that document's chunk first, with the default embedding model.
Common questions
Why does my RAG project answer questions that are not in my documents?
The score cutoff is too low (0 by default), so weak matches are used and the model fills in with general knowledge. Raise the Score cutoff and set a Default fallback answer.
How do I find the right score cutoff?
Ask questions you know are not in your documents and note their scores. Then set the cutoff just above the highest of those scores, below the scores of real matches.
Does a higher Top-K give better answers?
Usually, yes, but answers take longer and cost more. Start with a small value such as 4 and adjust based on tests.
Can I add a whole website?
Yes. Add a Web URL source with a Sync interval and turn on Auto-sync on schedule. New pages are indexed on every run.
How long does ingestion take?
Files go through a queue. A single file is usually processed within seconds, and large batches are processed in the background. Follow progress under Knowledge > Ingestion > Activity.
An ingest failed. Do I have to upload the file again?
No. Click the retry icon on the failed row in Activity. The file is kept for 7 days.
How do I see which documents are in the knowledge base?
Open Knowledge > Data. Search by name or filter by origin, or call GET /projects/{id}/embeddings/documents.
Can I use a dedicated reranker model?
Yes. Set Rerank to Reranker model and pick a reranker granted to the team.
Which file types can I ingest?
PDF, Word (.docx), PowerPoint (.pptx), Excel (.xlsx, .xls), .csv, .txt, Markdown, HTML, XML, JSON, .eml, .epub and .odt. Pick the ingestion method under Advanced options; Auto works for most files.
Do agents have a Knowledge tab?
No. Create a RAG project for the documents, add the search_knowledge tool to the agent, and select the RAG project as Knowledge source on the agent's Orchestration tab.
Can I change a project's type to RAG later?
No. The project type is fixed at creation. Create a new RAG project instead.