Build a Grounded Service Agent
Learning Objectives
After completing this unit, you’ll be able to:
- Create an agent action that contains the prompt template.
- Build an agent that answers questions using Case knowledge.
- Test your agent with questions.
Subagents and Actions
In this unit, you create a service agent that uses the prompt template to respond to customer inquiries. You create subagents and actions for the agent. Let’s use a home renovator as a metaphor to explore these concepts.
Home renovators have a variety of jobs they can do, and different tasks for each job. For agents, the jobs are called subagents and the tasks are called actions.
|
Jobs (Subagents) |
Tasks (Actions) |
|---|---|---|
Home Renovator |
Design kitchen layout |
|
Agent |
Answer questions with Case information |
Answer Questions with Case Data agent tool |
Create an Agent Action
First, create an agent action containing the Answer Questions with Case Data prompt template. You add this action to an agent later so the agent can answer questions about toaster ovens using Case data.
- Select the gear icon and launch Setup.
- In the Quick Find box, search for and select Agentforce Assets.
- Select the Actions tab.
- Select New Agent Action.
- For the Reference Action Type, select Prompt Template.
- For the Reference Action, select the Answer Questions with Case Data prompt template. If you don’t see your prompt template, make sure it’s active.
- Make sure the Agent Action Label is Answer Questions With Case Data and the API Name is Answer_Questions_with_Case_Data, then click Next.
- For Agent Action Description, enter:
Answer questions that customers have about product issues. Use the provided customer cases, where the description and subject tell you what is going wrong, or how the customer is struggling. For example: “What are some common issues with the toaster oven?”These instructions describe what the action does and when to use it in a conversation.
- Ensure that Show loading text for this action is enabled.
- For Loading Text, enter
Getting an answer…This will be displayed in the chat window when your agent is formulating its response.
- Under Inputs, fill in the required fields.
- For RetrieverIdOrName Description, enter:
Use the retriever that is hard coded in the prompt template.
- For Query Description, enter:
A string created by generative AI to be used in the Case search. - Under Query, enable Collect data from user.
- For Citation Mode Description, delete the default text and enter:
Do not generate citations. - Leave all other defaults in Inputs.
- Under Outputs, for the Prompt Response, enable Show in conversation.
- Leave all other defaults and select Finish.
Create a Service Agent
Next, create a service agent that contains the Answer Questions with Case Data tool.
- From the App Launcher, search for and select Agentforce Studio.
- Select New Agent.
- In the “What do you want your agent to do?” text box, enter:
This AI agent works for a company that sells toaster ovens. The agent's job is to answer questions that customers have about product issues. Use the provided customer cases, where the description and subject tell you what is going wrong, or how the customer is struggling. For example: “What are some common issues with the toaster oven?”
- Select the send icon.
- For the Agent Name, enter
Toaster Service Agentthen tab to the next field, Developer Name.
- Ensure that the Developer Name is
Toaster_Service_Agent.
- Leave New User selected. Click Let’s Go.
- Select Skip Ahead.
- In the Explorer tab, hover over Subagents and select the + button.
- Select Create subagent.
- Enter
Answer Questions with Case informationas the Subagent Name and Description.
- Select Create and Open.
- Under Reasoning Instructions, enter:
Answer questions about toaster ovens.
- Under Actions Available for Reasoning, choose Add Action.
- Select Add from Asset Library, then choose Select on Answer Questions with Case Data. There may be actions with similar names, so make sure you select the right action.
- Select Add to Agent.
- Select the Agent Router subagent.
- Under Actions Available for Reasoning, delete all other actions and only leave
go_to_Answer_Questions_with_Case_information.
- Select Save.
- Select Preview to open the chat window with your new agent.
Test Your Agent
In the chat window, ask a question to test your agent. Here are some questions you can ask.
What are some common product issues with toaster ovens?Why does my toaster oven not start?Why does my toaster oven catch fire?

Notice how the answer is not a generic answer about all toaster ovens. Instead, it reflects information from Case Subject and Description fields. It’s easy to see how the LLM response is grounded in data you ingested. You can see the agent’s reasoning process in the Interaction Details window.
You can also try questions your agent can’t answer.
How many toasters have you sold in the last year?-
Why did the chicken come before the egg?
Your agent should redirect the customer and should not make up a hallucinated answer.
Activate Your Agent
Once you’re done chatting with your agent, commit and activate it so it can be deployed to channels.
- Select Commit Version, then Commit.
- Select Activate, then Activate again.
Now your agent’s ready to be used by customers. Learn more in Agentforce Deployment: Quick Look.
Next, learn about RAG best practices.
