{"id":14666,"date":"2025-10-22T10:55:17","date_gmt":"2025-10-22T15:55:17","guid":{"rendered":"https:\/\/www.mrc-productivity.com\/docs\/?post_type=ht_kb&#038;p=14666"},"modified":"2025-10-24T11:34:10","modified_gmt":"2025-10-24T16:34:10","slug":"how-to-call-ai-from-a-maintainer","status":"publish","type":"ht_kb","link":"https:\/\/www.mrc-productivity.com\/docs\/knowledge-base\/how-to-call-ai-from-a-maintainer","title":{"rendered":"How to call AI from a Maintainer"},"content":{"rendered":"\n<p>One of the primary ways users interact with Artificial Intelligence (AI) is by user interaction. For example, a user types a question into a chat bot and their answer is then delivered to them in the same chat bot. This document is written to illustrate that you can also interact with AI after writing data via a Maintainer. This could mean something as straightforward as triggering AI after filling out a web form, updating an existing row, or even triggering a maintainer through a one-step maintainer.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"How to Call AI from an m-Power Maintainer\" width=\"643\" height=\"362\" src=\"https:\/\/www.youtube.com\/embed\/_NsibAdzMyI?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>The Components<\/strong><\/h3>\n\n\n\n<p>To make this work, you will need the following m-Power components:<\/p>\n\n\n\n<p><strong>AI Assistant Template<\/strong> \u2013 This template is the same one you would build when creating a chat bot. The difference here is that the user will never interact directly with this AI Assistant. Instead, it will be invoked via your Maintainers workflow object.<\/p>\n\n\n\n<p><strong>Maintenance Application <\/strong>\u2013 As alluded to above, the maintainer application is what will be triggered to run the AI Assistant.<\/p>\n\n\n\n<p><strong>Workflow <\/strong>\u2013 Within the maintainer\u2019s workflow you will see a newly available action, \u201cCall AI Assistant\u201d<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>The Response<\/strong><\/h3>\n\n\n\n<p>When using a traditional chat bot, the answer from the AI response, of course, is delivered in the chat bot itself. But without a chat bot, where will the response go?<\/p>\n\n\n\n<p>The short answer here is that we need to treat the AI Assistant like an m-Power lookup. It&#8217;s job is to take some input and return an output, just like a lookup would.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"\/docs\/images\/m-Power AI Diagram - Maintainer.png\" alt=\"\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Real World Example<\/strong><\/h3>\n\n\n\n<p>Imagine you are building a hotline ticketing system and you want to utilize AI to better help you classify\/categorize high priority tickets. Based on various cases or scenarios that we will program into AI, we will let AI determine if a ticket should be categorized as \u201cStandard\u201d or \u201cEscalated\u201d. We will program m-Power to update the ticket with either of these categories. If it is Escalated, we will also trigger an email to the supervisor for urgent response.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"\/docs\/images\/m-Power AI Diagram - Helpdesk.png\" alt=\"\"\/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 1: Build AI Assistant Ap<\/strong>plication<\/h4>\n\n\n\n<p>No special configuration is needed. Simply, build an AI Assistant app and compile it. <strong><a href=\"https:\/\/www.mrc-productivity.com\/docs\/knowledge-base\/ai-assistant-template\" target=\"_blank\" rel=\"noreferrer noopener\">Learn more about the AI Assistant template here.<\/a><\/strong><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 2: Use System Prompts to Train AI. <\/strong><\/h4>\n\n\n\n<p>The System Prompt is text specific to this AI Assistant that is sent to the LLM (Large Language Model) each time a request is sent. Think of the System Prompt as the instructions you send to AI to make it more knowledgeable. <strong><a href=\"https:\/\/www.mrc-productivity.com\/docs\/knowledge-base\/ai-system-prompt\" target=\"_blank\" rel=\"noreferrer noopener\">Learn more about writing System Prompts here<\/a>.<\/strong><\/p>\n\n\n\n<p>To add the System prompt, click &#8220;Edit UI\/System Prompt&#8221; from your AI Assistant. Then click System Prompt.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"\/docs\/images\/system_prompt1.png\" alt=\"\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"\/docs\/images\/system_prompt2.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>In my case, I am going to add these instructions:<\/p>\n\n\n\n<p><em>Your job is to analyze the input and only return a single value, either \u201cStandard\u201d or \u201cEscalated\u201d. Don\u2019t return anything else.<\/em><\/p>\n\n\n\n<p><em>You should return \u201cEscalated\u201d when the ticket is of a critical nature. Seeing things like \u201cSystem Down\u201d, \u201cEmergency\u201d, \u201cTomcat won\u2019t start\u201d, and \u201cProduction\u201d are all good indicators of input that should result in an \u201cEscalated\u201d ticket.<\/em><\/p>\n\n\n\n<p><em>\u201cStandard\u201d tickets should be used to classify all other prompts, especially ones that are of the \u201chow-to\u201d variety.<\/em><\/p>\n\n\n\n<p><em>Examples:<\/em><\/p>\n\n\n\n<p><em>I just took an update to my development instance and now my dropdown lists aren\u2019t working.<br>Response: Standard<\/em><\/p>\n\n\n\n<p><em>I\u2019m not sure what happened but now my Tomcat instance won\u2019t stay up and no one can access any applications. Help!<br>Response: Escalated<\/em><\/p>\n\n\n\n<p><em>I am just wondering how to build an Interactive Report.<br>Response: Standard<\/em><\/p>\n\n\n\n<p><em>My system just crashed and everything is down.<br>Response: Escalated<\/em><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 3: Build User Facing Maintainer<\/strong><\/h4>\n\n\n\n<p>After designing\/painting your maintainer, open the Workflow Designer.<\/p>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-alert\">This documentation isn&#8217;t designed to tell you all the fields to include but be mindful to include the PRIORITY column, though from a practically perspective, you would then hide the input in m-Painter. The reason: You need the field to be part of the app so the system can write to it without letting your user write to this field. <\/p>\n\n\n\n<p>Click &#8220;Add actions.&#8221; Then choose \u201cCondition\u201d. Here you will select \u201cCheck the Action Mode.\u201d Name the action and ensure the action mode is set to Add. The reason for adding this condition is that we only want the AI logic invoked on Aadd, not on update.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"\/docs\/images\/condition.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>Click on the \u201cIf True\u201d node. Click to add an Action, then select \u201cCall an AI Assistant\u201d. Select the AI Assistant Retrieval from the dropdown list. Then in the Map Available Fields listing, choose \u201cuserMessage\u201d on the left, and choose the field where your user entered his or her help ticket description on the right. Since there is no user prompt, this step simulates the process of handing over what the user typed in the maintainer to the AI Assistant.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"\/docs\/images\/ai_assistant1.png\" alt=\"\"\/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 4: Update the Ticket with the Result from AI<\/strong><\/h4>\n\n\n\n<p>Continue editing the Workflow you were working on in Step 3. Click \u201cAdd actions\u201d on the \u201cCall AI Assistant\u201d node. &nbsp;Then add an Action and select \u201cSet Field value\u201d<\/p>\n\n\n\n<p>Map your Priority field to a value of AssistantResponse. This is the one word response that will be sent back from AI based on the rules established within the System Prompt.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"\/docs\/images\/call_ai_map_fields.png\" alt=\"\"\/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 5: Sending Email on High Priority<\/strong><\/h4>\n\n\n\n<p>Still within the same workflow, once again click on \u201cAdd actions\u201d within the \u201cCall AI Assistant\u201d node and add a condition. Choose the \u201cCompare a field value\u201d option. In the field dropdown, select \u201cassistant response,\u201d set the relation to Equal to and set the Value to: Escalated. Press Save.<\/p>\n\n\n\n<p>Click \u201cIf True\u201d and add an Action and select \u201cSend an Email.\u201d Configure the Email to your liking.<\/p>\n\n\n\n<p>Put together, here is the layout of the entire workflow:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"\/docs\/images\/ai_workflow_final.png\" alt=\"\"\/><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This documentation focuses on incorporating AI Assistant (chatbot) calls from a maintainer web form. This will show an example of using the response of the chatbot with workflow, and leveraging the response to determine the workflow path to follow. <\/p>\n","protected":false},"author":1,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[313],"ht-kb-tag":[],"class_list":["post-14666","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-artificial-intelligence-ai"],"_links":{"self":[{"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/ht-kb\/14666","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/comments?post=14666"}],"version-history":[{"count":11,"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/ht-kb\/14666\/revisions"}],"predecessor-version":[{"id":14947,"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/ht-kb\/14666\/revisions\/14947"}],"wp:attachment":[{"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/media?parent=14666"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/ht-kb-category?post=14666"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/ht-kb-tag?post=14666"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}