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

1 ACCEPTED SOLUTION

rpriyadarshy
Tera Guru

If you see the Logs Its done by - Gen AI - AIA ReAct Engine.

 

From The Prompt INPUT is collected and AIA REACT Engine basically selects the tool for execution and pass those parameters to tool. AIA REACT engine how it does this is Service-now Internal.

 

 

Regards

RP

 

 

 

View solution in original post

3 REPLIES 3

rpriyadarshy
Tera Guru

If you see the Logs Its done by - Gen AI - AIA ReAct Engine.

 

From The Prompt INPUT is collected and AIA REACT Engine basically selects the tool for execution and pass those parameters to tool. AIA REACT engine how it does this is Service-now Internal.

 

 

Regards

RP

 

 

 

hello @rpriyadarshy thanks for your reply.
Is there some links in serviceNow learning or others which explain how to use paramters and reference this in AI Agent ?

@User687957  You Can try some NASK related Labs & AI Agent Labs. There Are Many details which ServiceNow do not expose in GA World as Its their Internal receipe.

 

 

 

Learning Course - ServiceNow University

 

There are Few Back-end Table which can give you some glimpse of Planning and execution.

Execution Plans [sn_aia_execution_plan]List of plan executions by conversation ID.
Execution Tasks [sn_aia_execution_task]List of tasks by execution plan ID.

 

SS for ur reference

 

 

 

Regards

RP