What you will be able to do
- Order the stages of a RAG data pipeline that turns files in a Unity Catalog volume into a queryable AI Search index
- Choose between Databricks-managed and self-managed embeddings for a Delta Sync index, and identify the change data feed prerequisite for syncing
- Trace a request through the RAG chain from query embedding to generation
- Wrap an AI Search index in a VectorSearchRetrieverTool so retrieved chunks enter agent context as a tool result, under a specific identity's grants
Key concept
The chunk table as the hinge of RAG — Every step of a governed RAG system meets at one Delta table of chunks. The data pipeline writes that table, the AI Search index syncs from it, and at request time the query is embedded with the same model that embedded the chunks so the two vectors can be compared.
1.Two halves of a RAG system: the data pipeline and the chain
Retrieval-augmented generation gives an agent knowledge the model was never trained on, such as internal memos, product manuals and policies, by fetching relevant text and putting it into the prompt. It does this in three moves. Retrieval queries a knowledge base with the request. Augmentation combines what came back with the request, usually through a template. Generation passes that augmented prompt to the LLM.
These three moves happen at request time, but they depend on work done long before any user asks anything. A RAG application therefore splits into a data pipeline, which pre-processes and indexes the corpus, and a RAG chain, which runs per request. Evaluation, monitoring and governance sit around both. Most design mistakes come from putting a step in the wrong half: chunking at query time, or embedding with a model that differs from the one the chain uses.
Building the corpus on Unity Catalog adds something an ad-hoc vector store lacks. Because the raw files, the parsed table, the chunk table and the index are all governed objects, the retrieval step can be limited by who is asking. The Databricks RAG overview lists access control as a core benefit: retrieval can be designed to return personal or proprietary information only to the credentials allowed to see it.
Checkpoint 1 of 9· Check yourself
A team's design waits for a user's question to arrive, then splits the relevant documents into chunks and retrieves from those chunks. Based on how a RAG application is split, what is wrong with this design?
Pre-processing and indexing the corpus is the data pipeline's job, and that work is done before any user asks anything. The RAG chain runs per request and only retrieves, augments and generates. Chunking at query time puts the step in the wrong half.
“Data pipeline: Pre-process and index documents, tables, or other data for fast and accurate retrieval.”Source: docs.databricks.com
Sources1
2.The data pipeline: from volume files to a chunk table
The pipeline is a fixed sequence, and each stage writes the input the next stage reads:
- Ingest the raw sources and store them in a target table, so the original data stays preserved, traceable and auditable.
- Parse the files into clean text. On Databricks,
ai_parse_documentproduces structured output from documents, and parsing is also where headers, footers and other noise are stripped. - Chunk the parsed content into rows.
ai_prep_searchaccepts eitherai_parse_documentoutput or plain text and markdown, splits it into semantic chunks, and adds document-level context such as the title, section headers and page references to each chunk. - Embed each chunk with an embedding model, which turns the text into a vector that captures its meaning.
- Index the chunk table in AI Search so the chain can run similarity search against it.
How to split a document is a separate decision; see Chunking strategy matched to document structure. What matters for pipeline design is what chunking produces: rows in a governed Delta table, each with a primary key, the chunk text, and metadata columns such as source document name or section heading. Those rows are the only thing the index ever sees. Metadata that is not stored on the chunk row cannot be filtered on or returned at retrieval time. That is why metadata belongs alongside the chunks themselves and not in a separate lookup.
The embedding step has one constraint that the RAG chain depends on later. Whatever model embeds the chunks must also embed every query. Its token limit matters as well: a chunk longer than the model's maximum is truncated before embedding. bge-large-en-v1.5, for example, stops at 512 tokens, and anything past that never reaches the vector.
Checkpoint 2 of 9· Put it in order
Your raw PDFs have just landed in a Unity Catalog volume. Put the data pipeline stages in the order that turns them into something the RAG chain can search.
- 1.Ingest the raw source files and store them in a target table so the originals stay traceable and auditable
- 2.Embed each chunk with an embedding model to get a vector that captures its meaning
- 3.Build the AI Search index on the chunk table so the chain can run similarity search against it
- 4.Split the parsed text into chunks, stored as rows of a Delta table with a primary key and metadata columns
- 5.Parse the files into clean text, removing noise such as headers and footers
Each stage writes the input that the next stage reads. Chunking happens in the pipeline, before embedding, and the index is built on the chunk table. It is never built straight from the volume, and chunking never waits until query time.
“After chunking your data, the next step is to convert the text chunks into a vector representation using an embedding model.”Source: docs.databricks.com
Checkpoint 3 of 9· Exam question
A context engineer is designing a RAG pipeline that must retrieve chunks from a Unity Catalog-governed document corpus and inject them into an agent's context. The source PDF files already exist in a Unity Catalog volume and have been parsed into plain text. What is the correct order of the remaining pipeline stages?
Correct answer: A — Store the parsed text in a Delta table, chunk the text, build an AI Search index from the chunked table, then retrieve and inject chunks into the agent's context
- A. Correct. The standard RAG pipeline flow on Databricks is source ingestion into a Delta table, chunking the stored text, building an AI Search index from the chunked table, and then retrieving and injecting matching chunks into the agent's context at query time.
- B. Incorrect. AI Search indexes are built from Delta tables, not directly from a UC volume, and chunking must happen before indexing so each indexed row corresponds to a retrievable chunk rather than being computed after the fact.
- C. Incorrect. Chunking must operate on parsed text, not raw PDF bytes, and embeddings for retrieval are produced by an embedding model tied to the index, not by the LLM used for response generation.
- D. Incorrect. Retrieval must occur before generation so the retrieved chunks can ground the response; indexing the agent's own output after the fact does not build a corpus the agent can query for answers.
3.Creating the index: Delta Sync, embeddings and the change data feed
An AI Search index serves real-time similarity search over a source table, which can be a Delta Lake table, a streaming table, or a managed Iceberg v3+ table. For a governed RAG corpus, that source is the chunk table, and a Delta Sync index keeps the index aligned with it. A Direct Vector Access index is the other type. It does not sync from a source table, so it is not the way to make new chunk rows appear.
A Delta Sync index on a standard endpoint has a prerequisite that is easy to miss: the source table must use a change data feed. Tables with row tracking enabled get one automatically, and both Delta Lake and Iceberg v3+ managed tables qualify. Without it, a team can enable continuous sync, insert new chunk rows, and see none of them in the index. The fix is the table property. Changing the index type or moving data into a volume does not help. Creating the index also requires CREATE TABLE on the schema where the index will live.
The embedding decision splits Delta Sync indexes in two. With Databricks-managed embeddings, you point the index at a text column and an embedding endpoint, either a pre-configured Foundation Model APIs endpoint or your own model serving endpoint, and Databricks computes the vectors. With self-managed embeddings, you compute the vectors yourself and store them in a column of the source table, and the index uses them as they are. A team with a proprietary in-house embedding model that wants those exact vectors indexed should choose self-managed embeddings on a Delta Sync index. Choosing managed embeddings would recompute the vectors with a different model.
| Option | Index types | Where vectors come from | What the retriever must be told |
|---|---|---|---|
| Databricks-managed embeddings | Delta Sync | Databricks computes them from a text column using an embedding endpoint | Index name only; embeddings are handled for you |
| Self-managed embeddings | Delta Sync or Direct Vector Access | Precomputed vectors you supply, held in an embedding column | text_column plus the embedding model (embedding or embedding_model_name) |
Databricks only knows which model made the vectors when it computed them itself. With self-managed embeddings, the query has to be embedded by the same model that created the index vectors, so you name that model on the retriever. A different model would produce vectors that can't be compared with the stored ones.
Checkpoint 4 of 9· Check yourself
Continuous sync is turned on for a Delta Sync index on a standard endpoint, but chunk rows inserted into the source table never appear in search results. What fixes this?
On a standard endpoint, a Delta Sync index can only follow a source table that has a change data feed, and row tracking provides one automatically. Direct Vector Access does not sync from a table at all, and indexes are not built from volumes.
“For standard endpoints, the source table must use a change data feed.”Source: docs.databricks.com
Checkpoint 5 of 9· Check yourself
Your in-house embedding model has already written a vector for every chunk into a column of the chunk table. You want exactly those vectors searched, and you want the index to follow the table. Which setup is correct?
Delta Sync supports self-managed embeddings and uses the precomputed vectors as they are. Because Databricks did not compute those vectors, the retriever must name the embedding model so that queries are embedded with that same model.
“Delta Sync indexes using self-managed embeddings, you must configure the VectorSearchRetrieverTool and specify a custom embedding model and text column”Source: docs.databricks.com
Checkpoint 6 of 9· Exam question
A data science team already computes embeddings for their documents using a proprietary in-house model and wants the RAG pipeline's AI Search index to use those exact vectors, without Databricks recomputing them from a specified embedding model. Which index configuration should they use?
Correct answer: A — Self-managed embeddings, storing the precomputed vectors as a column in the source Delta table so they sync to the index
- A. Correct. Self-managed embeddings let the team supply precomputed vectors as a column in the source Delta table, and the index syncs those vectors as-is instead of computing new ones.
- B. Incorrect. Databricks-managed embeddings compute vectors from a specified embedding model at index time, which is exactly what the team wants to avoid since they already have their own vectors.
- C. Incorrect. Delta Sync is a synchronization mode, not an embedding source; whether vectors are recomputed depends on the embedding configuration (managed vs. self-managed), not the sync mode itself.
- D. Incorrect. Genie spaces are a natural-language-to-SQL interface over tables and do not control how an AI Search index sources or stores embedding vectors.
Checkpoint 7 of 9· Exam question
A team configures an AI Search index in Delta Sync (continuous) mode on a standard endpoint so the index automatically reflects new rows added to the source Delta table. After enabling sync, newly inserted rows are not appearing in the index. What is the most likely missing prerequisite?
Correct answer: A — Change Data Feed has not been enabled on the source Delta table
- A. Correct. Delta Sync on standard endpoints requires Change Data Feed to be enabled on the source Delta table so the index can detect and pull in row-level changes automatically.
- B. Incorrect. Delta tables and UC volumes are distinct object types; a Delta table is never "converted" into a volume, and AI Search indexes are built from Delta tables directly.
- C. Incorrect. The scenario states Delta Sync was already selected; Direct Vector Access is a different, manual-update mode and is not the cause of a Delta Sync index failing to pick up changes.
- D. Incorrect. Embedding model endpoints are configured on the AI Search index itself, and Genie spaces are unrelated to AI Search index synchronization.
4.The RAG chain at request time
Once the index exists, every user request runs through the same chain of steps. The chain is where the pipeline's choices either pay off or break.
The steps run in this order:
- Optional query preprocessing rewrites the request, wraps it in a template or extracts keywords, producing a retrieval query.
- Retrieval embeds that query with the same model that embedded the chunks, compares it against the chunk vectors by a measure such as cosine similarity, and returns the top-ranked chunks.
- Prompt augmentation places the retrieved chunks next to the request in a template that tells the model how to use each part.
- Generation runs the LLM on the augmented prompt, so the answer is grounded in the retrieved text.
- Optional post-processing adds citations or applies business rules to the output.
Two settings in this chain directly shape what enters the model's context: how many chunks retrieval returns, and how the template combines them with the query. Too few chunks and the answer is missing facts. Too many and the prompt fills with loosely related text. Guardrails can be applied at any step, including a permission check before a data source is touched, and that check is what keeps a governed corpus governed at request time.
Checkpoint 8 of 9· Match them up
Each action below happens while one user request runs through the RAG chain. Match each step of the chain to the action that belongs to it.
Tap a term, then the definition that fits it.
Retrieval embeds the query with the same embedding model used in the data pipeline, so the query vector can be compared with the chunk vectors. It does not use the generation LLM. Augmentation then combines the chunks with the request in a template, and generation runs the LLM on that augmented prompt.
“the retrieval query is translated into an embedding using the same embedding model that was used to embed the document chunks during data preparation”Source: docs.databricks.com
Sources7
5.Exposing the index to an agent as a retriever tool
In a fixed RAG chain, retrieval always runs. An agent instead calls retrieval as a tool when it decides it needs to. Databricks recommends AI Bridge for new Python agents: VectorSearchRetrieverTool, from databricks-langchain or databricks-openai, wraps an AI Search index as a tool. The tool's name and description are what the model reads to decide when to search, so the description should say what the corpus covers.
from databricks_langchain import VectorSearchRetrieverTool, ChatDatabricks
from langgraph.prebuilt import create_react_agent
vs_tool = VectorSearchRetrieverTool(
index_name="catalog.schema.my_databricks_docs_index",
tool_name="databricks_docs_retriever",
tool_description="Search Databricks documentation to answer product questions.",
)
print(vs_tool.invoke("What is Databricks Agent Framework?"))
agent = create_react_agent(
ChatDatabricks(endpoint="databricks-claude-sonnet-4-5"),
tools=[vs_tool],
)Injection into context happens through the tool result. When the model emits a tool call, the agent loop runs the retriever and appends the returned documents to the message history as a tool message tied to that call's ID. The model then sees the chunks on its next turn. Without a framework, the loop does this explicitly:
args = json.loads(call.function.arguments)
documents = dbvs_tool.execute(**args, openai_client=client)
print(documents)
messages.append({
"role": "tool",
"tool_call_id": call.id,
"content": json.dumps(documents),
})The tool's parameters control how much of each chunk row reaches context and how the search runs:
| Parameter | What it controls |
|---|---|
| index_name | Three-part name catalog.schema.index of the index to query |
| num_results | Maximum number of documents returned into context |
| columns | Which chunk-table columns come back with each result |
| filters | Conditions applied to the query, such as on metadata columns |
| query_type | "ANN" or "HYBRID" |
| tool_name / tool_description | What the LLM reads to understand the purpose of the tool |
| text_column / embedding | Required for direct-access indexes or Delta Sync with self-managed embeddings |
A custom retriever, for example one that queries an external index through a Unity Catalog connection, should return a list of MLflow Document objects with page_content and metadata. That shape follows the MLflow retriever span schema, so evaluation and review tools can recognise which chunks were retrieved for each request.
The retriever always runs as some identity, and that identity's grants decide which chunks it can reach. Querying an index owned by another user requires additional privileges. A tool that reads files directly from a volume needs USE CATALOG, USE SCHEMA and READ VOLUME granted to the agent's identity. The full design of that boundary is covered in UC privileges as the agent's retrieval boundary. For pipeline design, the consequence is concrete: an agent can only retrieve and inject what the identity it runs as is allowed to read.
Checkpoint 9 of 9· Fill the gap
In this agent loop, written without a framework, the model has just asked to search the index. Which role must the appended message have so the retrieved chunks reach the model's context as the result of that call?
args = json.loads(call.function.arguments)
documents = dbvs_tool.execute(**args, openai_client=client)
print(documents)
messages.append({
"role": " ? ",
"tool_call_id": call.id,
"content": json.dumps(documents),
})The agent loop runs the retriever and appends the documents to the message history as a tool message tied to the call's ID. The model sees the chunks on its next turn as the result of its own tool call. They are not added as a new system instruction or as user input.
Sources
(7)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“Data pipeline: Pre-process and index documents, tables, or other data for fast and accurate retrieval.”
↩︎ Two halves of a RAG system: the data pipeline and the chain“The retrieval step can be designed to selectively retrieve personal or proprietary information based on user credentials.”
↩︎ Two halves of a RAG system: the data pipeline and the chain - 2.https://docs.databricks.com/aws/en/agents/tutorials/ai-cookbook/quality-data-pipeline-ragOfficial docs
“As a best practice, raw source data should be ingested and stored in a target table.”
↩︎ The data pipeline: from volume files to a chunk table“Storing metadata alongside chunked documents or their corresponding embeddings is essential for optimal performance.”
↩︎ The data pipeline: from volume files to a chunk table“For example, bge-large-en-v1.5 has a maximum token limit of 512.”
↩︎ The data pipeline: from volume files to a chunk table“The retrieval query will be transformed at query time using the same embedding model used to embed chunks in the data pipeline.”
↩︎ Key concept“After chunking your data, the next step is to convert the text chunks into a vector representation using an embedding model.”
↩︎ Checkpoint - 3.
“It accepts either the structured output of ai_parse_document or plain text and markdown STRING content.”
↩︎ The data pipeline: from volume files to a chunk table“the function splits content into semantic chunks, enriches each chunk with document-level context such as the document title, section headers, page references”
↩︎ The data pipeline: from volume files to a chunk table - 4.
“For standard endpoints, the source table must use a change data feed.”
↩︎ Creating the index: Delta Sync, embeddings and the change data feed“Tables with row tracking enabled use a change data feed automatically, without requiring manual configuration.”
↩︎ Creating the index: Delta Sync, embeddings and the change data feed“To create an AI Search index, you must have CREATE TABLE privileges on the catalog schema where the index will be created.”
↩︎ Creating the index: Delta Sync, embeddings and the change data feed“If you choose to have Databricks compute the embeddings, you can use a pre-configured Foundation Model APIs endpoint”
↩︎ Creating the index: Delta Sync, embeddings and the change data feed“To query an index that is owned by another user, you must have additional privileges.”
↩︎ Exposing the index to an agent as a retriever tool“Supported source types include Delta Lake tables, streaming tables, or managed tables using Iceberg v3 or above.”
↩︎ Exam trap 1“For standard endpoints, the source table must use a change data feed.”
↩︎ Exam trap 2“Supported source types include Delta Lake tables, streaming tables, or managed tables using Iceberg v3 or above.”
↩︎ Prediction - 5.
“self-managed embeddings (where you pass precomputed vectors directly)”
↩︎ Creating the index: Delta Sync, embeddings and the change data feed“the column containing precomputed embedding vectors”
↩︎ Creating the index: Delta Sync, embeddings and the change data feed“Self-managed embeddings (Delta Sync or Direct Vector Access index with precomputed vectors)”
↩︎ Exam trap 3 - 6.
“Use the same embedding model that created the index vectors.”
↩︎ Creating the index: Delta Sync, embeddings and the change data feed“Use VectorSearchRetrieverTool from databricks-langchain or databricks-openai to expose an index as an agent tool.”
↩︎ Exposing the index to an agent as a retriever tool“Create a retriever tool and give it a description that tells the agent when to search.”
↩︎ Exposing the index to an agent as a retriever tool“Return a list of Document objects with page_content and metadata”
↩︎ Exposing the index to an agent as a retriever tool“USE CATALOG, USE SCHEMA, and READ VOLUME”
↩︎ Exposing the index to an agent as a retriever tool“Use the same embedding model that created the index vectors.”
↩︎ Exam trap 4“Delta Sync indexes using self-managed embeddings, you must configure the VectorSearchRetrieverTool and specify a custom embedding model and text column”
↩︎ Checkpoint - 7.https://docs.databricks.com/aws/en/agents/tutorials/ai-cookbook/fundamentals-inference-chain-ragOfficial docs
“the retrieval query is translated into an embedding using the same embedding model that was used to embed the document chunks during data preparation.”
↩︎ The RAG chain at request time“determining how many chunks to retrieve in step 2”
↩︎ The RAG chain at request time“checking user permissions before accessing data sources”
↩︎ The RAG chain at request time“the retrieval query is translated into an embedding using the same embedding model that was used to embed the document chunks during data preparation”
↩︎ Checkpoint