We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Trigger AI agents from a script

karthiknarl
Giga Contributor

Hi, 
Does anyone has experience of invoking an AI agent from a script such as script include, business rule etc ? Is there an API existing for this ?

 

1 ACCEPTED SOLUTION

warren_chan
ServiceNow Employee

Not for an AI Agent specifically, but for an Agentic Workflow, you can do this:

 

var request = {
	targetRecordId: "25b65a1c936339100c8a30118bba10c7",
	targetTable: "incident",
	usecaseId: "78c687369f19d2d02b2d1597d90a1c97",
	conversationUser: "46d44a23a9fe19810012d100cca80666",
	objective: "Help me resolve the incident INC0010252",
	conversationLabel: "INC0010252: Incident Resolution"
};
var aiAgentRuntimeUtil = new AiAgentRuntimeUtil();
var response = aiAgentRuntimeUtil.startAiAgentConversation(request);
gs.info(JSON.stringify(response));

Also discussed here:

 

https://www.servicenow.com/docs/bundle/zurich-intelligent-experiences/page/administer/now-assist-ai-...

 

https://www.servicenow.com/community/developer-forum/how-to-call-agentic-ai-via-rest-api-call/td-p/3...

View solution in original post

6 REPLIES 6

No, I do not believe so. The Agentic AI capabilities work off of their own queue, so it wouldn't be possible to thread within some other execution/process.'

 

You can try invoking your AI agent via Subflow + Flow Action. I think if you do it this way, you have more options for how to handle the response.

Hi Warren, thankyou for your reply.
Could you tell me if we can wrap our Agentic Ai Workflow inside a gen_ai_skill.
and invoke the skill through the NAP panel.
Rather than making the workflow discoverable and be it available on all the NAP Panels.