Data 360 search indexes, retrievers and Agentforce Data Libraries — vector vs hybrid search, chunking and embedding settings, the chunk and index objects, individual retrievers and their returned fields, grounding a prompt template, and wiring a custom retriever into an agent with sf agent adl and the knowledge block
Retrieval on Data 360. A search index (vector or hybrid) chunks and embeds a DMO's text fields, and a retriever queries one index. Covers grounding a prompt template, and the documented way to give an Agent Script agent a custom retriever: a RETRIEVER Agentforce Data Library, the knowledge block with ARFPC_<libraryId>, and AnswerQuestionsWithKnowledge. Plus the APIs, the access agent users need, and failures.
markdownreferencev1QN57-HGCRstage: retrievetrust: officialservice: data360interface: restinterface: cliinterface: agent-scriptsearch indexvector searchhybrid searchchunking strategysection aware chunkingmax tokens 1200Salesforce Embedding V2 SmallSFR-v2-smallchunk DMOindex DMOCase_chunk/ssot/search-indexretrieverindividual retrieverfields to return DirectAttributes RelatedAttributesnumber of resultsdynamic filters/ssot/machine-learning/retrieversPrompt Builder retrieverKnowledge Answers templateAgentforce Data Librarysf agent adl create --source-type retriever--retriever-idrag_feature_config_id ARFPC_knowledge blockAnswerQuestionsWithKnowledgestreamKnowledgeSearchcitations_enabledEinstein Agent User Data Cloud permission setempty knowledgeSummaryretriever not activeretriever:// target
Search indexes, retrievers and Data Libraries
Search index
A search index chunks and embeds text from one DMO. For Case on Subject and Description, Salesforce's Trailhead shows Case_chunk (the text chunks) and Case_index (the index) objects, and about 20 minutes to Ready.
| Setting | Options (from Salesforce's guide) |
|---|---|
| Search type | Vector (semantic) or Hybrid (semantic + keyword). Prefer hybrid for business data: account names, SKUs and order numbers need exact keyword hits |
| Fields | The text fields to chunk. Include the fields the answer must quote |
| Chunking | Section-aware chunking; max tokens (1,200 in the guide); overlap; fields to prepend to each chunk (for example Title) |
| Embedding | Salesforce Embedding V2 Small (SFR-v2-small). Smaller chunks need a model with a smaller supported sequence length |
Structured golden records need text. An index embeds text fields, and a golden record is mostly IDs and numbers. The pipeline therefore writes one narrative text field per golden record, such as "Acme Corp: 14 orders, lifetime revenue 120,400, last order 2026-09-12, top products …". It builds that text from the unified DMO and the revenue insight into a custom DMO, and indexes that field (patterns/golden-record-rag-pipeline-for-revenue.md). The hub's reading: that's the documented index mechanism applied to structured data. Salesforce's guides index text-rich objects such as Case and web pages.
API: GET, POST, PATCH and DELETE on /services/data/v66.0/ssot/search-index[/{name}], per the community plugin. Responses carry runtimeStatus, searchType and sourceDmoDeveloperName. Capture a working index's JSON with GET, and replay it.
Retriever
An individual retriever queries one search index on one DMO.
- Configure: filters (all documents, or field filters), the number of results (20 in Salesforce's example), and the fields to return. Those are
DirectAttributesfrom the DMO andRelatedAttributessuch as the chunk. - Save it, then activate it. An inactive retriever can't be used.
- Build it in Agentforce Studio (Build → Data → Retrievers). The Connect API exposes retrievers at
/ssot/machine-learning/retrieversfor reads. Creating one by API isn't publicly documented; the supported way to move it between orgs is a data kit's AI Retriever component (reference/data360/automation-and-data-kits.md).
Ground a prompt template
Salesforce's Trailhead uses a Knowledge Answers template:
- Replace its placeholder with Insert Resource → Retrievers → your retriever.
- Set search text to
{!$Input:Query}, output fields to the chunk, and a number of results. - Test in Preview with a retriever ID, and check the resolved prompt for chunks.
Calling the template from an agent is a prompt:// action (reference/agentforce/agent-script-actions-and-targets.md).
Give an agent the retriever
Salesforce's documented path for Agent Script is an Agentforce Data Library that wraps the retriever:
sf agent adl create --source-type retriever --retriever-id <active retriever ID> \
--name "Revenue Golden Records" --developer-name Revenue_Golden_Records --target-org dev --json
sf agent adl get --library-id <libraryId> --target-org dev --json # status READY, retrieverId set
A RETRIEVER library is ready at once, with no indexing. Then add the knowledge: block and the action to the agent:
knowledge:
rag_feature_config_id: "ARFPC_1JDXX0000000001AAA"
citations_enabled: True
citations_url: ""
rag_feature_config_idisARFPC_+ the library ID, not the retriever ID.- Subagents call the standard
AnswerQuestionsWithKnowledgeaction (target: "standardInvocableAction://streamKnowledgeSearch"), whose inputs default from@knowledge.*. The full action block, copied from Salesforce's sf-skills, is inguides/data360/ground-a-revenue-agent.md. - The linter also accepts a
retriever://action target, but its inputs aren't documented. Use the Data Library.
Access the agent needs:
- The Einstein Agent User must hold a Data 360 permission set or licence. sf-skills names
DataCloudUser,GenieUserEnhancedSecurityor theGenieDataPlatformStarterPsllicence, depending on the org. - The permission set's data space scope must include the index's data space.
- Without these, every answer is empty.
Failures
| Symptom | Cause → fix |
|---|---|
| Index stuck before Ready | Building takes time (about 20 minutes in Salesforce's example). Poll runtimeStatus, and check the source DMO has rows |
| Exact names and numbers not found | A vector-only index. Use hybrid |
| Answers cite the wrong account | Chunks lack the account name. Prepend the name field to every chunk |
INVALID_REQUEST_STATE: retriever not active / retriever not found / retrieverId is required (sf agent adl create) | Activate the retriever, check the ID (prefix 1Cx or 0pm, per sf-skills), and pass --retriever-id |
unresolved reference @knowledge.rag_feature_config_id | The knowledge: block is missing or misplaced |
Agent always says it has no answer (knowledgeSummary empty) | The agent user lacks Data 360 access or data space scope |
ADL_UNSUPPORTED_SOURCE_TYPE | File operations aren't allowed on a RETRIEVER library |