Ground a revenue agent on Data 360 golden records — activate the retriever, wrap it in an Agentforce Data Library, build the revenue-context flow and next-best-offer prompt, give users Data 360 access, publish the Revenue Assistant, and test it
The last mile of the golden-record RAG pipeline. Activate the retriever over the account-narrative index, then create a RETRIEVER Data Library with sf agent adl and put ARFPC_<libraryId> in the agent's knowledge block. Build the two actions the agent calls, a Data 360 flow (Get_Account_Revenue_Context) and a prompt template (Next_Best_Offer), to a fixed contract. Grant Data 360 access, then publish and activate the Revenue Assistant example, and test routing, actions and grounded answers.
markdownguidev1W9DJ-BS4Estage: buildtrust: officialservice: agentforceinterface: cliinterface: agent-scriptinterface: yamlground agent on Data 360golden record agentsf agent adl create retrieverARFPC_ library IDGet_Account_Revenue_Context flow contractNext_Best_Offer prompt templateData 360 permission set for agent usersdata space scopepublish revenue agentrevenue agent testsemployee agent Data 360 access
Ground a revenue agent on golden records
Prerequisites:
- the pipeline has run, and
verifypasses (guides/data360/automate-the-golden-record-pipeline.md); - the account-narrative search index is Ready;
- a retriever on it, returning the account name, the narrative and the chunk, is active (
reference/data360/search-indexes-and-retrievers.md).
1. Wrap the retriever in a Data Library
sf agent adl create --source-type retriever --retriever-id <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
- The library is ready at once. Put
ARFPC_<libraryId>in the agent'sknowledge:block. - Day 2:
sf agent adl update --library-id <libraryId> --retriever-id <new ID>swaps the retriever without touching the agent.
2. Build the two actions to this contract
| Action | Implementation | Inputs → outputs |
|---|---|---|
get_account_context → flow://Get_Account_Revenue_Context | An autolaunched flow that reads the golden record's rollup from Data 360. Salesforce's workshop uses a flow with a Data Cloud query for exactly this ("Get Merchant Order Insights") | accountName (text) → revenueSummary (text), lifetimeRevenue (number) |
next_best_offer → prompt://Next_Best_Offer | A Flex prompt template with one text input, Account_Context, instructed to propose one offer and its reasoning from the context only | "Input:Account_Context" → promptResponse |
- Build the flow from the account-level revenue insight (
Revenue_Rollup__cio) joined to the unified account. Return the same narrative text the search index embeds, so a brief and a search result read the same. - Flows and Apex as actions: family 9. Prompt templates: family 6.
- Deploy both before publishing. Publishing doesn't deploy actions (
reference/agentforce/agent-errors.md).
3. Access
| Who | Needs |
|---|---|
| Sellers (the agent is an employee agent and runs as them) | A Data 360 permission set covering the data space, and access to the flow and the prompt template |
| An Einstein Agent User, if you make it a service agent | The same Data 360 access. Salesforce's sf-skills names DataCloudUser, GenieUserEnhancedSecurity or the GenieDataPlatformStarterPsl licence, depending on the org |
Without Data 360 access or data space scope, the knowledge action returns an empty summary and the agent says it found nothing.
Salesforce's own guidance conflicts on default_agent_user here. The sf-skills org-setup reference says employee agents using AnswerQuestionsWithKnowledge with live actions need it. Its agent-design reference says setting it on an employee agent fails publish with "unknown error". The example omits it. If live preview of the knowledge action fails on user context, test that variant in a scratch org before you commit to it.
4. Publish, activate, test
Use the agent in examples/revenue-assistant-agent.md, with your library ID.
sf agent validate authoring-bundle --api-name Revenue_Assistant --target-org dev
sf agent preview start --authoring-bundle Revenue_Assistant --use-live-actions --target-org dev --json
sf agent publish authoring-bundle --api-name Revenue_Assistant --target-org dev
sf agent activate --api-name Revenue_Assistant --version 1 --target-org dev
sf agent test create --spec specs/Revenue_Assistant-testSpec.yaml --api-name Revenue_Assistant_Tests --target-org dev
sf agent test run --api-name Revenue_Assistant_Tests --wait 20 --result-format json --output-dir test-results --target-org dev
# agent-test-spec: Revenue_Assistant_Tests
name: "Revenue Assistant Tests"
subjectType: AGENT
subjectName: Revenue_Assistant
testCases:
- utterance: "Brief me on Acme Corporation"
expectedTopic: account_brief
expectedActions: [capture_account, brief]
expectedOutcome: "A short revenue summary for Acme Corporation using returned figures only"
- utterance: "Which accounts buy like Acme but haven't ordered in six months?"
expectedTopic: find_accounts
expectedActions: [search_accounts]
expectedOutcome: "A list of matching accounts with citations, or a statement that none were found"
- utterance: "What's our churn policy for employees?"
expectedOutcome: "The agent declines and offers account briefs or account search"
- Gate CI on the result file, because failed assertions exit 0 (
guides/agentforce/test-an-agent.md). - Check
generatedData.actionsSequenceon the first run. Whethercapture_account(a@utils.setVariablestool) is listed is the hub's guess.