Sub topic 11
Using an Agentforce Data Library as a shortcut
This chapter assumes you can publish Knowledge articles, know what a Data Cloud search index and retriever are, and understand agent topics and actions. Earlier chapters built these pieces by hand. A Data Library packages most of those steps into one setup flow.
What a Data Library does
An Agentforce Data Library is a managed grounding source. You point it at content, such as Salesforce Knowledge articles or uploaded files. Salesforce then creates the Data Cloud pieces for you: the data stream, the data model objects, the search index, and a retriever. The library can then be attached to an agent's knowledge action.
Library or hand-built retriever
| Need | Data Library | Hand-built retriever |
|---|---|---|
| Fast setup for an agent | Yes | More steps |
| Control over chunking and fields | Limited | Full |
| Custom filters on returned content | Limited | Full |
| Use in a custom prompt template | Not the usual path | Yes |
Use a library when the goal is "let this agent answer from our articles." Build a retriever yourself when you need tuned chunking, specific returned fields, or filters for a prompt template. The options offered in the library setup can vary by release, so check what your org shows.
Set up a library for Knowledge
- Confirm Data Cloud is enabled and the articles you want are published. Run the earlier SOQL check on
Knowledge__kavwithPublishStatus = 'Online'. - In Setup, open Agentforce Data Libraries and create a new library.
- Name it and choose Knowledge as the source.
- Select which articles to include. Narrow the scope here, for example by language or data category, instead of ingesting everything.
- Save. Wait for the ingestion and indexing jobs to finish before testing.
- Open the agent in Agent Builder and add the library to the agent's knowledge settings, so the knowledge action searches it.
Check the result
Open the generated retriever in Data Cloud and run a test query with a known question. If the right article chunk comes back, the library works. If the answer is missing or old, apply the troubleshooting steps from the later chapter: check publish status, the selected scope, and the last index refresh.
Common errors
- Selecting a language or article scope that excludes the content you expect.
- Attaching the library to the agent but not testing after the first index run.
- Assuming sharing rules are ignored. Access still matters for what the agent can return, as the governance chapter covers.
Exercise
Your team wants an agent to answer from published English articles by tomorrow, with no custom filters. Should you use a Data Library or a hand-built retriever, and what should you check before testing?
Show answer
Use a Data Library, because it creates the data stream, search index, and retriever in one flow and attaches to the agent's knowledge action. Before testing, confirm the articles are published (Online), the library's scope includes English, and indexing has finished.