6.1 Agentforce Data Library: Types and Concepts
Key Takeaways
- Creating a data library automatically sets up a Data 360 data stream, data lake and data model objects, a search index, and a retriever.
- Agentforce Data Libraries can be based on Knowledge articles and fields or uploaded files; existing web search libraries are read-only, and custom retriever libraries connect other Data 360 retrievers.
- Agents use a data library through the Answer Questions with Knowledge action, which uses a prompt template to return citation-rich, grounded responses.
- Data libraries require Data 360 and consume Data 360 credits for processing and queries.
- Data library changes made in a sandbox can't be deployed back to production, and uploaded files aren't copied into sandboxes.
6.1 Agentforce Data Library: Types and Concepts
Quick Answer: An Agentforce Data Library connects agents and AI features to trusted unstructured or semi-structured content, such as knowledge articles, uploaded files, and web sources, so responses are grounded in your organization's information. Creating a library automates the Data 360 setup: data stream → data lake object → data model object → mapping → search index → chunking → retriever. Agents use the library through the Answer Questions with Knowledge action.
Why Data Libraries Exist
Long knowledge articles and documents are slow to search, and LLMs can process only a limited amount of text per call. A data library solves this with retrieval-augmented generation (RAG):
- Content is split into chunks.
- Chunks are indexed in a search index.
- At run time, a retriever finds the chunks most similar to the user's question.
- Those chunks are inserted into the prompt, and the LLM generates a grounded answer.
The benefits are accuracy (responses checked against your content), personalization, trust (citations), and efficiency (only relevant chunks use the token budget).
Data Library Types
| Type | Source content | Notes |
|---|---|---|
| Knowledge | Salesforce Knowledge articles and selected content fields | Choose the fields to chunk and turn citations on or off. Libraries update when articles change, such as when new articles are added |
| File upload | Uploaded documents such as PDFs | Add or delete files to update. Files aren't copied into sandboxes |
| Web search | Web sources | Existing web search libraries are read-only: you can view and manage them but can't create new ones. They create a retriever but no search index |
| Custom retriever | Any active retriever you built in Data 360, including an ensemble retriever | Connect more data sources, assign multiple libraries' content through an ensemble, or link companion orgs (Data Cloud One) to home-org libraries |
Retriever name prefixes help you recognize what a custom retriever points to: File_… for uploaded-file indexes, KA_… for Knowledge indexes, and Web_… for web sources.
What Happens When You Save a Library
- A data stream is created.
- Data lake and data model objects are created and mapped.
- The search index is created. This requires the previous steps to be successful and active.
- Chunking begins. Its duration depends on the number, size, and complexity of articles or files and the number of Knowledge fields selected.
- After chunking completes and the index is ready, the retriever is created. Each data library has its own retriever, even when several retrievers point to the same search index.
A status card on the library setup page tracks each stage and links to the underlying Data 360 objects. Statuses:
| Status | Meaning |
|---|---|
| Failed | Not usable. The configuration may be saved, but a retriever wasn't created |
| Not Started | Retriever and search index created, but chunking hasn't started |
| In Progress | Data is being chunked; the library isn't ready |
| Success | Chunking and search index are complete and ready to use |
How Libraries Work at Run Time
- The user's query is added to the prompt template behind the action. That's typically the Answer Questions with Knowledge action, which you can customize with a Knowledge Answers template.
- The template references the library's retriever, which searches the search index for the most relevant chunks.
- The chunks are inserted into the prompt, and the LLM generates a response from the query, the retrieved content, and the instructions.
- The response is checked against the prompt instructions (Salesforce's data library documentation calls this component the Service Planner), and the user receives a contextual answer.
Connecting a library to an agent
- In Agentforce Builder, select a library in the agent's Data section. The Answer Questions with Knowledge action grounds responses with it.
- You can also change or remove a library from a feature's setup. Some features, such as Einstein Service Replies, also use data libraries.
- Answer Questions with Knowledge delivers structured, citation-rich responses grounded in indexed content.
Permissions
| Library type | Access and permissions |
|---|---|
| All | Data Cloud User permission set, with the default data space added, to access the retriever. Prompt Template User to access the hydrated prompt and call the LLM |
| Knowledge | Source articles public and published (IsVisibleInPkb true), visible data categories, Read access to the Knowledge object and indexed fields, and the Allow View Knowledge permission. Agents also need Access Conversation Entries and least-privilege Knowledge object access |
| File | Access to the default data space |
For Service agents, these permissions go on the agent user. For Employee agents, they go on end users.
Sandbox, Billing, and Other Considerations
| Area | Consideration |
|---|---|
| Data 360 prerequisite | Data 360 must be set up to use data libraries |
| Credits | Libraries consume Data 360 credits, such as unstructured data processed when building the index and data queries when retrieving. Check Digital Wallet |
| Sandbox support | Supported in Developer, Developer Pro, Partial Copy, and Full Copy sandboxes. Data 360 sandboxes contain metadata only |
| Files in sandboxes | Files aren't copied. Re-upload them. For Knowledge, confirm articles exist and refresh the related data streams |
| Retrievers in sandboxes | Deactivate and reactivate the retriever (files), or update and revert a Knowledge content field, to sync retriever metadata |
| Deployment | Making data library changes in a sandbox and deploying them to production isn't supported. Recreate the library in the target org |
| Filters | Dynamic pre-filters aren't supported with the Answer Questions with Knowledge prompt template, only static pre-filters. Workarounds include one library per category or brand, or a custom Apex action that passes filter values |
| Companion orgs | Data libraries don't directly support Data Cloud One companion orgs; use a custom retriever library pointing to a home-org retriever |
Scenario Practice
| Scenario | Best answer |
|---|---|
| A Service agent must answer return-policy questions from 300 published knowledge articles with citations | Knowledge-based Data Library + Answer Questions with Knowledge |
| Reps don't see answers from the library in Service Replies | Check Data Cloud User with the default data space, Prompt Template User, and Knowledge access |
| A library shows Not Started | The index and retriever exist, but chunking hasn't begun; wait for In Progress |
| Answers must come from two separate content sets | Build an ensemble retriever and connect it with a custom retriever library |
| A team built a library in a sandbox and wants to deploy it | Not supported. Recreate it in production |
Exam Traps
- A data library isn't just a folder. It's an automated Data 360 retrieval pipeline.
- You can't create new web search libraries today.
- Answer Questions with Knowledge is the link between agents and libraries.
- Unpublished or internal-only articles aren't indexed for Knowledge libraries.
Which sequence best describes what happens when an admin saves a new Knowledge-based Agentforce Data Library?
How does an Agentforce agent use an assigned Data Library to answer questions?
An administrator builds and tests a file-based data library in a sandbox and wants to move it to production with a deployment. What is accurate?
A Knowledge-based library indexes only some of the expected articles. Which article condition is required for the content to be indexed?