← ClaudeAtlas

sn-aia-agentslisted

Use BEFORE building, wiring, or debugging ServiceNow AI Agent Studio agents (sn_aia_*) — script-tool contract, trigger/use-case wiring, run-as identity, channels, and the failure-signature playbook. Hard-won on a live dev instance (2026-08); every rule here cost hours to learn.
theogyeezy/skillz · ★ 0 · AI & Automation · score 67
Install: claude install-skill theogyeezy/skillz
# ServiceNow AI Agents (sn_aia) — Build & Debug Playbook ## THE #1 RULE — script tool contract (cost 11 failed runs to find) An `sn_aia_tool` script must be a SELF-INVOKING expression whose value is the result. The executor binds `inputs` into the evaluator scope, evaluates the script column, and takes the resulting VALUE: ```js JSON.stringify((function (inputs) { // GlideRecord logic; multiple `return obj;` points are fine return { success: true }; })(inputs)); ``` A bare `(function (inputs, _agentic_context_) {...})` — the shape found in some OOB tools and in Build-Agent-generated code — evaluates to a function object, never executes, and EVERY call dies as `execution_status=cancelled`, `error_message="undefined"`, `execution_time_ms=0`, in every mode (trigger, playground, chat), under every identity, with zero server-side error at any log level. **Diagnostic shortcut:** healthy tool executions take 50–10000ms. A 0–1ms `cancelled` with error `"undefined"` means the script never ran — check the script shape FIRST, before touching roles, ACLs, channels, or use cases. **Verify a tool exactly as the platform runs it** (via a server-side script runner or background script): ```js var t = new GlideRecord('sn_aia_tool'); t.get('<tool_sys_id>'); var ev = new GlideScopedEvaluator(); ev.putVariable('inputs', { /* real inputs */ }); var result = ev.evaluateScript(t, 'script', null); // string result = it works ``` ## Tool authoring rules - Tool bodies live in external