Skip to content
Browse topics

Scripts, automations a person approves

What a script is, how to write one, what it may do, how it is approved and published, how to see its runs and how an AI agent proposes one.

Updated November 6, 2026

On this page

A script is a small automation written in JavaScript that works over Nori's API. It is for repetitive work no screen does in one go: a weekly sales summary, a check of items out of stock or a notice built from data of several modules. You find them in AI › Scripts.

What a script is

  • It runs in an isolated sandbox: it sees no files, no database and no internet. The only thing it can do is call your company's Nori API.
  • It runs as a user (a person or an AI agent) and can never do more than that user.
  • Only the published version runs. Every change is a new version that someone allowed reviews before it runs.
  • It can run on request, at a time (daily, weekly or monthly) or when something happens, such as a new sales order.

Writing a script

  1. In AI › Scripts, choose New script.
  2. Write the code. It is the body of a function: use await nori.get('/documents', { type: 'invoice' }) to read, nori.log('text') to write to the log and return to give back the result.
  3. Tick in What it may do only what the script needs.
  4. Choose who it runs as, when it runs and its limits of time, calls and output size.
  5. Save the draft. Test runs it as you, with read permissions only, to see what it returns.

Nori checks the code before submitting it: it does not accept import, eval, Function, fetch, timers, globalThis or Deno. If something fails, the screen says on which line.

What a script may do

Each script declares its permissions, for example "read items" or "create, change and send sales documents". The screen shows them as a sentence: "This script will be able to: read sales documents".

  • What it did not declare, the API refuses even if the user could do it.
  • What it declared, it can only do if the user it runs as also has that permission in their role.
  • By default a script only reads. What changes data is ticked apart and highlighted for the approver.

Each run gets an access that lasts minutes and is deleted when it ends. That access cannot sign in or reach other parts of Nori.

Approving and publishing

  1. When the draft is ready, choose Submit for approval.
  2. Whoever has the permission Approve, publish and roll back scripts (usually the administrator) sees the version with its changes against the published one, what it may do, who it runs as and its limits.
  3. Choose Approve and publish or Reject, with a comment if you like.

If a new version causes trouble, in Versions choose Go back to this version on the previous one: from then on it is the one that runs. Turn off stops the script without deleting it.

Runs and log

Each script keeps its runs: who asked for it, who it ran as, how long it took, the output or the error. Opening a run shows:

  • Output: what the script returned.
  • Script log: what it wrote with nori.log.
  • API calls: every call with its answer, including those the API refused.

Every version change, publication, rejection or rollback stays in the script's History with who did it.

When an AI agent proposes a script

The assistant and the AI agents with the permission Write and test scripts can propose a script or a new version. That proposal never publishes by itself, however much autonomy the agent has:

  1. The proposal arrives in AI › Agent approvals with the code, what it may do and the changes.
  2. Only a person allowed to publish scripts can approve it. Once approved it is published.
  3. The script runs as the agent that proposed it, with its role's permissions.

An agent can also run published scripts. A read-only script runs right away; one that changes data waits for approval like any other action of the agent.

Permissions

Permission What it allows
Run published scripts Use scripts from the assistant or an agent
Write and test scripts Create drafts, test them, submit them for approval and run them
Approve, publish and roll back scripts Publish, reject, go back to an earlier version, turn on and off

You assign them in each user's role. See Roles and permissions.

If scripts are off

If the screen warns that the program that runs scripts is missing, the server does not have it installed yet. You can write and approve scripts; they will run once it is installed.

Related articles

Can't find something?

Tell us what you need to do and we'll get back to you. If you're already a customer, include your company's name.

Contact us