Appearance
Exercise 5: Extend Agents with Prompt Template Actions
Now, let’s make the Flex prompt template that you created in the Prompt Builder section available to agents in a conversational fashion.
Step 1: Create the agent custom action
From Setup, open Agent Actions.
Click New Agent Action, and configure the action as follows:
Field Value Reference Action Type Prompt Template Reference Action Generate Personalized Schedule Agent Action Label Keep default Agent Action API Name Keep default Click Next.
For the Agent Action instructions, type:
txtThis action is used to generate a personalized schedule for a contact. The personalized schedule includes a list of resort experiences the contact may be interested in and a suggested schedule for the day. You must use the QueryRecords action to fetch the contact before executing the action.
It’s important to add this last sentence, so the agent can pass the contact in the correct format to the prompt template.
For the Contact Input, set the Instructions to:
txtContact for which the personalized schedule should be generated. Must be a valid JSON representing the contact info, chained from having executed the QueryRecords action.
For the Prompt Response Output, check Show in conversation.
Click Finish.
Step 2: Add the action to your agent
Next, let's add the custom action to your Agent:
From Setup, open Agents (under Agent Studio).
Click on Einstein Copilot in the agent list.
Click Open in Builder.
In the Topics sidebar, click the CustomerServiceAssistant topic.
Click the This Topic's Actions tab.
Click the + button to add an action.
Check the Generate Personalized Schedule action and click Finish.
In the Conversation Preview panel, enter the following prompt:
txtGenerate a personalized schedule for contact named Sofia Rodriguez.