Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

How parameters gets pass from tool to AI Agent

User687957
Tera Contributor

During my practice on AI agent , I face something which is not easy to follow which is the way parameters output from tools as send back and use by the AI Agent

 

For example I have an AI Agent which is based on the 2 following tools:

I get a Tool named "Get Incident Description" (Action flow) :

  • Input a parameter "incident_number"
  • output a parameter "Description"
  • AI instruction is : Get the Incident Description with the Incident Number
  • Script
(function execute(inputs, outputs) {
 
    var result = {};
    var inc_gr = new GlideRecord("incident");
    inc_gr.addQuery('number', inputs.number);
    inc_gr.query();
    if (inc_gr.next()) {
        outputs.description = inc_gr.getValue('description');
    } else {
        outputs.content = "Unable to fetch requested incident record.";
    }
    
})(inputs, outputs);
​

 

Then I have an other tool "Update incident Description" :

  • Input a parameters : number, description
  • Script tool 
(function(inputs) {
    // only string inputs are allowed 
    // return outputs object where the keys in it are understandable by LLM
    if (!inputs) return {
        message: 'No inputs found, could not make Incident updates.'
    };
    var gr = new GlideRecord('incident');
    gr.addQuery('number', inputs.number);
    gr.setLimit(1);
    gr.query();
    if (gr.next()) {
        gr.description = inputs.description;
        if (inputs.description != '') {
            var updateStatus = gr.update();
            if (updateStatus) {
                return;
            }
            else {
                return {
                    message: 'Incident updates could not be made, update failed.'
                };
            }
        }
        else {
            return {
                message: 'No Incident updates available.'
            };
        }
    } else {
        return {
            message: 'No Incident found, could not update.'
        };
    }
})(inputs);
  • AI instruction : Update the Description of the incident based on the incident number

Q1 : How the tool "Update incident Description" is getting the incident number from as variable are different and the only output for tool 1 is description

Q2 : How the AI agent receive the Description output ?

Q3 : from scripting, how the Input context is set ?

 

Thanks for clarification

Regards

0 REPLIES 0