Skip to main content
La Trailblazer Community sur Slack est maintenant en bêta ouverte. Rejoignez-la et échangez en temps réel. Rejoignez-nous sur Slack

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.
Note

Beginning in April 2026, agent topics are now called subagents. There are no changes to functionality. During this transition, you may see a mix of the new and previous terms in our documentation and UI.

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

  • Take measurements of kitchen
  • Draw a blueprint of design
  • Review and revise with customer

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.

  1. Select the gear icon and launch Setup.
  2. In the Quick Find box, search for and select Agentforce Assets.
  3. Select the Actions tab.
  4. Select New Agent Action.
  5. For the Reference Action Type, select Prompt Template.
  6. 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.
  7. 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.
  8. 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.
  9. Ensure that Show loading text for this action is enabled.
  10. For Loading Text, enter Getting an answer…This will be displayed in the chat window when your agent is formulating its response.
  11. 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.
  1. Under Outputs, for the Prompt Response, enable Show in conversation.
Note

We can’t check input and output settings in the challenge, so be sure to follow every step carefully; pay particular attention to steps 10 and 11.

  1. 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.

  1. From the App Launcher, search for and select Agentforce Studio.
  2. Select New Agent.
  3. 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?”
  4. Select the send icon.
  5. For the Agent Name, enter Toaster Service Agent then tab to the next field, Developer Name.
  6. Ensure that the Developer Name is Toaster_Service_Agent.
  7. Leave New User selected. Click Let’s Go.
Note

Remember that "agent topics" have been renamed to "subagents." However, not all orgs have made this update. If you still see the term "topics" in your org, just know those terms are interchangeable during this transition period.

  1. Select Skip Ahead.
  2. In the Explorer tab, hover over Subagents and select the + button.
  3. Select Create subagent.
  4. Enter Answer Questions with Case information as the Subagent Name and Description.
  5. Select Create and Open.
  6. Under Reasoning Instructions, enter: Answer questions about toaster ovens.
  7. Under Actions Available for Reasoning, choose Add Action.
  8. 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.
  9. Select Add to Agent.
  10. Select the Agent Router subagent.
  11. Under Actions Available for Reasoning, delete all other actions and only leave go_to_Answer_Questions_with_Case_information.
  12. Select Save.
  13. 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?

A chat showing the agent’s grounded and relevant response to the question, “What are some common product issues with toaster ovens?”

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.

  1. Select Commit Version, then Commit.
  2. 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.

Resources

Partagez vos commentaires sur Trailhead dans l'aide Salesforce.

Nous aimerions connaître votre expérience avec Trailhead. Vous pouvez désormais accéder au nouveau formulaire de commentaires à tout moment depuis le site d'aide Salesforce.

En savoir plus Continuer à partager vos commentaires