How to call Now Assist Skills or AI Agent Studio agents via REST API from server-side script?

FrancescoF82933
Tera Contributor

Hi everyone,

I'm working on integrating either a Now Assist Skill or an AI Agent Studio agent into a server-side script (background script in ServiceNow).

Context:

  • I have a custom Now Assist Skill and/or an AI Agent created in AI Agent Studio
  • I need to call one of them from a server-side script to process conversation data and return a response
  • Both have multiple input parameters that need to be passed

What I've tried:

  • REST API endpoint: POST /api/now/v2/assist/skills/execute with skill_name
  • REST API endpoint: POST /api/now/v2/agents/execute with agent_id
  • Both return 401 Unauthorized even with Basic Auth credentials

Question: What is the correct way to invoke a Now Assist Skill or an AI Agent from a server-side script? Is there a specific API endpoint, authentication method, or ServiceNow class I should use?

Any guidance would be appreciated!

Thanks, Francesco

0 REPLIES 0