Skip to main content
Register now for TDX! Join the must-attend event to experience what’s next and learn how to build it.

Build with Agentforce Builder

Create the Agent

The first step in creating a new service agent for Coral Cloud Resorts that can book activities for clients, is supplying some basic information—like what you want the agent to do, agent name, and what kind of access should this agent have.

  1. Click App Launcher Icon to open the App Launcher, then search for and select Agentforce Studio.
  2. Click New Agent. Agentforce Builder opens in a new tab.
  3. In What do you want your agent to do? text box, enter: You are a customer service representative, helping our guests make reservations, update bookings, and navigate all that Coral Cloud Resorts has to offer.
  4. Press Enter/Return.
  5. Enter CC Service Agent as the agent’s Name. The Developer Name auto-populates. Note: It’s very important to enter the Name just as it is in the instructions.
  6. In the Assign a user record to your agent to manage its access section, select Select User.
  7. Click on the Search users… textbox and select EinsteinServiceAgent User.
  8. Click Let’s Go.
  9. Click Skip Ahead.

Skip Ahead highlighted.

Explore Agentforce Builder

Agentforce Builder is broken up into three sections: navigation explorer (1), editor view (2), and the Agentforce Assistant (3).

The Agentforce Builder showing the navigation, editor, and Agentforce Assistant panels.

Navigation Explorer

The navigation explorer (1) is exactly what it sounds like… a place to explore all of the details about your agent. These details include Settings, Topics, Variables, Connections, and Data. These subsections are present for every type of agent.

  • Settings: Includes Agent Details such as the name, role, description, language, and other configuration settings.
  • Topics: Contains the Topic Selector (a core component that determines which topic an agent should use based on user input and conversation history) and the list of associated topics. Every new service agent comes with all of the listed topics you see above. Each topic has its own folder containing topic configuration and actions.
  • Variables: Houses a list of values that can help you control how your agent performs. Variables store and reuse values in your agent’s logic and reasoning, and control how an agent makes decisions.
  • Connections: Contains information on agent connections and channels. Connections are configuration settings that bridge agents to specific user-facing channels (like Messaging, Slack, or Voice), enabling them to interact with customers.
  • Data: Includes a list of sources that this agent can use for knowledge retrieval. For example: an FAQs pdf that’s uploaded to Data 360 that the agent can reference to answer questions.

Note: Feel free to click each of these options in the navigation explorer to learn more.

Editor View

Each time you interact with a navigation explorer option, a tab appears in the editor view (2) allowing you to view the contents of the selection.

The contents can be viewed in Canvas or Script. Canvas view uses the natural language editor to modify the agent. It includes shortcuts for common tasks, including quick actions for adding logic to the agent, and a picker for resources like topics, actions, and variables. Script view is used to write and edit scripts directly, with developer-friendly aids like syntax highlighting, autocompletion, and validation.

Agentforce Assistant

The Agentforce Assistant (3) is always available to help build the agent using plain language. For example: “Update the name of this agent to Coral Cloud Service Agent” or “Create a new topic named Case Management.” The AI assistant might ask clarifying questions to ensure accuracy. The assistant shows the proposed changes and requires user confirmation before implementing any edits.

Create and Customize a Topic

The Coral Cloud Resorts service agent needs a custom topic to help with the management of resort activities (scuba diving, kayaking, hiking, and so on), such as availability, questions, booking, and more. At Coral Cloud Resorts, they call these activities, “experiences.” Time to create a new topic specifically for experience management.

  1. In the Explorer panel, click the plus icon next to Topics.

The Explorer panel showing the plus sign next to topics.

  1. Select Create new topic.
  2. Name the new topic Experience Management.
  3. For Describe the job you want the topic to do, enter This topic addresses customer inquiries and issues related to booking experiences at Coral Cloud Resorts, including making reservations, modifying session bookings, and answering queries about experience details.
  4. Click Create and Open.
  5. Notice that the Experience Management topic tab opens in the editor view.

Note: If you accidentally clicked Create, rather than Create and Open, click the Experience Management folder in the navigation explorer panel, then click the Experience Management topicExperience Management topic to open this topic in the editor view.

  1. Click Save (upper right corner of the screen).

Add Actions to the Topic

Actions are the tools within topics that agents can use to get the jobs done. For example, if a client asks about a topic, what action(s) should the agent produce? If the agent is going to answer questions about experiences (resort activities), the agent needs to be able to pull details about this experience.

  1. With the Experience Management topic tab still open, click Select action in the Actions Available For Reasoning section.

Select action highlighted.

  1. Select +Create a custom action.
  2. Name the new action Get Experience Details.
  3. Add this text to the description section: Provides details about an Experience__c that a user would like more information about.
  4. Click Create and Open.

Note: If you accidentally clicked Create, rather than Create and Open, click the Experience Management folder in the navigation explorer. Then click the Actions subfolder and click the Get Experience Details action to open this action in the editor view.

  1. With the Get Experience Details tab open in the explorer view, select Flow as the Reference Action Type.
  2. For Reference Action, select Get Experience Details.

Reference Action Type and Reference Action selected.

  1. Scroll down to the Advanced Settings for the experienceName Input, and add a check to Require Input to execute action for experienceName.
  2. In the Advanced Settings for the experienceRecord Output, add a check to Show in conversation for experienceRecord.

All necessary checkboxes checked in the Get Experience Details action.

  1. Leave the other options as is, and click Save.

Add an Action to Validate Customer Details

For security purposes, the agent needs to validate that the customer is who they say they are. In this case, the agent validates key contact details such as email and membership number.

  1. In the Explorer panel, click the plus icon next to the Experience Management topic.

Plus sign next to Experience Management topic highlighted.

  1. Select +Create new action.
  2. Name the new action Get Customer Details.
  3. Add this text to the description section: Validate the Customer details by passing their email and memberNumber to see if there is a related contact.
  4. Click Create and Open.
  5. Select Flow as the Reference Action Type.
  6. For Reference Action, select Get Customer Details.
  7. Scroll down to the Inputs and Outputs sections, and add checks to:
    • email input: Require Input to execute action
    • memberNumber input: Require Input to execute action
    • contact output: Show in conversation
  8. Leave the other options as is, and click Save.

Add Two Actions from the Asset Library

If actions have already been created, they can be easily added to the new agent by pulling from the Asset Library. In this case, two actions have already been created and need to be added to the Experience Management topic. Those actions are:

  • Get Sessions: Allows the agent to get individual sessions for each experience.
  • Create Experience Session Booking: Allows the agent to create a new record within Salesforce.
  1. In the Explorer panel, click the plus icon next to the Experience Management topic.
  2. Select Add from Asset Library.
  3. Enter session in the Search actions… input.
  4. Click Select for these two actions:
    • Create Experience Session Booking
    • Get Sessions
  1. Click Add to Agent.

Note: There should now be four actions listed under the Experience Management topic.

  1. Click Save.

Add Instructions to the Topic

The agent now has all of these actions it can execute, but doesn’t know exactly when and how to use them. If only there were something like instructions that could be added to give the agent some context on how to use these actions. Oh wait, there is! Topic instructions tell the agent what to do and how to reply. The Experience Management topic currently has minimal instructions. Use the Agentforce Assistant to help you update these instructions.

  1. In the Explorer panel, click the Experience Management topic Experience Management topic to open this topic’s tab in the editor view.
  2. In the Agentforce Assistant panel on the right, ask the assistant to add these instructions to the Experience Management topic. Remove all current instructions and add the following exact instructions in a numbered list to the Experience Management topic: 1.If a customer would like more information on Activities or Experiences, you should run the appropriate action and then summarize the results with improved readability. Always ensure you know the customer before running this action. 2.If the customer is not known, you must always ask for their email address and their membership number to get their Contact record by running {!@actions.Get_Customer_Details} before running any other actions. 3.If asked to get sessions for the experience use {!@actions.Get_Sessions}. Ask for the Date of the sessions if not provided. Use the Id of the Experience__c from {!@actions.Get_Experience_Details}. Do not use the experience name, this must be an ID.
  3. In the editor view, the assistant highlights exactly what’s being removed (in red) and what is being added (in green). Click Accept All.

Note: There should now be three instructions listed in the Experience Management topic.

Update the Topic Instructions

The first instruction for the Experience Management topic needs to be updated to correctly reference the intended action.

  1. With the Experience Management topic tab still open, highlight the words appropriate action in the first instruction.

appropriate action words highlighted in the first instruction.

  1. Delete the words appropriate action and enter @ to open the Resource Picker.
  2. Click This Agent’s Actions in the Resource Picker to see all action options.
  3. Select the Get Experience Details action. The action is added to the instruction.

Refine the Instructions

AI can even help refine instructions to ensure maximum effectiveness. Like before, what’s being removed is highlighted in red and what’s being added is highlighted in green and requires the user to accept or decline any proposed changes. There are two ways to trigger the assistant to help refine instructions: the sparkles icon when you hover over an instruction, or using the forward slash (/) command.

  1. With the Experience Management topic tab still open, move the cursor over the first instruction and notice the sparkles icon sparkles to the right.
  2. Click the sparkles icon next to any of the three instructions.
  3. If you want to add specific directions for the AI assistant, you can add them here. For now, no need to enter anything—simply press return/enter to have the AI assistant provide a suggestion on how to refine this instruction.
  4. Click Accept Change.

Note: This is generative AI so it won’t provide the same suggestion every time. For example: It’s OK if the three instructions get consolidated into two instructions.

  1. Another way to get AI assistance is through the forward slash command. Enter a forward slash (/) at the end of the second instruction to open the menu to quickly add, configure, and structure agent components. Notice that AI assistance, variables, conditional statements, actions, and more can be added right from this menu.

Change the View

A unique feature of Agentforce Builder is the ability to view elements in Script view. Script view is used to write and edit script directly.

  1. With the Experience Management topic tab still open, click Canvas Canvas toggle highlighted. in the upper right corner of the explorer panel and select Script.
  2. Notice that the view has toggled to Script view with all of the script related to this specific section highlighted. The agent elements can be edited in this view just like in the Canvas view.
  3. Put the cursor at the end of the last instruction and press Enter/Return to create a new blank line. Note: If you can’t find the instructions for the Experience Management topic in the Agent Script, click anywhere in the script and press Command+F or Ctrl+F and enter must be an ID.

Blank line added after the third instruction.

  1. Add an additional instruction: | If asked to book, use the appropriate action. The Contact__c is the contact ID from the {!@actions.Get_Customer_Details}. The Session__c is the ID of the session from the action {!@actions.Get_Sessions}. If multiple sessions are present, ask to select one of the sessions and use that Session as the ID for the Session__c. Prompt for the Number of Guests and use that for the Number_of_Guests__c.
  2. Within the first sentence of the new instruction, replace the words appropriate action with {!@actions.Create_Experience_Session_Booking}.
  3. The instructions in Agent Script should look like this:

Completed instruction in Agent Script with actions added.

  1. Click Save.
  2. Toggle the view back to Canvas.

Note: Notice the new topic instruction reflects the edits that were made in Script view. Data can be edited from the Canvas or Script view.

  1. Click Commit Version and then click Commit Version again to confirm.
  2. Click Activate and then click Activate again to confirm.

Preview the Agent

Agent functionality can be tested at any time during the build. The preview tab gives insight on how the agent builds a plan and executes actions based on user interactions. As interactions happen with the agent, the Interaction Details panel displays exactly what the agent is executing.

  1. Click Preview.

Preview tab highlighted.

  1. In the Describe your task or ask a question… input area, enter this prompt: Can you let me know more about the full moon beach party experience? and press your Return/Enter key.
  2. When asked for email and membership number, enter: I am sofiarodriguez@example.com and my membership number is 10008155. Press your Return/Enter key.
  3. Request to book a session for tomorrow.
  4. Notice the Live Test Mode dropdown at the top of the panel. This means that the agent accesses and can modify actual data in your org during testing. Live Test Mode gets the most accurate test conversation, but any changes the agent makes are real. To test in a safe test environment with no impact to your live data, toggle the Live Test Mode dropdown to Simulate and adjust the context to your specifications.
  5. Click the back arrow back button highlighted to leave Agentforce Builder.

Publish and Update

Publish the web deployment and update the flow.

  1. Click setup icon and click Setup.
  2. In the Setup Quick Find, search for and select Embedded Service Deployments.
  3. Select the ESA Web Deployment.
  4. Click Publish to republish with the latest additions. Note: The deployment can take up to 10 minutes, but no need to wait, proceed to the next step.

Reroute the Flow

Now update the existing flow to route work to the newly created service agent.

  1. In the Setup Quick Find, search for and select Flows.
  2. Click on the Route to ESA flow.

Note: The flow names are in alphabetical order. Click Flow Label ↑ to re-sort the list from Z to A. The Route to ESA flow should now roughly be the ninth flow listed.

  1. Click the Route to ESA component.Route to ESA component.
  2. Update these values in the Set Input Values section:
    • Route To: Agentforce Service Agent
    • Agentforce Service Agent: CC Service Agent

Note: If CC Service Agent doesn’t show up as an option, return to Agentforce Builder for the CC Service Agent and make sure it’s activated.

Route To and Agentforce Service Agent fields adjusted.

  1. Click Save As New Version.
  2. Keep everything as is and click Save.
  3. Click Activate.
  4. Click the back arrow Back arrow highlighted in the Flow Builder. to return to Setup.

Add the Agentforce Agent to the Coral Cloud Site

Lastly, embed the chat component to the Coral Cloud Experience Cloud site.

  1. Click setup icon and click Setup.
  2. In the Setup Quick Find, search and select All Sites.
  3. Click Builder next to the coral-cloud site.
  4. Click the Components widget Components widget.
  5. Search Embedded Messaging and drag and drop the component over the Book an Experience of a Lifetime section. Note: Exact placement is up to you, and it may take a few seconds for the component to appear.
  6. Leave the default settings.
  7. Click Publish in the upper right corner.
  8. Click Publish in the confirmation window.
  9. Click Got It.

View the Agent as a Customer

The big reveal. Time to interact with the new agent.

  1. Click the Experience Builder menu Experience Builder icon.
  2. Select View coral-cloud to open the published coral cloud site. Note: It may take a few minutes for the site to publish. Go ahead and verify the challenge below while you wait for your Experience Cloud site to publish.
  3. Click the Messaging icon messaging icon in the lower right corner to start interacting with the new agent. Wait for the agent to say hi and then try out this prompt:
    • Can you let me know about the Underground Cave Exploration?
    • Reminder: sofiarodriguez@example.com and my membership number is 10008155.
    • Keep answering the agent’s questions and book a session.
  1. While not required, feel free to return to the CRM and find the Underground Cave Exploration session record for the date you selected. You can see that the agent has updated the record with the information you provided.
Note

Agent not responding as expected? Try republishing the Experience Cloud site. The proper connection between the agent and the Experience Cloud site may take a few minutes on initial site publish.

Coral Cloud Resorts now has a shiny new service agent that cannot only answer questions about resort activities, but also book these experiences for clients. Bring on the busy season!

Resources

Condividi il tuo feedback su Trailhead dalla Guida di Salesforce.

Conoscere la tua esperienza su Trailhead è importante per noi. Ora puoi accedere al modulo per l'invio di feedback in qualsiasi momento dal sito della Guida di Salesforce.

Scopri di più Continua a condividere il tuo feedback