Agent Guidance Core User Guide

Please email support@creovai.com for omissions or errors.
×
Menu

Agent Assist Helper Functions

 
When running a Workflow with access to the Agent Assist licence part (either assigned System-wide or to your User), a number of Helper Functions are available to use. These allow the designer to easily perform common tasks, build handling for automatic actions and processes, and deepen the integration with Agent Assist.
 
Please note that all of these Helper Functions are documented for the current release of Agent Guidance. They may be incompatible with older releases of Agent Guidance, or custom/outdated Controls or versions of the local Interaction Capture service.
 
Note: some of these Helper Functions are asynchronous and make use of Promises. Promises are a form of JavaScript that allow for subsequent actions to be triggered once their asynchronous actions have been completed, and require a slightly different way of writing and designing your JavaScript. They also do not cause the usual Run Calculations process to occur when they complete, so if assigning a value to a Field then the assignment won't be visible to the agent until JavaScript is next triggered. An easy way to do this is to use Script.Utils.DoCalculations() or trigger a JavaScript - Button at the end of a Promise, as this will cause the Page to execute JavaScript immediately.
 

How To

All of the items documented below are relative to the root: Script.Plugins.agentassist. So, to use the openWidget Helper Function you could use the following code:
Script.Plugins.agentassist.openWidget();
 
 

General Functions

These Helper Functions cover a range of behaviour, not fitting neatly into the other groupings.
Name
Description
Response
Example
setConnector
Changes the currently-active Connector to be used for any AI-enriched actions.
 
Required parameters:
  •  connector (Connector type name string)
  •  instance (Connector name string)
None
Script.Plugins.agentassist.setConnector("connector-ai-gpt-azure", "GPT 4 - Warm");
getAIHistory
Returns an array of objects containing the history of queries sent for AI analysis, and the resulting responses to each.
[{"role": "user", "time": "2024-08-06T10:15:38.077Z", "content": "What was the caller's original problem?"}, {"role": "assistant", "time": "2024-08-06T10:15:38.778Z", "content": "The caller had been trying to troubleshoot a connectivity issue with their GX411 router, but the standard troubleshooting guides hadn't resolved the issue."}]
let aiHistoryArray = Script.Plugins.agentassist.getAIHistory();
 
 

AI Tab

These Helper Functions relate to adding content to the AI tab of the Agent Assist widget.
Name
Description
Response
Example
askQuestion
Submits a question to the currently-active Connector with the conversational context. The response is a promise that comprises a string of the answer, and the question and answer also get added to the AI tab of the Agent Assist widget.
 
If the label is provided, then it will be used as the heading of the card containing the answer; otherwise, the question will be used.
 
Required parameter:
  •  question (Prompt string)
 
Optional parameter:
  •  label (Notification heading string)
  •  showInWidget (Widget response visibility boolean, default of true)
Promise: "answer string"
Script.Plugins.agentassist.askQuestion("What is the caller's problem?", "Call Purpose").then(response => [Call Purpose] = response);
notify
Adds a content card to the AI tab of the Agent Assist widget.
 
Required parameters:
  •  heading (Heading string)
  •  content (Body string)
 
Optional parameter:
  •  type (Styling string, either "info", "success", "warning", or "error". If not provided or recognised, then plain styling is used)
None
Script.Plugins.agentassist.notify("Emotion improving!", "Well done on improving the emotion in the interaction", "success");
addArticles
Adds an "Article suggestions" card to the AI tab of the Agent Assist widget. Each article provided will appear as a separate named link within the card.
 
Each supplied article object has the following structure: {"title": "xxxxx", "url": "yyyyy"}
 
Required parameter:
  •  data (Article objects array)
None
let articlesArray = [{"title": "GX411 Troubleshooting", "url": "S:\\Troubleshooting\\GX411.pdf"}, {"title": "Router Troubleshooting", "url": "https://examplecompany.com/guides/routers.html"}];
Script.Plugins.agentassist.addArticles(articlesArray);
 
 

Categories

These Helper Functions relate to managing categories.
Name
Description
Response
Example
addCategory
Adds a new category, similarly to the functionality of the Agent Assist - Category Actions Field.
 
Required parameter:
  •  label (Display label string)
  •  category (Category name string)
 
Optional parameters:
  •  speaker (Speaker string, either "customer", "agent", or "either". Default of "agent")
  •  visible (Agent Assist widget visibility boolean. Only relevant when the speaker isn't "customer", default of true)
  •  action (Field to be triggered reference, using Script.Utils.GetCSObject())
  •  matched (Pre-matched intent boolean, default of false)
None
Script.Plugins.agentassist.addCategory("Customer Frustrated", "[ST Effort] C: Frustration", "customer", false, Script.Utils.GetCSObject([Toast - Customer Frustrated]), false);
getCategories
Returns an array of all currently registered categories.
[{"label": "Customer Frustrated", "category": "[ST Effort] C: Frustration", "speaker": "customer", "visible": false, "action": "[Toast - Customer Frustrated]", "matchedTime": null, "matched": false, "scrolled": true}]
let categoriesArray = Script.Plugins.agentassist.getCategories();
matchCategory
Matches the specified category, completing it in the Agent Assist widget and triggering any linked actions.
 
Required parameters:
  •  category (Category name string)
  •  speaker (Speaker string, either "customer", "agent", or "any" / "either")
None
Script.Plugins.agentassist.matchCategory("[ST Effort] C: Frustration", "customer");
removeCategory
Removes the specified category, removing it from the Agent Assist widget.
 
Required parameter:
  •  category (Category name string)
 
Optional parameter:
  •  speaker (Speaker string, either "customer" or "agent", default of any)
None
Script.Plugins.agentassist.removeCategory("[ST Effort] C: Frustration", "customer");
removeAllCategories
Removes all currently registered categories.
None
Script.Plugins.agentassist.removeAllCategories();
 
 

Conversation

These Helper Functions relate to managing the conversation.
Name
Description
Response
Example
getConversation
Returns the conversation history as an array.
[{"id": "0bb61b99-8df7-48de-9b7b-3268403ebcd9", "time": "2024-08-06T09:59:29.923Z", "speaker": "agent", "utterance": "Welcome to the service centre, can I take your name and postcode please?", "emotion": "Neutral", "completed": true, "intents": ["Name", "Postcode"], "analysisError": false}]
let conversationArray = Script.Plugins.agentassist.getConversation();
getConversationString
Returns the conversation history as a parsed string.
"agent: Welcome to the service centre, can I take your name and postcode please?\ncaller: My name is Aston French, and my postcode is AA1 1AA."
 
[Conversation Log] = Script.Plugins.agentassist.getConversationString();
 
 

Entities

These Helper Functions relate to managing entities.
Name
Description
Response
Example
addEntities
Entities are normally automatically detected from the supplied utterances, but it is possible to add entities via this Helper Function.
 
Each supplied entity is an object with the following structure: {"type": "xxxxx", "value": "yyyyy", "occurrenceInfo": [{"score": 1}]}. The type is selected from the following options: "person", "location", or "datetime".
 
Required parameter:
  •  entityArray (Entity array)
None
let entitiesArray = [{"type": "person", "value": "Aston French"}, {"type": "location", "value": "Office"}];
Script.Plugins.agentassist.addEntities(entitiesArray);
getEntities
Returns an array of the entities currently present in the interaction.
[{"type": "person", "value": "Aston French", "occurrenceInfo": {}, {"type": "location", "value": "Office"}]
let entitiesArray = Script.Plugins.agentassist.getEntities();
 
 

Intents

These Helper Functions relate to managing intents.
Name
Description
Response
Example
addIntent
Adds a new intent, similarly to the functionality of the Agent Assist - Intent Actions Field.
 
Required parameter:
  •  label (Display label string)
 
Optional parameters:
  •  prompt (Prompt string, defaults to checking for the label in utterances)
  •  speaker (Speaker string, either "customer", "agent", or "either". Default of "agent")
  •  visible (Agent Assist widget visibility boolean. Only relevant when the speaker isn't "customer", default of true)
  •  action (Field to be triggered reference, using Script.Utils.GetCSObject())
  •  matched (Pre-matched intent boolean, default of false)
None
Script.Plugins.agentassist.addIntent("Greeting", "Has the agent greeted the caller?", "agent", true, Script.Utils.GetCSObject([JSB - Greeting Complete]), false);
getIntents
Returns an array of all currently registered intents.
[{"label": "Greeting", "prompt": "Has the agent greeted the caller?", "speaker": "agent", "visible": true, "action": "[JSB - Greeting Complete]", "matchedTime": null, "matched": false, "scrolled": true}]
let intentsArray = Script.Plugins.agentassist.getIntents();
matchIntent
Matches the specified intent, completing it in the Agent Assist widget and triggering any linked actions.
 
Required parameters:
  •  label (Name string)
  •  speaker (Speaker string, either "customer" or "agent")
None
Script.Plugins.agentassist.matchIntent("Greeting", "agent");
removeIntent
Removes the specified intent, removing it from the Agent Assist widget.
 
Required parameter:
  •  label (Name string)
 
Optional parameter:
  •  speaker (Speaker string, either "customer" or "agent", default of any)
None
Script.Plugins.agentassist.removeIntent("Greeting", "agent");
removeAllIntents
Removes all currently registered intents.
None
Script.Plugins.agentassist.removeAllIntents();
 
 

Quick Actions

These Helper Functions relate to managing quick actions in the Agent Assist widget.
Name
Description
Response
Example
addGPTAction
Adds a new quick action to the list.
 
Required parameters:
  •  label (Name string, displayed in the list for the agent)
  •  prompt (Prompt string, the query sent to the currently-active Connector with the conversational context)
None
Script.Plugins.agentassist.addGPTAction("Caller Details", "What biographical information has the caller shared?");
removeGPTAction
Removes the specified quick action from the list.
 
Required parameter:
  •  action (Name string)
None
Script.Plugins.agentassist.removeGPTAction("Caller Details");
removeGPTActions
Removes all quick actions from the list.
None
Script.Plugins.agentassist.removeGPTActions();
 
 

Widget

These Helper Functions relate to managing the Agent Assist widget's visibility.
Name
Description
Response
Example
closeWidget
Collapses the Agent Assist widget.
None
Script.Plugins.agentassist.closeWidget();
hideTab
Hides the specified tab within the Agent Assist widget.
 
Required parameter:
None
Script.Plugins.agentassist.hideTab("entities");
openWidget
Expands the Agent Assist widget.
None
Script.Plugins.agentassist.openWidget();
showTab
Shows the specified tab within the Agent Assist widget.
 
Required parameter:
None
Script.Plugins.agentassist.showTab("entities");
toggleWidget
Toggles the Agent Assist widget between expanded and collapsed.
None
Script.Plugins.agentassist.toggleWidget();