Configure an Agentforce Service Agent
Learning Objectives
In this project, you’ll:
- Create an Agentforce Service Agent through guided setup.
- Add a data library to the Service Agent.
- Associate topics and actions to the Service Agent.
- Build custom agent actions with flows.
- Update an existing deployment flow.
Coral Cloud Resorts + Agentforce
Coral Cloud Resorts is known for two things: amazing destination activities and top-notch customer service. Business is booming. Coral Cloud’s customer service agents are busy providing activity recommendations and booking activities for clients. With the busy season upcoming, Coral Cloud Resorts needs to scale its service assistance quickly. If only there was a tool to help. Agentforce to the rescue! An Agentforce Service Agent can assist Coral Cloud clients with experience availability, booking, and more.
Enable Agents, Add a Data Library, and More
Step one of building an agent is enabling all of the required org features.
- Click and click Setup. The Setup page opens in a new tab.
- In the Setup Quick Find, search for and select Einstein Setup.
- Click the Turn on Einstein toggle, and make sure Einstein is On.
- Refresh your browser to reload Setup.
- In the Setup Quick Find, search for and select Agents.
- Click the Einstein Copilot for Salesforce toggle, and ensure it is set to On.
Publish the Experience Cloud Site
The agent is deployed via Coral Cloud’s Experience Cloud site. To prepare for deployment, get the Experience Cloud site ready for the new agent.
- In the Setup Quick Find, search and select All Sites.
- Click Builder next to the coral-cloud site. If a popup appears, click OK.
- Click Publish in the upper right corner.
- Click Publish in the confirmation window.
- Click Got It.
- Click the Experience Builder menu .
- Click Salesforce Setup.
- Refresh your browser to reload Setup.
Create the Agent
The first step in creating an agent is the guided setup. This setup process walks through creating an agent, associating topics, adding a data library, and more. Topics define the range of jobs your agents and copilot can handle. Actions are the tools they can use to get the jobs done. For example, if a client asks about a topic, what action(s) should the agent produce?
- Download and save the Coral Cloud Resort FAQs.pdf to your desktop.
- In the Setup Quick Find, search for and select Agents.
- Click + New Agent. Note: If the New Agent button is not present, refresh the page until the button appears.
- Select Agentforce Service Agent as the type.
- Click Next.
-
Unselect these topics (click the Added button) so that General FAQ is the only remaining topic:
- Case Management
- Account Management
- Reservation Management
- Delivery Issues
- Order Inquiries
- Escalation
- Case Management
- Feel free to review the prebuilt action for the General FAQ topic by clicking See Included Actions. Click Next.
- Change the Name to
CC Service Agent
and ensure the API Name updates to CC_Service_Agent.
- Enter this info for Company:
Coral Cloud Resorts provides customers with exceptional destination activities, unforgettable experiences, and reservation services, all backed by a commitment to top-notch customer service.
- Select EinsteinServiceAgent as the User Agent.
- Before you proceed, double check that the agent name and API name are exactly like they are listed above, then click Next.
- The data library helps ground generative AI responses in defined data sources. Click in the Search for libraries… text box and select +New library.
- Ensure the Library Name is CC Service Agent Library.
- Click Upload Files and select the CoralCloudResortFAQs.pdf file you just downloaded to your desktop. Note: Give the upload a minute or so to complete. If the upload throws an error, refresh the page, retrace your steps, and try the upload process again.
Note: The agent will be able to use this document when answering questions, but it will initially take 20+ minutes for the document to be indexed.
- Click Done.
- Click Create.
Add Custom Topics and Actions
Topics and actions can be created and customized using Agent Builder. Note: It’s not recommended to use the standard query and summarization actions with a public facing agent, so instead use custom actions to interact with the data.
- From the Agent Builder, click New and select New Topic. Note: If the New button does not appear, try toggling the Einstein Copilot for Salesforce on the agent setup page and refreshing the page.
- In the modal, configure the Start element as follows:
Field |
Value |
---|---|
Topic Label |
Experience Management |
Classification Description |
This topic addresses customer inquiries and issues related to booking experiences at Coral Cloud Resort, including making reservations, modifying bookings, and answering queries about experience details. |
Scope |
The agent's job is to assist users in navigating and managing bookings for different experiences offered by Coral Cloud Resort, ensuring a seamless customer service experience by providing accurate information and resolving issues promptly. |
Instruction |
If a customer would like more information on Activities or Experiences, you should run the action 'Get Experience Details' and then summarize the results with improved readability. Always ensure you know the customer before running this action. |
- Leave everything else as is and click Next.
- Custom actions will be added to this topic so skip adding any of the standard actions and click Finish.
Add the Get Experience Details Action to the Agent
Create and attach the Get Experience Details action to the Experience Management topic so the agent can produce details about each experience.
- Click the Experience Management topic.
- Click the This Topic’s Actions subtab.
- Click New and select Add Action.
- Select Flow as the Reference Action Type.
- Select Get Experience Details.
- Leave the other options as is, and click Next.
- For experienceName, check Require Input.
- For experienceRecord, check Show in conversation.
- Click Finish.
Note: If the API name already in use error appears, it is because this action has already been created. Return to the New Action button and select Add from Asset Library.
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.
- With the This Topic’s Actions subtab still selected, click New and select Add Action.
- Select Flow as the Reference Action Type.
- Select Get Customer Details.
- Leave the other options as is, and click Next.
- For email, check Require Input.
- For memberNumber, check Require Input.
- For contact, check Show in conversation.
- Click Finish.
Add an Action to Get Session Records
Use the Get Sessions flow to get the available session records for each experience.
- With the This Topic’s Actions subtab still selected, click New and select Add Action.
- Select Flow as the Reference Action Type.
- Select Get Sessions.
- Leave the other options as is, and click Next.
- For experienceId, check Require Input.
- For startDate, check Require Input.
- For sessions, check Show in conversation.
- Click Finish.
Add an Action to Generate a Personalized Schedule
The agent needs to be able to give personalized recommendations based on the current contact’s schedule. The client shouldn’t get a recommendation for jet skiing if they already have that experience booked.
- With the This Topic’s Actions subtab still selected, click New and select Add Action.
- Select Prompt Template as the Reference Action Type.
- Select Generate Personalized Schedule as the Reference Action.
- Leave the other options as is and click Next.
- Configure the instructions as follows:
Field |
Value |
---|---|
Agent Action Instructions |
Generate a personalized schedule that includes the time and location of resort experiences that are available today, and that match the guest's interests. |
Contact Input Instructions |
Contact for which the personalized schedule should be generated. Must be a valid JSON representing the contact info, chained from having executed the Get Customer Details action. |
- For the Prompt Response Output, check Show in conversation.
- Click Finish.
Add an Action to Create a Booking
When the agent provides excellent recommendations and the client wants to book an experience, what should happen? Hint, the agent will create a new record within Salesforce.
- Click New and select Add Action.
- Select Flow as the Reference Action Type.
- Select Create Experience Session Booking.
- Leave the other options as is, and click Next.
- For Contact_Id, check Require Input.
- For Guests, check Require Input and Collect data from user.
- For Session_Id, check Require Input.
- For Booking output, check Show in conversation.
- For Output_Message output, check Show in conversation.
- Click Finish.
Provide the Agent with Instructions to Choose the Correct Action
Put all the pieces together and add instructions to the topic.
- Click the Topic Configuration subtab.
- At the bottom, click Add Instructions five (5) times. This will create five blank instruction text boxes under the prepopulated first instruction.
- Add these Instructions:
Field |
Value |
---|---|
1st Instruction |
[leave as is] |
2nd Instruction |
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 the action 'Get Customer Details' before running any other actions. |
3rd Instruction |
Whenever a date is provided, convert the date to YYYY-MM-DD format and ensure that the date is not in the past before using it for the 'Get Sessions' action. If a past date is provided, explain to the client the date must be future. |
4th Instruction |
If asked to get sessions for the experience use the 'Get Sessions' action. Ask for the Date of the sessions if not provided. Use the Id of the Experience__c from the 'Get Experience Details'. Do not use the experience name, this must be an ID. |
5th Instruction |
If asked to book, use the action 'Create Booking'. The Contact__c is the contact ID from the 'Get Customer Details'. The Session__c is the ID of the session from the action '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. |
6th Instruction |
If asked to recommend experiences that a user might be interested in, use the 'Generate Personalized Schedule' Action to generate a schedule based on a contacts interests. Use the contact record from 'Get Customer Details' and pass it into the Contact input. |
- Click Save.
- Click Activate.
Test the Agent
Start a conversation to preview how your agent builds a plan and executes actions based on user interactions. As interactions happen with the agent, notice the panel in the middle of the screen that displays exactly what the agent is executing.
- While still in the Agent Builder, click Refresh (circular arrow) in the top right corner of the Conversation Preview.
- Don't worry if the dots are spinning in the Conversation Preview, go ahead and enter this prompt:
Can you let me know more about the full moon beach party experience?
and press your Return/Enter key.
- Reminder: email address is
sofiarodriguez@example.com
and10008155
is the membership number. Press your Return/Enter key. Keep answering the agent’s questions and book a session.
- Click the back arrow to return to Setup.
Publish and Update
Publish the web deployment and update the flow.
- In the Setup Quick Find, search for and select Embedded Service Deployments.
- Select the ESA Web Deployment.
- 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.
Re-route the Flow
Now update the existing flow to route work to the newly created Service Agent.
- In the Setup Quick Find, search for and select Flows.
- Click on the Route to ESA flow.
- Click the Route to ESA component and select Edit Element.
- Select these values in the Set Input Values section:
Field |
Value |
---|---|
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 Agent Builder for the CC Service Agent and make sure it’s activated. |
- Click Save As New Version.
- Keep everything as is and click Save.
- Click Activate.
- Click the back arrow to return to Setup.
Add the Agent to the Coral Cloud Site
Lastly, embed the chat component to the Coral Cloud Experience Cloud site.
- In the Setup Quick Find, search and select All Sites.
- Click Builder next to the coral-cloud site.
- Click the Components widget .
- 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.
- Leave the default settings.
- Click Publish in the upper right corner.
- Click Publish in the confirmation window.
- Click Got It.
View the Agent as a Customer
The big reveal. Time to interact with the new agent.
- Click the Experience Builder menu .
- 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.
- Click on the 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 the following prompt:
Can you let me know about the Underground Cave Exploration?
- Reminder: email address is
sofiarodriguez@example.com
and10008155
is the membership number.
- Keep answering the agent’s questions and book a session.
- Feel free to test if the FAQs document has been indexed by asking “Are beach towels provided by the resort?” If the agent doesn’t provide the expected answer, it’s OK. The document just has not been indexed yet, feel free to test this later.
Coral Cloud Resorts now has a shiny new Agentforce Service Agent that can not only give personalized experience recommendations, but also book experiences for clients. Bring on the busy season!
Resources
- Trailhead: Agentforce Service Agent: Quick Look
- Salesforce Help: Configure Service Agent Managers
- Salesforce Help: Escalate Conversations to a Service Rep
- Website: Salesforce AI Use Case Library
- Salesforce Developer Documentation: Get Started with Agentforce Agents and Copilot
- Salesforce Developers Blog: Build Custom Actions Using Apex