The Autonomous AI Assistant gives RevCent users the ability to increase revenue and save money by automating tasks in a step workflow. An autonomous assistant is triggered either via an event, flow or auto query.
With an autonomous assistant, you do not communicate directly with the AI. Instead, the RevCent AI Assistant is activated based on trigger settings and runs autonomously in the background, communicating with the AI based on the design of your thread. Depending on the trigger, different options will be available to limit the assistant to only run on certain conditions and filters.
There are important concepts to understand when using a RevCent AI Assistant, especially as it related to performance and costs within your OpenAI account. Read more
Below are the general settings that apply to an autonomous assistant.
Select the third party integration you already created in RevCent for your OpenAI account. This should have been done as part of the Getting Started guide.
You must provide the clear instructions for the AI. The AI needs to know what its purpose is, so it will read the initial instructions you set and act accordingly.
Example for an Autonomous Assistant:
You are an automated assistant for an ecommerce company called Acme Inc. You are activated when a customer makes a purchase on the Acme Inc. online shopping cart.
Important: Limit the amount of tokens consumed by the AI Assistant to minimize OpenAI costs. It is highly recommended that you set at least one of these limits.
The autonomous assistant provides settings specific to what activates the assistant, i.e. the trigger.
Select the AI assistant trigger. This is what will activate the assistant, allowing it to run autonomously when the trigger occurs.
The period of time to wait until the assistant thread officially starts. Default minimum is 1 minute, maximum is 30 days.
Only available for Event and Flow trigger types. You have the option to only activate the assistant based on attributes of the item specific to the trigger. Before triggering the AI Assistant from a flow or an event, RevCent will check any filters to see if the item matches said filters. This enables you to only trigger the AI Assistant for items specific to a campaign, shop, metadata, etc.
The maximum number of times the specific AI Assistant can be triggered for the same item. Recommended set 1.
Note: Max runs is per assistant and item. An item can have more than one assistant triggering it.
Important: Depending on the trigger and what the AI is doing, the same item can be processed multiple times. This is why the max run setting exists and should almost always be set to 1. For example: If you are triggering the assistant to run on a declined sale, and the AI is going to reprocess the sale, if the AI's attempt to reprocess results in a decline, the AI will be triggered once again for the same sale. This is because the trigger would fire once for the original declined sale and again for the AI's declined sale, which you could avoid by setting max runs to 1. Having this setting greater than 1 can cause multiple attempts when you only intend to attempt once.
Only applies if Max Runs Per Item is greater than 1.
If you do intend to run the AI on the same item more than once, you can put a delay between the next assistant run for the item. The Min Run Interval is the period of time that must transpire between runs for the same item. For example, if you are re-processing a sale using the AI, and the attempt is declined, you want to reprocess it once again but 1 day later, you would set Max Runs Per Item to 2, and put a min run interval of 1 day. This ensures that on the first decline by the AI, the AI would wait a day and try again.
Important: Once a delay has been set for a specific item it cannot be retroactively modified. If you put a 30 minute delay, and later changed it to a 10 minute delay, any items already on the 30 minute delay will still wait for 30 minutes. The change will occur for new items only.
System actions are built into the AI assistant and allow it to perform many different types of RevCent API calls on your behalf. Many of the methods listed on the API V2 Docs are also System Actions within an AI Assistant. System actions are performed by the AI Assistant automatically, without any coding necessary. The AI is intelligent enough to know what endpoint to call, fields that are required, etc.
System actions are opt-in only, meaning they must be explicitly made available to the AI. You make system actions available within a step node in an Autonomous assistant thread. When a system action is made available, RevCent provides the AI with the system action description and schema so the AI is aware of its availability and settings. The AI will read each system actions' description and schema, then make the API call on your behalf either automatically or when you tell it to.
You make system actions available within each step node in the thread. If a step node message is “Add the customer to the High LTV group”, the AI will get all customer groups, find the High LTV group, then add the customer to the group with the name High LTV Group.
In this example, the following system actions should have been made available within the node:
If you were to enable every system action, you would consume an enormous amount of tokens each time the AI Assistant interacts with OpenAI. The AI analyzes all available actions when processing requests, thus it will consume tokens as it reads the description and schema of each system action. By design, an AI Assistant must have systems actions enabled/made available in order to limit the amount of tokens you will consume. It is highly recommended to only make available the system actions an AI Assistant may/will need at the thread node level.
A custom action allows you to greatly expand the use of an autonomous assistant by providing the AI with additional capabilities that are customized by you.
Provide your custom action with a name. You will want to be able to identify the action that was run, so name it distinctively.
Important: Provide the action with a detailed description of what it is meant for. The AI will read the description when deciding whether to run the custom action. Be descriptive and tell the AI exactly what the action is for and when/whether to use it.
Letting the AI decide:
Only run this action if the order amount is greater than $500. This custom action will send a thank you email for high value orders.
Preventing the AI from deciding:
Only run this custom action when explicitly told to do so.
A custom action must have a target. Depending on the target, it can receive data related to the event and any data generated by the AI.
Custom arguments are one of the core components when using a custom action. Please read this section carefully to understand how and why you should use custom arguments.
Unlike normal chat GPT's, the RevCent AI Assistant does not use the AI's reply message as the input data for action targets. Instead, you use a more structured approach to receiving the AI response data you need.
For example, with a common chat GPT you would tell the AI to write a paragraph, and the AI's response message would be the paragraph it generates. However, with a RevCent AI Assistant you would instead tell the AI to write a paragraph, but to provide the paragraph it generates as a custom argument.
Why not just use the AI reply message?
You may want the AI to find or generate multiple items, and send the data to the action as easily accessible individual properties for each.
For example, you can send the AI the following message: “Generate customized email content for a purchase and set it as the “email_content” argument, and also find the source marketing channel the purchase came from and set as the “source_channel” argument”.
In the action you would create two custom arguments, one named “email_content”, and a second named “source_channel”. This way you are able to generate multiple outputs using one AI message, each being an input directly accessible at the action target, i.e. custom_arguments.email_content and custom_arguments.source_channel.
Below are examples of how you would use Custom Actions to find or generate data, then forward the data to the custom actions' target.
You previously created a RevCent Function called Facebook Conversion Post which notifies Facebook of a conversion using the sale click ID. When a new sale is paid, you want the AI to attempt to find the “fbclid” and forward it to the Conversion Function as “facebook_click_id”. The Conversion Function code should be written to parse the AI data custom argument called facebook_click_id, then use the click ID to notify Facebook. Notice how we told the AI not to run the custom action if it can't find the click ID.
Assistant Trigger: Event > sale.created.success.paid
Action Target: Facebook Conversion Post
Argument Name: facebook_click_id
Argument Description: Find the metadata value where the metadata name is “fbclid”. If you cannot find the metadata value for fbclid, do not run this action.
Sent to target:
{
"ai_data": {
"custom_arguments": {
"facebook_click_id": "fb_sahSHFISAfxxx" // The AI will find the facebook click ID based on your argument description.
}
}
}
Access at target: ai_data.custom_arguments.facebook_click_id
You previously created an Email Template called Additional Thanks Email. The email template has the shortcode {{ai_data.custom_arguments.thank_you_paragraph}} within the email content. When a successful sale triggers the AI Assistant, the AI will read the custom argument description and trigger the email template with a custom generated paragraph. The shortcode will output the thank_you_paragraph custom argument, with the contents being the paragraph the AI generated. The email recipient will receive an email with an AI generated paragraph thanking them for purchasing the product they paid for.
Assistant Trigger: Event > sale.created.success.paid
Action Target: Additional Thanks Email
Argument Name: thank_you_paragraph
Argument Description: Create a customized html paragraph thanking the specific customer for the purchase of the product. Make the product name in bold.
Sent to target:
{
"ai_data": {
"custom_arguments": {
"thank_you_paragraph": "<p>We would like to thank you George for purchasing the <strong>Laptop X400</strong>.</p>" // The AI will generate the HTML based on your argument description.
}
}
}
Access at target: ai_data.custom_arguments.thank_you_paragraph
You previously created an Email Template called Daily Report Email and an Auto Query which points to the AI assistant. The email template should have the shortcode {{ai_data.custom_arguments.query_results_table}} within the email content. When the auto query triggers the AI Assistant, the AI will read the custom argument description, generate an HTML formatted table and trigger the email template with the table as the custom argument name. The email template shortcode will output the query_results_table custom argument, with the contents being the report results HTML table. The email recipient will receive an email with a human readable report result.
Assistant Trigger: Auto Query
Action Target: Daily Report Email
Argument Name: query_results_table
Argument Description: Create a html formatted table based on the query results.
Sent to target:
{
"ai_data": {
"custom_arguments": {
"query_results_table": "<table><tr><th>Product Name</th><th>Amount Gross</th></tr><tr><td>USB HDD</td><td>625.92</td></tr><tr><td>Laptop X400</td><td>452.07</td></tr></table>" // The AI will generate the HTML table based on your argument description.
}
}
}
Access at target: ai_data.custom_arguments.query_results_table
Autonomous assistant type only. Each time an autonomous assistant is triggered, it generates a unique thread within OpenAI. The thread builder is where you design how the RevCent AI Assistant thread will run, including steps, actions and branching.
The thread builder consists of nodes, which you connect in the order you want processed when the thread runs. Connect nodes to one another as a sequence of events in which the assistant interacts with the AI. Additional nodes are available to either wait a period of time or end the thread entirely.
The start thread node only occurs once when building a thread. It is the starting point for the thread, i.e. where the thread begins to run after the trigger has occurred.
A start thread node will begin with a message the AI. The message to the AI is pre-determined based on the event and item type that triggered the assistant. For example, if the assistant is triggered by a new sale, the start thread node will first ask the AI to retrieve the details on the specific sale. The AI will retrieve the sale details and keep the sale details in the thread message history. This gives the AI the initial context and information it needs for the remainder of the thread, i.e. reference the sale in future thread messages without needing to retrieve the sale details again.
The thread step node contains the message the AI will receive, as well as make available any actions the AI may need. A thread step has both system actions and custom actions you can make available for the specific step. The reason for actions being opt-in per step is to limit token consumption and prevent AI confusion. You only want the AI to know what it can do at each specific step within the thread.
The step message is sent to the AI instructing the AI what to do at the specific step in the thread. Write the message the same as you would for a human, being very clear and precise. The AI will read the message as well as system and custom actions. The AI will determine what, if anything, to do based on your message in combination with the actions available.
Select one or more custom actions you created to make available to the AI for the specific step. Only select the custom actions the AI may need for the specific step.
Select one or more system actions to make available to the AI for the specific step. Only select the system actions the AI may need for the specific step.
Below are some example thread steps, showing what is possible by simply messaging the AI as if it were a human.
Step Example 1
Step Example 2
The thread branch node gives you the ability to have the AI choose an output path to take. This allows you to split a thread based on one or more conditions. You write the message for each output path as an individual condition. When the thread runs and reaches a thread branch node, RevCent will first format your output messages into a single conditional statement and send it to the AI. The AI will know it is a conditional statement and that it must choose only one output. The choice the AI makes determines the path the thread will resume on.
The are four possible outputs the AI can decide to take, three of which you set the condition for using a message. The fourth output is reserved as a catch all in case the AI does not choose from one of the outputs you set. You do not need to use all three outputs available to you, but you must use at least one.
Each output message you write is an individual condition, where if true, the AI should choose the specific output.
Here is a basic example of splitting a thread using a branch node.
Let's say you want to split the thread based on what was purchased in a sale. If the customer purchased a USB you want to branch one way, if a Laptop another way, if neither USB or Laptop then another way.
You create the branch node with a different message for each output 1, 2 and 3:
RevCent will format your output messages (conditions) into a final statement meant for the AI. The AI will read the conditional statement RevCent created and determine the output result. For example, if a new sale is placed where the customer purchased a Laptop X400, the AI would determine that output 2 is the output result, thus splitting the thread at the branch nodes' output 2.
The time delay node allows you to pause the thread for up to 30 days, giving you time to wait for specific updates that may occur related to the item that triggered the event. Minimum is 1 minute, maximum is 30 days.
The end thread node allows you to end the thread. May be useful for identifying when you do not wish to continue within the thread builder. Any time a thread no longer has an additional node to continue to, it will self end.
When implementing AI in functions, flows or email templates, you will want to access the AI details. The AI details will be contained within the ai_data
object. Any custom arguments will be contained within the ai_data.custom_arguments
object.
Below is an example ai_data
object. The ai_data object contains details about the AI Assistant in RevCent as well as OpenAI. The specific item type, item id and related metadata are also included. Notice the thread messages object, which contains the messages from both the user and assistant in descending time order.
The most important information contained within the ai_data object is the ai_data.custom_arguments
object. The custom_arguments object will contain the argument name and AI output for each custom argument you added within a custom action.
{
"ai_data": {
"custom_arguments": {
"customer_card_id": "XKob65Bn8qfqmWggp99B",
"customer_card_type": "VISA"
},
"assistant": {
"id": "asst_304kIxIGvO6JcJ4X9u9smGOY",
"object": "assistant",
"name": "Trigger Assistant",
"model": "gpt-4-turbo",
"top_p": 1,
"temperature": 0.2,
"metadata": {
"revcent_ai_assistant": "yRdBXQMj82T9Vrn8RpBE"
}
},
"thread": {
"id": "thread_ntI40nT1mwLwMrhDCdH58uAj",
"object": "thread",
"created_at": 1714575558,
"metadata": {
"revcent_ai_assistant_id": "yRdBXQMj82T9Vrn8RpBE",
"revcent_ai_assistant_name": "Trigger Assistant",
"revcent_item_type": "sale",
"revcent_item_id": "1RoNP4nAr0f6vk22lAAq"
}
}
}
}
When the AI Assistant action is a Function, the functions' event data will contain the item_details of the specific item being processed. If the AI assistant was triggered by an Auto Query, the query_results array will be present within the item_details object.
Notice the ai_data object is contained within the main data object, along with the item_details object. Access the AI details within the function code via event.data.ai_data
object. Access any custom arguments via the event.data.ai_data.custom_arguments
object.
{
"event": {
"data": {
"item_details": {
"id": "Q4nGRNpLgpS92QqGLwlX",
"first_name": "George",
"last_name": "Washington",
"query_results": [
{
"group_by_value": "Bundle Product",
"sale_sum_amount_gross": 625.92
},
{
"group_by_value": "Laptop X400",
"sale_sum_amount_gross": 452.07
}
]
},
"ai_data": {
...,
"custom_arguments": {
...
}
}
}
}
}
When the AI Assistant action is an email template, the templates' input data differs based on the AI Assistant's trigger. If the AI assistant was triggered by an Auto Query, the query_results array will be present.
Notice the ai_request object is contained as a property within the input data items' details. Access the AI details via ai_data
object. Access any custom arguments via the ai_data.custom_arguments
object.
{
"id": "Q4nGRNpLgpS92QqGLwlX",
"first_name": "George",
"last_name": "Washington",
"query_results": [
{
"group_by_value": "Bundle Product",
"sale_sum_amount_gross": 625.92
},
{
"group_by_value": "Laptop X400",
"sale_sum_amount_gross": 452.07
}
],
"ai_data": {
...,
"custom_arguments": {
...
}
}
}