top of page
Search
  • Shreyas Dhond

Einstein Copilot Standard and Custom Actions

In our previous blog, we delved into the benefits of the Einstein Trust Layer and its role in facilitating secure integrations with external LLMs through prompt templates. Today, our focus shifts to Einstein Copilot, the groundbreaking AI assistant for CRM that is now available.


Representing the first Generative AI-powered conversational assistant, Einstein Copilot aims to empower users across various functions like sales, service, marketing, and commerce and enhance customer interactions.


In this blog, we will go through Einstein Copilot's process flow, standard actions and how to extend the skillset using custom actions built using Salesforce native tools.


Einstein Copilot Building Blocks


Actions serve as the backbone of Copilot's functionality. Each Copilot comes equipped with a library of actions, representing a diverse set of tasks it can perform. For instance, if a user seeks assistance in drafting an email, Copilot swiftly initiates an action to compose and refine the email, leveraging relevant data from Salesforce.


Out of the box, Salesforce provides a range of standard actions, ensuring Copilot is immediately capable of aiding users with common Salesforce tasks upon activation. Moreover, you have the flexibility to create custom actions, tailoring Copilot's abilities to address specific business needs.


Driving Copilot's decision-making process is the Einstein Copilot reasoning engine, also known as the planner service. This engine orchestrates the sequence of actions during a conversation to fulfill user requests effectively.


Here's how it operates:

  1. Interprets the user's request and discerns their intent.

  2. Dynamically devises a plan to achieve the user's objective.

  3. Identifies and launches the appropriate action or series of actions to accomplish the goal.


At the heart of Einstein Copilot lies the Large Language Model (LLM), empowering this AI assistant to engage with users and execute tasks within your organization. The planner service interacts with the LLM throughout user interactions, adapting the frequency and scope of LLM calls based on user requests and the actions initiated.


The Mechanics of Einstein Copilot



Copilot Builder is built on a conversational interface and integrates natural language processing in the planning and executing actions to accomplish tasks in your CRM Apps. The Copilot's dynamic response process involves the following steps:


  1. Identifying User Intent: Users initiate conversations within the Einstein panel, either by selecting suggested actions or entering their tasks or questions. The copilot sends a prompt to the LLM through the Trust Layer to discern the user's intent.

  2. Generating a Plan: The planner service constructs a plan based on the user's intent, outlining copilot actions to accomplish the goal. This plan considers available actions, user history, and context, generating a conversational roadmap.

  3. Executing the Plan: The copilot begins executing the actions outlined in the plan. For simple requests, like querying records, the process is straightforward. However, more complex tasks may require multiple actions executed in succession.

  4. Generating a Response: After executing the plan, the copilot delivers a response to the user. It prompts the LLM to generate a friendly message or structured content based on the action's output. In case of errors, the copilot generates an error message through an LLM call.

  5. Continuing the Conversation: The copilot understands each interaction within the larger conversation context, allowing users to ask follow-up questions or change topics seamlessly. Behind the scenes, this initiates the process anew, providing users with a natural conversational experience.


Enrich Einstein Copilot with Custom Actions



Custom actions can be used to extend Einstein Copilot's functionality. Copilot Builder analyzes the instructions in a custom action to determine when to include them in a dynamic plan. The Dynamic Plan is then executed and the response is processed to respond to the end-users.


Copilot Builder



Copilot Builder is the engine behind the Copilot. Actions for Copilot Builder can be configured in the Actions panel on the left. The Actions panel has two tabs, one tab shows the existing configured actions and the other one shows the action library for actions not currently assigned to the copilot.


Conversation Preview panel allows developers and admins to test prompts. Copilot processes prompts and a plan of actions is generated. This plan of actions along with the execution details are available in the Dynamic Plan panel.


Copilot Actions



Actions are the backbone of how a copilot accomplishes tasks within Salesforce. These actions come in two categories: standard and custom.


Standard Actions: These are provided by Salesforce out of the box and cover common tasks users may need assistance with. These actions are integral to the basic functionality of the copilot and cannot be removed. Some standard actions may require additional licenses or permissions, and their availability is tailored to specific Salesforce clouds or products.


Custom Actions: Users have the flexibility to create custom actions to extend the capabilities of their copilot. These actions are tailored to meet specific business needs and can assist with tasks unique to your organization.


Standard actions are readily available upon enabling Einstein Copilot, while custom actions can be created to address specific requirements. The availability of actions is determined by permissions and licenses within your Salesforce org.


A copilot utilizes only the actions assigned to it. You can manage these assignments by accessing the Actions tab on your Copilot's record page or the This Copilot’s Actions tab in the Copilot Builder, from these locations, you can view, add, or remove actions as needed.


To assign actions to your copilot, you can do so from various locations, including the Copilot Actions page, the record page for a specific action, or the Copilot Action Library tab within the Copilot Builder. This flexibility allows you to effectively tailor your copilot's capabilities to suit your organization's needs.


Standard Actions


Standard actions are an integral part of your copilot's functionality, readily available upon activation. While many of these actions are accessible to all users with Einstein Copilot permissions, some are tailored to specific Salesforce clouds or products and may require additional licenses or permissions.


It's worth noting that certain Einstein Copilot actions are still in beta and may have limited functionality. However, incorporating them into your copilot adds value to your services, albeit consuming Einstein Requests if enabled and utilized.


Take advantage of the comprehensive reference library for Einstein Copilot standard actions to enhance your copilot's capabilities and streamline your Salesforce experience.


Custom Actions


Custom actions empower you to extend the functionality of your copilot by leveraging platform features like invocable Apex classes, autolaunched flows, or prompt templates. By adding custom actions, you can tailor your copilot to suit your specific needs and maximize the utilization of your existing Salesforce platform capabilities.


The accessibility of a custom copilot action is contingent upon the type of Salesforce action it references. For instance, if a custom action is constructed using a flow, it inherits the permissions, field-level security, and sharing settings defined within the flow. This flexibility ensures that your custom actions seamlessly integrate with your Salesforce environment, providing a tailored and efficient experience.


Apex

In its simplest form, an invocable method can be converted to a custom apex copilot action. @InvocableMethod and @InvocableVariable annotations can be used to provide labels, descriptions and defined attributes for your variables and methods to provide context to Einstein Copilot.


The below apex class provides an @InvocableMethod to create property visit records for a customer to a specific property at a given date and time. The invocable method is decorated with a label and description to provide context that be used when creating the custom apex action.


Additionally, wrapper classes decorated with @InvocableVariable with description to provide context and property attributes such as being required can be configured.



Copilot action for the above apex class can be configured using Setup > Einstein Copilot Studio > Einstein Copilot Actions. If the label is available in the class it is auto-populated or the name of the apex class is defaulted. Both label and API name can be changed during configuration.



Copilot Action Instructions are important and are defaulted from the description of the apex class. Action instructions provide context to Copilot when to include the custom action in the plan. Usually sample prompts can be used to provide examples on when to invoke the action.



Inputs and Outputs need instruction as well, which is defaulted to the description of the invocable variable if available. In addition, input properties can be set to required (available to be set as part of invocable variable decorator), Collect data from user (allows copilot to ask the user if not able to find in prompt), and Mask PII (to hide any identifiable PII from external LLMs explicitly).



Once the copilot action is configured, it can be assigned to Einstein Copilot as part of the copilot action library. The below picture shows the working copilot action.



Flows

Similar to apex, copilot actions can be configured using Flows. For Flows to be available to be configured as a copilot action it needs to be an autolaunched flow. Flow can be configured using the same familiar components flow builders are used to.



The Copilot action can be created from Setup > Einstein Copilot Studio > Einstein Copilot Actions.



Action instructions for the copilot action and input are defaulted to the descriptions provided in the flow builder. These can be changed to provide the relevant context for the copilot.



Once an action is generated, it can be linked with other actions to construct conversational sequences for your end users. Flows can be used for post-processing tasks like creating tasks, events or notifications for users.



Prompt Templates

Prompt templates can be configured directly into a Copilot Action. The use cases for leveraging prompt templates as copilot actions could be and are not limited to sending a curated email to a customer, generating a detailed record summary, and recommending next steps based on existing record status and data.



To leverage a prompt template as a copilot action we can go through the same steps Setup > Einstein Copilot Studio > Einstein Copilot Actions to create the action. The copilot action label defaults to the prompt template name and the API name is auto-generated based on the label.



When we create a copilot action using a prompt template the action instructions default to the description provided in the prompt builder. This needs to be fine-tuned to provide the relevant context to ensure Copilot knows when to call this action. Also, the input instructions are not populated as currently there is no way to provide descriptions to prompt template inputs.


The instructions for the inputs need to be written in a way to get the inputs from the chat context or request the user to provide them. For this to be enabled for an input the "Collect data from user" attribute needs to be checked.



Once the action is created it can be chained with other actions to create conversational flows for your end-users like sending an email for an appointment or property visit.



Resources


Hope you found this blog educational and are excited to try Einstein Copilot for yourself. Please check the resources below to continue your further exploration. Most of my background knowledge along with help documentation was supplemented by Mohith Shrivastava's and Gary Brandeleer's blogposts below.


57 views0 comments

Comentários


bottom of page