Table of Contents

The third wave of AI has just begun with the launch of Salesforce Agentforce, and trailblazers all over the world are eager to build their agents. The enthusiasm and positive response were noted by Salesforce, as they have just launched a Sample App where you can practice building your very own agents. The Coral Cloud Resort is a sample application for managing the hospitality needs of a fictional resort. It combines Data Cloud, Prompt Builder, and Agents for full functionality.

The app requires a simple sign-up for your custom Trailhead Program. Salesforce has made everything open-source on GitHub with a guide for installation. This blog will explore the steps for building AI agents in this sample app. You can deploy and explore the application before you dive into this guide by referring to this blog.

Step-By-Step Process for Building Custom Agentforce Agents

The process of creating custom Agentforce Agents is long and complex. But we have simplified it for you by categorising the steps in this guide.

Stages for building custom agentforce agents

1. Enable Org Features

After deploying the application through GitHub, it is time to enable all the important org functions.

  1. Start by navigating to Setup and open it.
  2. In the Setup Quick Find, search for Einstein Setup and Turn on Einstein toggle.
  3. Next up, search for Einstein Bots and turn it on too.
  4. Click the Einstein Bots toggle, and make sure Einstein Bots is On.
  5. In the same setup menu, select Agents and hit refresh.
  6. Click the Einstein Copilot for Salesforce toggle, and make sure it is set to On.
  7. In the Setup Quick Find, search for and select Embedded Service Deployments.
  8. Select the ESA Web Deployment.
  9. Click Publish to republish with the latest additions.

2. Publish the Experience Cloud Site

After checking all necessary org functions, it is time to get the Experience Cloud site ready for the new agent before deployment. 

  1. Search for Digital Experiences in the Setup Quick Find and select All Sites.
  2. Click Builder next to the coral-cloud site and click OK.
  3. Click Publish in the upper right corner and then in the confirmation window.
  4. Click the Experience Builder menu and then Salesforce Setup to finish.

3. Create a New Agent

You have reached the step of building an agent. Follow the steps below to continue.

  1. In the Setup Quick Find, search for and select Agents.
  2. Click +New Agent and assign your first agent a name with a fun description. 
  3. Leave the other options as is and click Create.

4. Configure the Agent

After creating a new agent, you must adjust it by adding topics and actions to the agent. This will be the motive of your agent; for example, when a client asks about a topic, this configuration will help the agent take action. 

  1. With the Agent Studio still open, select Coral Cloud Agent and then open it in Builder.
  2. Click the down arrow and select New Topic.
Click the down arrow and select New Topic
  1. In the modal, configure the Start element as follows:
FieldValue
Topic LabelExperience Management
Classification DescriptionThis 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.
ScopeThe 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.
InstructionIf a customer would like more information on an Experience, you should search for the related Experience__c record and let them know more.
  1. Click Next and add a check to the following actions:
    1. Identify Object by Name
    2. Identify Record by Name
    3. Query Records
    4. Summarise Record
  2. Click Finish once done.
  3. If necessary, confirm that you’re about to use Einstein by clicking on Got it in the sidebar.
  4. Stay in the Agent Builder and hit Refresh (circular arrow) in the top right corner of the Conversation Preview.
  5. Enter this prompt in the Describe your task or ask a question… dialog box: Can you let me know more about the full moon beach party experience?
  6. Press your Return/Enter key and notice the response, which gives information about that party. If necessary, respond “Yes” for more details about the party experience.

5. Configure the Generation of Personalized Schedule Prompt

After the configuration of the agent, it will respond but not accurately. To refine it, you must add parameters on how the agent should interact with the Coral Cloud clients.

  1. Navigate back to Setup and select Prompt Builder.
  2. Select the Generate Personalized Schedule under All Prompt Templates.
  3. Configure the prompt as follows:
FieldValue
Prompt Template WorkspacePresent the list of resort activities happening today that match the guest’s interests. For clarity, use a bullet list. For each activity, include name, time, location and duration on a single line. Do not include the date. Tell the guest to reach out if they’d like to book any of these activities. List of activities happening today that match the guest’s interests: 
{!$Apex:PersonalizedGuestExperiences.Prompt}
  1. Save the prompt as a New Version by selecting Save As dropdown in the builder’s top right.
  2. You will see a previously added contact named Sofia Rodriguez in the Preview panel.
  3. Click Preview and see the populated Resolution and Response.
  4. Press on Activate.

6. Create a Custom Agent Action with a Prompt

Now that your agent is almost ready, you need to provide instructions on what actions it can take. It should be able to give personalized recommendations based on the current contact’s schedule.

  1. Navigate back to Setup and search for Agent Actions.
  2. Click +New Agent Action to create a new Action.
  3. Select Prompt Template as the Reference Action Type.
  4. Select Generate Personalized Schedule as the Reference Action.
  5. Leave the other options as is and click Next.
  6. Configure the instructions as follows:
FieldValue
Agent Action InstructionsGenerate 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 InstructionsContact for which the personalized schedule should be generated. Must be a valid JSON representing the contact info, chained from having executed the QueryRecords action.
  1. For the Prompt Response Output, check Show in conversation.
  2. Click Finish.

7. Create a Custom Agent Action with Flow

After providing recommendations to the client, the agent will now have to book an experience as per their selection.

  1. Create another new Action by clicking +New Agent Action.
  2. This time select Flow as the Reference Action Type.
  3. Select Create Experience Session Booking.
  4. Leave the other options as is, and click Next.
  5. For Contact_Id, check Require Input.
  6. For Guests, check Require Input and Collect data from the user.
  7. For Session_Id, check Require Input.
  8. For Booking output, check Show in conversation.
  9. For Output_Message output, check Show in conversation.
  10. Click Finish.

8. Assign the Custom Actions to the Agent

It is now time to put together all of the above and add custom actions for your agent so that it can function properly for the resort scenario.

  1. In the Setup Quick Find, search for and select Agents.
  2. Select Coral Cloud Agent.
  3. Click Open in Builder.
  4. Click the Experience Management topic.
  5. Click the This Topic’s Actions subtab.
Click the This Topic’s Actions subtab
  1. Click the Add Action Icon (plus sign).
  2. Add a check to the Create Experience Session Booking Action and the Generate Personalized Schedule Action.
  3. Click Finish.
  4. Click the Topic Configuration subtab.
  5. Click New Instruction.
Click New Instruction
  1. Leave the pre-populated Instruction as is and configure the new blank Instruction element as follows:
FieldValue
InstructionWhen a customer requests a list of recommended experience sessions, first retrieve their contact record. Pass this record into the “Generate Personalized Schedule” action’s contact input to return a list of relevant experiences available for booking.
  1. Click New Instruction again.
  2. Configure the new Instruction element as follows:
FieldValue
InstructionWhen a customer requests to book an experience, first locate a Session__c record that corresponds to the desired date and Experience__c they wish to book. Then, use the “Create Experience Session Booking” action to complete the booking, ensuring that you pass the Session__c Id, not the Experience__c Id.
Configure the new Instruction element
  1. Click Save.
  2. Click Refresh (circular arrow) in the top right corner of the Conversation Preview.
Click Refresh (circular arrow) in the top right corner of the Conversation Preview
  1. Enter this prompt: Can you let me know if there are any experiences I, Sofia Rodriguez, might be interested in today? and press your Return/Enter key.
  2. Enter the following prompt: Can you tell me more about the Beach Bootcamp Challenge? and press your Return/Enter key.
  3. Enter the following prompt: Can you book Sofia into the Beach Bootcamp Challenge for today? and press your Return/Enter key.
  4. You may tweak the instructions until you are getting the correct results.
  5. Click Activate.

9. Deploy the Agent to Your Customers

Your Service Agent is ready and now you can deploy it for your customers to be used. Set the user profile of the agent and embed the agent to an Experience Cloud site.

  1. Navigate back to Agents Setup and click on Coral Cloud Agent.
  2. Click the edit icon next to the Agent User field.
  1. Select Custom Agent User.
  2. Search for and select Coral Cloud Agent.
  3. Click the checkmark to save.

And voila, you have just completed your first agent project. All that is left for you now is to open your playground and add this agent to your Coral Cloud Application for use and practice. This application is pre-built to access Agentforce For Developers. 

Slack Community CTA

Conclusion

The Salesforce Aagentforce platform is the coming third wave of AI as announced in Dreamforce. The Coral Cloud Resort Sample App is aimed to help Salesforce developers practice building their own agents. This application is a great way to jump into the coming AI opportunities, especially for people who have some prior developer experience. If you want to get started with Agentforce, then enrol in our training to become a Salesforce Developer.

Latest Salesforce Insights

Rakshabandhan Sale