background-script-execution

A guide to running JavaScript on ServiceNow through a custom REST endpoint or a scheduled job. It explains how each route works and how results are returned.

In plain words
What is it for?
Use it when running background scripts, diagnosing empty responses, checking which execution route was used, or interpreting scheduled-job status.
Why use it?
It helps you understand why a script call may be quick and return output, or fall back to a job that may finish without returning it.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/serac-labs/serac/background-script-execution
Any agent
npx skills add serac-labs/serac --skill background-script-execution
Clone the repo
git clone --depth 1 https://github.com/serac-labs/serac

Made for: Claude Code, Codex.

Per session 54 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,707 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00054 $0.04707
Opus 5 $0.00027 $0.02354
Sonnet 5 $0.00011 $0.00941
Haiku 4.5 $0.00005 $0.00471

Measured 2d ago against content hash 201cc09191df, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

background-script-execution scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

packages/skills/background-script-execution/SKILL.md · 230 lines

How it starts

The opening of the file, as written. The whole thing — 230 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Background Script Execution

snow_execute_script is the most-recommended tool in this catalog and the least explained. It does not use ServiceNow's Scripts - Background module. It ships its own transport, and knowing which of two paths your call took is the difference between reading a real result and reading a placeholder.

The two paths

Sync path Fallback path
metadata.method sync_rest_api sysauto_script_with_trigger, or scheduled_job_pending
How it runs POST to a Scripted REST endpoint Serac installed; the operation evaluates your script inline and returns the result in the HTTP response Creates a sysauto_script job plus a sys_trigger row set to fire two seconds out, then polls sys_properties for a marker the job writes when it finishes
Typical latency 1–3s 4s to the full timeout (default 30s)
You get output Yes, in the response Only if the poll caught the marker before it gave up

Every call tries the sync path first. It falls back the moment the sync POST does not return a usable body — and that includes the case where your script ran and threw, because the endpoint answers a thrown script with HTTP 500 and the client treats any non-2xx as "endpoint didn't work". So a script with a bug in it can be executed up to three times: once by the sync POST, once by the retry after the endpoint is re-verified, once by the scheduled job. Assume a failing script is not executed exactly once, and never let a script that mutates data be the thing you debug through this tool. Get it right in a read-only form first.

The endpoint Serac installs

The first call against an instance deploys a Scripted REST API. Two records, both created through the Table API:

Record Table Key values
Definition sys_ws_definition name = Serac Script Executor, service_id = snow_flow_exec, active = true
Operation sys_ws_operation name = Execute Script, http_method = POST, relative_path = /execute, requires_authentication = true

Read the full file on GitHub · 230 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 230 lines · 54 tokens per session scan A 201cc09191df

Subscribe to this mod's changes

background-script-execution is a skill published in the GitHub repository serac-labs/serac (78 stars, last pushed 7d ago), licensed Apache-2.0. It adds 54 tokens to every session and 4,707 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

xcodebuildmcp-structured-output-review

Use when reviewing XcodeBuildMCP structured output schema changes, schema versioning, manifest outputSchema metadata, and JSON fixture compatibility.

getsentry/XcodeBuildMCP · 37 tokens

opik-diagnose

Surface the Opik traces worth a developer's attention, ranked by signal — errors, failed tool calls, latency, regressions, and low online-eval scores — plus Diagnostics issues. Reads live/production traces via the SDK (searchtraces and agentinsights) and works with no MCP; uses the MCP issue entity when connected.…

comet-ml/opik-mcp · 147 tokens

cortex-automate

Set up automation — prospective memory triggers, neuro-symbolic rules, and CLAUDE.md sync. Use when the user says 'remind me when', 'trigger when', 'create a rule', 'auto-remember', 'sync to CLAUDE.md', 'push insights', 'set up trigger', 'when I open this file', 'when this keyword appears', or when you want to…

cdeust/Cortex · 93 tokens

tabnexus-mcp-evals

Generate, validate, and run isolated Codex-to-TabNexus MCP evaluations with a curated 600-query dataset, executable gold tool labels, safety checks, and best-of-three stability scoring. Use when testing TabNexus MCP tool coverage, Agent behavior, regression quality, destructive-action safety, prompt changes, or a…

KaichenCurry/TabNexus · 75 tokens

compare

Structured comparison of 2+ alternatives with consistent criteria and decision matrix.

n24q02m/wet-mcp · 15 tokens

daily-task-prep

Morning preparation. Calendar lookahead, meeting context loading, open threads from yesterday, active task review. Extends briefing with actionable prep.

timurgaleev/memex · 33 tokens