Skip to main content

AutessaScript

AutessaScript is sandboxed JavaScript that runs server-side on the Autessa platform. It powers the AUTESSA_SCRIPT tool type and AutessaDB computed columns, letting you write custom logic — transforms, validations, HTTP calls, LLM invocations, and multi-tool orchestration — without deploying any infrastructure of your own.

What it is​

AutessaScript is standard ECMAScript executed by a hardened, sandboxed JavaScript engine. Your script receives its inputs through a variables binding, does its work synchronously, and hands back a single result via response.setResponse(...). Alongside the four global bindings (console, response, variables, responseStream), a set of helper libraries — api, llm, connector, tools, mathUtils, waitUtils — provide the only doors out of the sandbox: HTTP requests, LLM calls, connector credentials, and invocations of your other published tools.

There is no filesystem, no network access outside the helpers, no Java interop, and no async runtime. Scripts are plain, synchronous JavaScript from top to bottom. See The sandbox for exactly what is and isn't available.

When to use it​

Agents call tools, and most tools are declarative configs — an API_CALL hits one endpoint, an LLM_CALL runs one prompt. Reach for AUTESSA_SCRIPT when a single declarative tool isn't enough:

  • Custom logic — validate inputs, branch on values, compute derived data before deciding what to do.
  • Chaining — call an API, feed the result to an LLM, then write the outcome to AutessaDB, all inside one tool invocation via tools.invokeById.
  • Transforms — reshape a third-party API response into exactly the JSON your agent or table expects.
  • Direct third-party access — pull an OAuth token from a connector and call the vendor's API in whatever shape it demands.

If one HTTP request or one LLM prompt does the job, prefer the plain API_CALL or LLM_CALL tool type — less code to maintain, and the config is inspectable at a glance.

A minimal working example​

A script tool declares arguments the same way every tool does — as @@{name} placeholders — and those arrive in the variables binding. The one hard rule: you must call response.setResponse(...), or the script produces no output at all.

// Tool argument "customerName" arrives as a variable.
const name = variables.get("customerName");

if (!name || name.trim() === "") {
response.setResponse(JSON.stringify({ error: "customerName is required" }));
} else {
const greeting = "Hello, " + name.trim() + "!";
console.log("Built greeting for", name);
response.setResponse(JSON.stringify({ greeting: greeting }));
}

console.log output lands in the execution logs, and the string passed to response.setResponse becomes the tool's result.

Values returned by variables.get(...) in a tool execution are always strings. Parse numbers with parseInt/parseFloat and JSON payloads with JSON.parse yourself.

Where you write it​

  • Script tools — create a tool with type AUTESSA_SCRIPT in the tool builder. The editor autocompletes helper methods and your declared variables, and Script Copilot can write and debug the script with you. See Tools for the general tool workflow.
  • Computed columns — attach a script to an AutessaDB column and it computes the column's value from the other columns of the row on every insert and update. The execution context is slimmer there; see Computed columns.

In this section​