SutraFlow Administration Guide

Version 2.1.8 · Installing, upgrading, running and securing SutraFlow servers

Getting started

1. What administrators do

SutraFlow has two kinds of people. Designers build Sutras in the studio and release them; the SutraFlow User Guide is theirs. Administrators install and upgrade SutraFlow, run its engines, look after its database, people and security, and receive releases on test and production servers. This guide is theirs.

TaskWhere
Choose a set-up: one server, PostgreSQL, a cluster, DockerPlanning a server
Install a server, by pages in the browser or silently from a fileThe web installer, Silent installation
Upgrade it, with a backup and a way backUpgrading
Start, stop and configure itThe sutraflow command and server settings
Engines, clusters and sizingRunning in production, Setting up a cluster, Sizing
Deployed Sutras, runs, alerts, the gateway, people and the audit logThe Admin Console
Docker and Kubernetes from the start: the words, making the image, upgradingDocker in plain words, Containers and Kubernetes
Take an application from development to test and production, with or without DockerFrom development to production, Adding an application to a running cluster
One Admin Console for a cluster; what happens when the leader stopsOne Admin Console for the whole cluster, Questions from DevOps teams
Releases on test and production serversReceiving releases
Script or automate anything: every endpoint of the admin API, with its permission and sutra commandThe admin API
Health, metrics, traces and logsMonitoring

Designers who also run their own development machine need only The web installer and Development machines.

Who is an administrator

An account with the Administrator role on all projects. The installer makes the first one; more are added under Admin Console, Users. Some tasks need only part of it: the Engines, Gateway, Users and roles, Audit and Server settings permissions are separate, so an operations team can run the servers without designing anything.

2. Planning a server

SutraFlow is one Node.js program. It needs Node.js 22.13 or later (24 recommended) and nothing else: its own data starts in SQLite, built into Node. Everything else is a choice.

Which set-up

Set-upDatabaseGood for
One studioSQLite in the data folderA developer machine, a proof of concept, a small server: about 420 small steps a second, nothing to install
A studio and an engine beside itSQLite or PostgreSQLMore work on one machine, and one keeps serving while the other restarts
A cluster: engines on several machinesPostgreSQL (14 or later, with pgvector for knowledge bases)Failover, more throughput, production apart from design
DockerPostgreSQL in the cluster fileContainers and Kubernetes; one engine per container

The installer asks for each of these. Moving from SQLite to PostgreSQL later takes a minute (Moving to PostgreSQL), so starting small is safe.

Do I need a web server (Apache, IIS, nginx, Laragon, WAMP, LAMP)?

No. SutraFlow has web servers of its own: the studio port serves the designer, Admin Console, Approval Center, the guides and the admin API; the gateway ports serve the deployed Sutras (REST, SOAP, WebSocket, MCP, AI agents) over HTTP and HTTPS, with certificates of your own or from Let's Encrypt, renewed automatically. It needs no PHP and no Apache. Laragon, WAMP or LAMP are only a convenient way to get Node.js, PostgreSQL and MySQL on one machine (Development machines).

Put a web server or load balancer in front of SutraFlow (a reverse proxy) only when one of these applies:

WhenWhy a web server in front helps
Ports 80 and 443 are already used by Apache, IIS or nginx on the machineOnly one program can listen on a port: the existing web server keeps them and passes SutraFlow's addresses (a host name or a path) on to its ports.
Several gateway engines should answer at one addressA load balancer spreads callers over the engines and stops sending to one that is down (health check /ready); see Running in production.
Your organisation requires a central proxy, web application firewall or single TLS entry pointCertificates, logging, IP rules and firewalls stay where the organisation manages them.
A friendly local address on a developer machine, such as http://sutra.testLaragon's Apache gives every project a .test name; SutraFlow keeps its own port behind it.
The studio must be reached from other machinesThe studio listens on 127.0.0.1 by default. A proxy with its own access rules (VPN, single sign-on, IP allow list) is safer than opening the admin port directly.

Otherwise leave it out: a proxy is one more thing to configure, secure and keep running, and SutraFlow's gateway already handles TLS, Let's Encrypt, security policies, rate limits and request size limits itself. When you do use one:

  • List the proxy as trusted: Admin Console → Gateway → Firewall → Trusted proxies, or sutra gateway proxies --trusted 127.0.0.1. From a trusted proxy SutraFlow reads X-Forwarded-For (the caller's address, for the firewall, IP rules, rate limits, logs and sign-in attempts) and X-Forwarded-Proto (HTTPS that the proxy ended, for Require HTTPS and secure cookies); from anyone else it ignores both, so a caller cannot claim another address. Without a trusted proxy, SutraFlow sees the proxy's address for every caller, and a call that reaches it over plain HTTP counts as not HTTPS. List only proxies that replace these headers with their own, and never an address range that callers can reach directly.
  • Or forward to the gateway's HTTPS port (8443): a call that reaches SutraFlow's own HTTPS port is HTTPS without a trusted proxy. Turn Require HTTPS off on a policy only when the link from the proxy to SutraFlow is private and the proxy is not trusted.
  • Pass /.well-known/acme-challenge/ through unchanged if SutraFlow renews its own certificates, keep long-running requests open (AI agents and approvals can take minutes), and allow WebSocket upgrades.

The proxy settings that set the two headers, with SutraFlow's gateway on 127.0.0.1:8080 and the proxy on the same machine (trusted proxy 127.0.0.1):

Web serverSettings
Apache (mod_proxy, mod_headers)ProxyPass "/" "http://127.0.0.1:8080/", ProxyPassReverse "/" "http://127.0.0.1:8080/", RequestHeader set X-Forwarded-Proto "https" in the HTTPS virtual host (Apache adds X-Forwarded-For itself). WebSockets: mod_proxy_wstunnel, or upgrade=websocket on ProxyPass.
nginxproxy_pass http://127.0.0.1:8080; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $host; and for WebSockets proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; Use $remote_addr rather than $proxy_add_x_forwarded_for so a caller's own header is replaced.
IIS (URL Rewrite, Application Request Routing)A reverse-proxy rule to http://127.0.0.1:8080/{R:1}; under Server variables allow HTTP_X_FORWARDED_PROTO and set it to https in the rule; ARR adds X-Forwarded-For when Preserve client IP is on. Enable the WebSocket Protocol feature for WebSocket services.

A release unpacked in a web folder

Every release carries an .htaccess (Apache) and a web.config (IIS) that refuse everything in the folder except one page, install-sutraflow.html. Unpacked under a web root (Laragon's www, htdocs, wwwroot), the web server never serves sutraflow.env, the data folder or the keys; opening the folder in a browser shows that page, which says how to install and start SutraFlow. An upgrade keeps a site's own .htaccess and web.config, and adds the release's when there is none.

Guidelines

Keep the studio on 127.0.0.1: port 4800 is for your team (designer, Admin Console, admin API). Everything others call goes through the gateway ports.
Back up the data folder, and above all data/master.key: without it the encrypted secrets cannot be read (Where SutraFlow keeps its data).

Installing and upgrading

3. The web installer

Each release comes as sutraflow-<version>-windows.zip and sutraflow-<version>-linux.tar.gz, already built, each with a .sha256 file; the -offline archives have the runtime packages inside, for servers without access to the npm registry.

  1. Check the download: sha256sum -c sutraflow-VERSION-linux.tar.gz.sha256, or on Windows Get-FileHash sutraflow-VERSION-windows.zip -Algorithm SHA256 against the .sha256 file.
  2. Unpack it into an empty folder: tar -xzf sutraflow-VERSION-linux.tar.gz -C /opt, or on Windows with Explorer or 7-Zip into C:\SutraFlow.
  3. In that folder run bin/sutraflow install (Windows: bin\sutraflow.cmd install).

The installer starts on this machine only, at 127.0.0.1 on a free port from 4790, with a one-time address that it opens in the browser (--no-open prints it instead; --port chooses the port). Nobody else, and no other web page in the browser, can drive it. Nothing changes until you choose Install on the Review page.

Welcome

The system check: Node.js version, a folder it can write, the runtime packages and free disk space. A missing requirement stops it here with what to do. Choose Install for a new SutraFlow in this folder, or Upgrade to bring another installation up to this version (or to put this version back over a damaged one) (Upgrading).

Welcome: the system check, and Install or Upgrade.
Welcome: the system check, and Install or Upgrade.

Administrator

The first account, which manages users, roles, projects and the server: user name, optional email, and a password of at least 12 characters with upper and lower case letters and digits, typed twice. It is not made when the database already holds accounts.

Administrator: the first account.
Administrator: the first account.

Database

  • SQLite: a file in the data folder, sutra.db or a name you give. Nothing to install. SQLite has no user names or passwords: the file is protected by the data folder's permissions, and SutraFlow's vault encrypts the secrets inside it with data/master.key.
  • PostgreSQL: host, port, database, user, password and SSL (off on this machine or a trusted network, require to encrypt, verify to also check the certificate, for hosted PostgreSQL). Create it when missing makes the database when the user may (CREATEDB). pgvector is required by default: Test connection enables it in the database when it is installed on the server, or says how to install it; choose Continue without pgvector only when no knowledge base will be kept in PostgreSQL. Next stays closed until the test passes. The password is kept in sutraflow.env as SUTRA_DB_PASSWORD, readable by this server's account only, apart from the address.
Database: PostgreSQL tested, with pgvector enabled in the new database.
Database: PostgreSQL tested, with pgvector enabled in the new database.

Server

Where SutraFlow listens: 127.0.0.1 (this machine, recommended; put a proxy in front to reach it from elsewhere) or 0.0.0.0; the environment (development, test or production: a production server takes Sutras only from releases); the studio port (4800) and the gateway ports (8080 and 8443). A headless engine beside it adds a second process on the same database, with its own ports. Check ports tests each one; a busy port gets a free one suggested, and Use the free ports takes them.

Server name and HTTPS: Server name is the address people and callers use when it is not the listening address, behind a proxy or a DNS name (https://sutra.example.com): single sign-on, OAuth and links use it (SUTRA_PUBLIC_URL). Gateway certificate chooses the HTTPS port's certificate: Off; Self-signed for testing; My certificate files (the certificate with its chain and the private key, as PEM files on this server: checked against each other, and the key kept encrypted in the vault); or Let's Encrypt with the domain names, a contact email, staging or production, and agreement to its subscriber agreement (the gateway's HTTP port must answer as port 80 for those names while the certificate is made and renewed). Everything is changed later in the Admin Console (Server, Gateway & TLS).

Node memory: each engine is its own Node.js process with its own memory. 0 lets Node.js decide; the page shows this machine's memory and a suggested size, and Use N MB takes it. It can be changed later in the Admin Console (Engines, Tuning) and applies at a restart.

Server: ports checked free, an engine beside the studio, and Node memory.
Server: ports checked free, an engine beside the studio, and Node memory.

Cluster

The engines that share the work through one database. The cluster name is shown in the Admin Console. Each engine has a name (this server's and the one beside it are filled in from the computer name) and May lead: the leader runs timers, listeners, recovery and housekeeping, and is elected among the engines that may lead; another takes over when it stops. Allowing only one fixes the leader, without failover, and the page says so. With PostgreSQL, Add an engine on another machine adds engines with their own ports and memory; each gets a settings file to copy to its machine. Names, the cluster name and who may lead are changed later in Admin Console, Engines.

Steps at once per engine: how many steps it runs at the same moment; 0 takes the recommendation for that machine (written as STUDIO_WORKERS, ENGINE_WORKERS, and in each further engine's settings file). Heartbeat: how often each engine reports in; an engine silent for three beats is taken as stopped and its steps go to the others (SUTRA_HEARTBEAT_MS, 5 seconds by default). Finish steps on stop: how long a stopping engine lets its running steps finish (SUTRA_DRAIN_MS, 30 seconds). When the studio and an engine beside it start, the install checks that both beat in the shared database (Engines see each other).

An engine added after the install gets its settings file from the installed server: sutraflow engine-file shop-3 [--host 0.0.0.0] [--port 4801] [--http 9080] [--https 9443] [--workers 12] writes sutraflow-engine-shop-3.env beside sutraflow.env: the same database address (without its password: set SUTRA_DB_PASSWORD on that machine), heartbeat, drain and environment, and the engine's own name and ports. Put it beside the same release on the new machine as sutraflow.env, copy data/master.key, and sutraflow start engine; it shows in Engines once it beats. PostgreSQL only.

Cluster: its name, the engines and who may lead, with an engine on another machine.
Cluster: its name, the engines and who may lead, with an engine on another machine.

Review

Everything once more, with the server name and the gateway certificate. Add the sample Sutras makes a project named Samples with every sample to learn from (none is deployed), the same as adding them from New Sutra, Samples; they can be added or removed later with their data (Samples and their data). Save answers as a config file writes sutraflow-install.json: the same choices for a silent install of the next server (Silent installation). Its passwords are environment variables to set there, never the passwords themselves. Start SutraFlow when installed starts the studio, and the engine beside it when there is one.

Review: the choices, saving them as a config file, and starting when installed.
Review: the choices, saving them as a config file, and starting when installed.

Install and Done

Each step with its result: settings file, data folder, the master key, tables and the administrator, the admin token, and the start. When it is done the page gives the address to sign in at, a settings file for each further engine, and the installer's log (also kept in data/logs/installer.log). The installer then locks itself (data/install.lock), so it cannot be run over a working installation; sutraflow install --reset removes the lock.

Keep these in a safe place: when the install made a new master key and admin token, the last page shows them once, each with a Copy button and the file it is kept in. The master key unlocks the vault: without it, the passwords and keys stored in SutraFlow cannot be read, so keep a copy away from the server, in a password manager. The admin token runs the sutra command and the launcher against this server. Tick I have kept a copy and choose Hide them: the installer forgets them. They are never written to the installer's log or the saved answers. A key or token already in the data folder (an install over kept data) is kept and not shown.

The master key and the admin token

The installer makes two small files in the data folder. Both are secrets; treat them like the keys to the server.

Master key (data/master.key)Admin token (data/admin-token.txt)
What it isThe key that encrypts every secret SutraFlow stores: database passwords, API keys, OAuth tokens, Git tokens, certificate private keys, the gateway's TLS key.A full-rights key for the admin API, used without a password by the sutra command and the launcher (sutraflow stop, status, cli), and by scripts and CI pipelines that manage this server.
If it is lostThe stored secrets can never be read again, and every connection has to be entered again by hand. This happens after a disk failure, a move to a new server, or a restore of a backup without the key. There is no way to recover it.Nothing is lost: make a new one (below).
If someone else gets itWith a copy of the database or its backups, they can read every stored secret. Change the passwords and keys of the connections.They can manage the server through the admin API. Make a new one at once.
ClusterEvery engine must have the same key: copy the file, or set SUTRA_MASTER_KEY on every engine from your secret store.Each machine has its own; engines on other machines use their own token, or SUTRA_ADMIN_TOKEN.
BackupKeep a copy away from the server, apart from the database backups (a password manager or the organisation's secret store). A stolen database backup without the key reveals no secrets.No backup needed.
Make a new oneNot possible without losing the stored secrets.Stop SutraFlow, delete data/admin-token.txt, start it: the launcher makes a new token. Update scripts and pipelines that used the old one.

That is why the installer shows both once on its last page: copy the master key into a password manager before you leave the page. The silent installer prints only where the files are. An upgrade keeps both files and backs up the data folder with them.

Installing: each step as it runs.
Installing: each step as it runs.
Done: where to sign in, the log, and the installer locked.
Done: where to sign in, the log, and the installer locked.
After installing

Keep a copy of data/master.key away from the server: it unlocks the vault, and without it the stored secrets are lost (The master key and the admin token).
Start SutraFlow with the machine: sutraflow service prints a Windows scheduled task or a Linux systemd unit.
Sign in to the Admin Console and add the people who will use it (Users).

4. Silent installation

For scripts and many servers, the same steps run from a JSON or YAML file (a file ending in .yaml or .yml), without a browser:

bin/sutraflow install --config install.json [--dry-run]

Take the file the web installer saved on its Review page, or start from docs/install-example.json in the release, which shows every field. Passwords are never written in the file: give {"env": "NAME"} (an environment variable) or {"file": "path"} (a file holding only the password).

{
  "admin": { "username": "admin", "password": { "env": "SUTRA_INSTALL_ADMIN_PASSWORD" } },
  "database": { "kind": "postgres", "host": "db.internal", "database": "sutraflow", "user": "sutraflow",
                "password": { "env": "SUTRA_INSTALL_DB_PASSWORD" }, "sslMode": "verify", "create": true },
  "server": { "studioPort": 4800, "gatewayHttp": 8080, "gatewayHttps": 8443, "environment": "production" },
  "cluster": { "name": "Production" },
  "start": true
}
  • The whole file is checked first: every problem (a weak password, a busy port, a database that cannot be reached, pgvector missing) is reported at once, before anything changes.
  • --dry-run checks the file and prints the plan.
  • Exit code 0 when done, 1 when a step failed, 2 when the file is wrong. Progress goes to the terminal and to data/logs/installer.log.
  • Settings files for further cluster engines are written beside it as sutraflow-engine-<name>.env.
  • The master key and admin token are not printed (a silent install's output often ends up in a build log): the last line says where they are, data/master.key and data/admin-token.txt. Copy the master key to a safe place from there (see The master key and the admin token in The web installer).

Silent upgrade

bin/sutraflow upgrade --config upgrade.json [--dry-run]
{ "from": "/opt/sutraflow", "backupDir": "/backups/sutraflow", "start": true }

Run it from the new release's folder; the steps are those of Upgrading, with the same exit codes. To put the same version's program files back over a damaged installation, add "reinstall": true: see Reinstalling the same version in Upgrading.

Samples in scripts

The install file's "samples": true adds the sample Sutras (default false: leave it off for production). The upgrade file takes "samples": keep (default), add (when there are none), remove (the samples and their sample_ data) or refresh (remove, then add the new version's). They run after the data has been compared, so a sample connection that cannot be reached does not undo the upgrade: it is reported, its sample data stays, and sutraflow samples remove can be run again.

# Upgrade a production server and make sure no samples are left (Linux)
cd /opt/releases/sutraflow-2.1.8
cat > upgrade.json <<'JSON'
{ "from": "/opt/sutraflow", "backupDir": "/backups/sutraflow", "samples": "remove", "start": true }
JSON
bin/sutraflow upgrade --config upgrade.json --dry-run   # the plan
bin/sutraflow upgrade --config upgrade.json

# Windows (PowerShell), a training server with the new samples
Set-Content upgrade.json '{ "from": "C:/laragon/www/sutra", "samples": "refresh", "start": true }'
bin\sutraflow.cmd upgrade --config upgrade.json

# Afterwards, at any time, from the installed folder
bin/sutraflow samples list
bin/sutraflow samples remove

5. Samples and their data

The samples are Sutras to learn from. Everything they store is named sample_<objective>: the MySQL database sample_sutraflow with its tables sample_sales_orders, sample_products, sample_customers and sample_orders, the SQLite file sample_sutraflow.sqlite, the MongoDB collection sample_orders, counters such as sample_channel_orders, queues such as sample_orders.in, and the folders sample_csv, sample_inbox, sample_outbox, sample_documents, sample_scripts and sample_validation in the project's files folder (project properties such as SAMPLE_CSV_FOLDER name them). That is how the installer tells sample data from a site's own data. Sutras keep the names Sample: ... and connections Sample ....

A new install adds no samples unless Add the sample Sutras is ticked on its Review page; no knowledge base, no AI provider and no sample data is set up by default.

When to add them, and when not

ServerSamplesWhy
A designer's own machine, training, a proof of conceptAddWorking examples of every palette, ready to copy into real Sutras; the chat, knowledge and dashboard samples show how AI applications are put together (Design Guide, Designing an AI application from the samples).
A shared development or test serverAdd when the team learns from them; remove before the server is used for acceptance testsTheir Sutras, connections and sample_ tables sit beside the team's work and can be removed in one go.
ProductionDo not addNothing in production should run demo Sutras or hold demo data and demo connections. A sample a team wants in production is copied into a project of its own, renamed without sample_ names, reviewed and deployed like any other Sutra.
A server that had them and goes liveRemovesutraflow samples list, check the list, then sutraflow samples remove, or choose Remove on the upgrade's Review page.
A server upgraded with samples keptRefresh when the new samples are wantedSamples are the project's own copies and an upgrade keeps them; Refresh removes them and adds the new version's.

Samples never send anything on their own: none is deployed when added, and the ones that need an outside service (a database, an AI provider, a broker) are placeholders until their Sample ... connection is filled in.

Adding or removing them later

Run bin/sutraflow install and choose Samples on the first page (the installer of the same version as the installation). Installation finds it (this folder unless you give another); on Review choose Add or Remove, then List: it reads what is there and changes nothing.

  • Add makes the project Samples with every sample, as on install. A site that has them already is told so: remove them first to add them fresh.
  • Remove lists, and then deletes: the sample Sutras (deployed or not); the Sample ... connections nothing else uses, with their knowledge, AI memory and memory tables; sample schemas and counters; the project properties the samples added that nothing uses; sample_ files and folders in each project's files folder and the data folder; the project Samples when it is empty. Through each Sample ... database, MongoDB, SFTP or FTP connection it drops the sample_ databases, schemas, tables, views, procedures, collections, files and folders there. A database connection that names its database is worked in that database only.
  • Kept: anything not named as sample data, and a Sample ... connection one of your own Sutras uses (listed as kept, with the Sutra).
  • Earlier versions' sample names are recognised: the MySQL database sutraflow_samples (its sample tables and procedure, and the database when nothing else is in it), samples.sqlite, the collection sutraflow_sample_orders, counters sample-..., the folder validation-samples, the sample documents and script, C:/sutra/samples, inbox and outbox, and outbox/orders.csv and archive/orders-*.csv on a Sample SFTP or FTP server.
  • Not reached: messages in sample queues and topics on brokers, and data in cloud services (Firebase, Dropbox, Google, YouTube); remove them there. Placeholder connections never filled in (an example.com host, no password) are skipped.
The Samples mode: Remove, then List shows everything named as sample data before anything changes.
The Samples mode: Remove, then List shows everything named as sample data before anything changes.

Tick I have read the list and choose Remove samples: SutraFlow is stopped (the studio and the engine beside it), the samples are removed, and it starts again. Removing cannot be undone: back up first if in doubt. Other engines of a cluster keep the sample Sutras they loaded until they restart.

From the command line

bin/sutraflow samples list   [--folder /opt/sutraflow]
bin/sutraflow samples add    [--folder /opt/sutraflow] [--no-start]
bin/sutraflow samples remove [--folder /opt/sutraflow] [--no-start]

list prints what remove would delete. The exit code is 1 when something could not be reached or removed (its sample data stays), 2 for a wrong command.

Your own samples

A Sutra you build from a sample for real use should drop the sample names: rename its tables, folders and queues, and the connections it uses. Data you keep under a sample_ name is removed with the samples.

6. Upgrading

Unpack the new release beside the installation (a folder of its own, never over it) and run bin/sutraflow upgrade from the new folder (Windows: bin\sutraflow.cmd upgrade). The installer opens on the Upgrade pages. It upgrades installations of 2.1.0 or later; an older one is upgraded by hand (below).

Example: a Laragon installation from 2.1.7 to 2.1.8

SutraFlow runs from C:\laragon\www\sutra (studio on 4810, data in C:\laragon\data\sutraflow, PostgreSQL). The new release goes into a folder of its own; the installation is never unzipped over.

  1. Unpack sutraflow-2.1.8-windows-x64-offline.zip anywhere else, for example C:\SutraFlow-2.1.8.
  2. From that folder run bin\sutraflow.cmd upgrade. The upgrade pages open in the browser.
  3. On Installation give C:\laragon\www\sutra and choose Check: it shows 2.1.7, its PostgreSQL database and data folder.
  4. On Review keep the backup folder empty (it becomes C:\laragon\www\sutra\backups\2.1.7-<time>) and Start it again ticked; choose Upgrade.
  5. When Done says 2.1.7 to 2.1.8, SutraFlow answers on 4810 again with the new version. C:\SutraFlow-2.1.8 can be deleted; 4810 keeps running from C:\laragon\www\sutra.

Apache, a terminal or Explorer open in C:\laragon\www\sutra can stay open. Unzipping over the installation yourself is the manual way below: it has no backup and no way back of its own.

Deployed Sutras and work in flight

  • Deployed Sutras stay deployed at their versions: they are in the database, which the upgrade keeps (and compares).
  • Samples already added to projects are the projects' own copies and stay as they are. Adding a sample again from New Sutra, Samples gives the new version, as new Sutras with new ids, beside the old ones.
  • Samples on the Review page: Keep (default), Add when none, Remove (the samples and their sample_ data, after the upgrade) or Refresh (remove, then add this version's). Production servers choose Remove if they ever had samples; see Samples and their data for what is removed. Earlier versions' sample names are recognised.
  • The stop is graceful: running steps finish first.
  • Waiting work (approvals, timers, queued runs, steps waiting to retry, runs waiting for a connection) is kept in the database and taken up by the new version when it starts.
  • During the upgrade the gateway does not answer: callers of REST, SOAP and MCP services get no reply for those minutes, and listeners pick up files and messages afterwards. Choose a quiet time. In a cluster, upgrade every engine's folder before starting any (below).

Engines and the cluster after installing

The upgrade keeps every engine and cluster setting as it is. They are changed at any time, without upgrading, in the Admin Console:

SettingAt installationLater
Cluster nameCluster pageEngines, Rename the cluster; sutra engines cluster-name "Shop cluster"
Engine names people readCluster pageEngines, Rename; sutra engines name <id> "Shop engine 2"
Engine id (SUTRA_ENGINE_ID)Cluster pageStays: the steps an engine ran record it. Only its display name changes
May leadCluster pageEngines, Never lead / May lead; sutra engines lead <engine> --yes|--no
Node memory of each engineServer and Cluster pagesEngines, Tuning, Node memory, then Restart
An engine beside the studioServer pageIts ports in sutraflow.env (ENGINE_PORT, ENGINE_GATEWAY_HTTP, ENGINE_GATEWAY_HTTPS), then sutraflow start engine
An engine on another machineCluster page writes its settings fileInstall the same version there with the same SUTRA_DB and a copy of data/master.key, then sutraflow start engine (Setting up a cluster)

Installation

Give the folder of the installation, for example C:\laragon\www\sutra or /opt/sutraflow, and choose Check: it shows the version, the database, the data folder and the address found there, and whether it can be upgraded to this version.

Ports need not be given. The upgrade reads them, with the data folder and the database, from the installation's own sutraflow.env, uses them to stop and start it and to check that it answers, and keeps them. This holds for SutraFlow started through its launcher (sutraflow start, the Laragon Procfile, the Windows task or systemd unit of sutraflow service). A process started by hand with other settings in its environment cannot be reached by the upgrade: stop it yourself first.

Installation: the folder checked, with its version, database, data folder and address.
Installation: the folder checked, with its version, database, data folder and address.

Review

The version from and to, the backup folder (empty means backups inside the installation) and what happens to the samples. Nothing changes until you choose Upgrade (Reinstall for the same version).

Review: from and to, the backup folder, and starting it again.
Review: from and to, the backup folder, and starting it again.

What the upgrade does

  1. Snapshot of the data: every table's row count and a checksum, read without changing anything.
  2. Stop: the studio and the engine beside it stop gracefully: no new work, running steps finish (the engine beside the studio stops too, so nothing runs on a program or database that is changing).
  3. Program files free: every program file must be replaceable. A file another program holds without sharing stops the upgrade here, before anything changes, with the file and, on Windows, the process that holds it (its id and name), so you can stop that program and run the upgrade again. A folder that is merely open, a web server such as Apache or IIS serving from it, a terminal or Explorer in it, does not stop it.
  4. Backup into backups/<old version>-<time>: the data folder with master.key, sutraflow.env, and for PostgreSQL a pg_dump that is read back with pg_restore --list before anything changes (a backup that cannot be read stops the upgrade here). Without pg_dump on the machine, SutraFlow copies the database itself.
  5. Move the old runtime aside into the backup, and install the new one. A folder another program is in cannot be moved on Windows: it is copied into the backup and its files are replaced in place instead, and the step says which. The data folder, sutraflow.env and a site's own .htaccess and web.config stay where they are.
  6. New settings are added to sutraflow.env with their defaults; your values are kept.
  7. Database changes of the new version, then Compare the data with the snapshot: every table must hold what it held.
  8. Samples (when chosen): removed, added or refreshed; a problem here is reported and the upgrade is kept.
  9. Start and Check: the studio, and the engine beside it if it was running, start again and must answer with the new version.
Upgrading: each step with its result.
Upgrading: each step with its result.
Done: from and to, and where the backup is.
Done: from and to, and where the backup is.

When a step fails

The previous version is put back: the old runtime, the data folder and sutraflow.env from the backup, the database from its dump, and the previous version started again. The page and data/logs/installer.log say which step failed and why. A database restore waits at most a minute for tables another process still holds (an engine on another machine of the cluster) and then reports that the database was not restored, with the backup to restore by hand, instead of waiting for ever.

Reinstalling the same version (a repair)

When an installation already runs the version of the package, Check says so, and the upgrade does not run by itself. If its program files are damaged or were changed by hand (a deleted folder, an edited file, a failed copy), tick Reinstall on the Installation page and choose Reinstall on Review: the same steps as an upgrade put this package's program files in place again.

  • The data folder, sutraflow.env, the database, deployed Sutras and a site's own .htaccess or web.config stay; they are backed up and compared all the same.
  • The old program files go into the backup (backups/<version>-<time>/runtime), so a file changed on purpose can be taken back from there.
  • An installation whose launcher (bin/sutraflow.mjs) is missing can be reinstalled too, as long as its package.json and sutraflow.env are there. If its launcher cannot stop it, the reinstall goes on only when SutraFlow is not answering on its address.
  • Settings the package has and the installation lacks are added with their defaults; there are no database changes within one version.
  • A failed step puts the previous files back, as for an upgrade.
  • An installation newer than the package is never taken back to an older version.
# Silent (Windows PowerShell), from the unpacked package of the same version
Set-Content upgrade.json '{ "from": "C:/laragon/www/sutra", "reinstall": true, "start": true }'
bin\sutraflow.cmd upgrade --config upgrade.json --dry-run
bin\sutraflow.cmd upgrade --config upgrade.json

The installer's lock file in the data folder records "by": "reinstall". Do not unzip a package over an installation to repair it: that has no backup and leaves files the package no longer has.

Clusters

Stop the engines on the other machines first, upgrade every engine's folder, then start them. Engines of different versions must not run on one database: the newer version's database changes are made for its own program.

By hand, and from before 2.1.0

  1. Stop gracefully: sutraflow stop all.
  2. Back up the data folder (with master.key) and, for PostgreSQL, the database (pg_dump -Fc).
  3. Unpack the new release beside the old one; bring over sutraflow.env and the data folder (or keep SUTRA_DATA_DIR pointing at it).
  4. sutraflow setup (installs the runtime packages unless the release is offline), then sutraflow start. The database is upgraded at start.
Before an upgrade

Read the release notes' What changes for you.
Make sure the backup folder has room for the data folder and a dump of the database.
Keep the backup until the new version has run for a while: it is the way back.

7. Development machines: Laragon and Linux

Windows: Laragon

For development and proofs of concept on Windows, Laragon is a convenient base: one installer brings Apache, MySQL, PostgreSQL, PHP, Node.js and HeidiSQL, starts them from one window, and keeps everything under C:\laragon. The DB Ops samples use its MySQL as it comes (127.0.0.1:3306, user root, no password), and SutraFlow can keep its own data in its PostgreSQL.

  1. Install Laragon (the full edition) and click Start All.
  2. Unpack a release into C:\laragon\www\sutra and run bin\sutraflow.cmd install; or copy deploy/laragon/sutraflow.env beside it for the usual Laragon layout: studio on 4810 (gateway 8090), engine on 4811 (gateway 8091), data in C:\laragon\data\sutraflow outside the web folder.
  3. For http://sutra.test, copy deploy/laragon/01-sutra.conf to C:\laragon\etc\apache2\sites-enabled: it loads Apache's proxy modules and forwards the name to the studio.
  4. Let Laragon start it: Menu > Procfile, add SutraFlow: autorun C:\laragon\www\sutra\bin\sutraflow.cmd start --foreground PWD=www/sutra.
  5. Every other command is the launcher: bin\sutraflow.cmd status, stop all, start engine, cli sutras list, open admin.

HeidiSQL and PostgreSQL

HeidiSQL needs the PostgreSQL client library to open a PostgreSQL session; without it the connection fails with a missing libpq.dll. Choose the library in the session's Library field from C:\laragon\bin\postgresql\<version>\bin\libpq.dll, or copy libpq.dll with the libcrypto-*.dll and libssl-*.dll (and, when present, libiconv-*.dll and libintl-*.dll) from that folder into C:\laragon\bin\heidisql. pgAdmin and DBeaver bring their own drivers.

pgvector for Laragon's PostgreSQL

A knowledge base stored in PostgreSQL needs the pgvector extension, and the installer requires it unless you go on without it. Laragon's PostgreSQL does not include it; add a Windows build for the same major version:

  1. Find the version: in Laragon's terminal run postgres -V (for example 18).
  2. Download a Windows x64 build of pgvector for that version. pgvector itself publishes source only; community builds exist (for example the pgvector_pgsql_windows releases on GitHub). Use one you trust.
  3. Stop PostgreSQL in Laragon; copy lib\vector.dll into C:\laragon\bin\postgresql\<version>\lib\ and the files of share\extension\ into C:\laragon\bin\postgresql\<version>\share\extension\; start it again.
  4. Check: SELECT name, default_version FROM pg_available_extensions WHERE name = 'vector'; returns a row. The installer's Test connection then enables it.

Linux

PartDebian / UbuntuFedora / RHEL
Node.js 24Through nvm (nvm install 24), or the NodeSource packages.
MySQL or MariaDBsudo apt install mariadb-serversudo dnf install mariadb-server
PostgreSQLsudo apt install postgresql (newer versions from the PostgreSQL apt repository)sudo dnf install postgresql-server, then sudo postgresql-setup --initdb
pgvectorsudo apt install postgresql-<version>-pgvectorsudo dnf install pgvector_<version>

With Docker, docker run -d --name sutra-pg -e POSTGRES_PASSWORD=dev -p 5432:5432 pgvector/pgvector:pg17 gives PostgreSQL with pgvector, and docker run -d --name sutra-mysql -e MYSQL_ROOT_PASSWORD=dev -p 3306:3306 mysql:8.4 adds MySQL. Then install SutraFlow with bin/sutraflow install, and bin/sutraflow service prints a systemd unit to start it with the machine.

Development only

Laragon and these Linux set-ups are for development machines. For servers, run SutraFlow as a service or in Docker with a managed PostgreSQL (Running in production).

Running SutraFlow

8. The sutraflow command and server settings

Every way of running SutraFlow uses one launcher: bin/sutraflow on Linux and macOS, bin\sutraflow.cmd on Windows (sutraflow after npm install -g). Its settings are in sutraflow.env beside it, written by the installer (ports, SUTRA_DATA_DIR, SUTRA_DB, SUTRA_NODE and any other SUTRA_ setting); SUTRAFLOW_ENV points it at another settings file.

Where you typeHow to run it
Windows PowerShell, in the SutraFlow folderbin\sutraflow.cmd status
Windows PowerShell, in bin.\sutraflow.cmd status: PowerShell runs nothing from the current folder by its name alone, so sutraflow status there answers "not recognized"
Windows Command Promptbin\sutraflow status, or sutraflow status in bin
Linux and macOSbin/sutraflow status, or ./sutraflow status in bin
Anywheresutraflow status, once bin is on the PATH or after npm install -g
CommandDoes
install, upgradeThe web installer or the upgrade pages; with --config file.json silently (The web installer, Upgrading)
start, start engineThe studio, or a headless engine beside it on the same database, in the background; output in <data>/logs/<name>.out.log. --foreground keeps it in the terminal, for services and Laragon
stop, stop engine, stop allGraceful: no new work, running steps finish first; --force ends a process that does not stop within 45 s
restart, status, logs [--follow]Restart; ready or not, process, addresses and database; the output log
open [designer|admin|guide|admin-guide|architecture]Opens the page in the browser
cli ...The sutra command against this studio with the local admin token (data/admin-token.txt)
db info, db copy --to ...The database in use and its row counts; copy to PostgreSQL
serviceA systemd unit (Linux) or a scheduled task (Windows) to start with the machine
setup [--ports]The runtime packages (npm ci --omit=dev), the settings file and the local admin token, for installing by hand
docker up|down|status|logs|build, docker cluster ...docker-compose.yml (a studio and an engine) or docker-compose.cluster.yml (PostgreSQL, a studio and two engines); missing passwords and the master key are made once into .env

The full list, read from the launcher itself, is in the Command reference.

Server settings

Set in sutraflow.env (or the environment of a service or container). The installer writes the first ones; Admin Console, Engines, Tuning changes several of them while SutraFlow runs, and its values win until cleared.

VariableDefaultMeaning
SUTRA_MODEstudiostudio, or engine (headless)
SUTRA_ENVIRONMENTdevelopment (studio), production (engine)development, test or production: shown on every log line and audit entry; a production server takes Sutras only from releases
SUTRA_DATA_DIR./dataDatabase file, vault key, logs
SUTRA_DB, SUTRA_DB_PASSWORDSQLitepostgres://user@host:5432/db and its password, kept apart
SUTRA_MASTER_KEYthe key fileThe vault key, base64 32 bytes; the same on every engine
SUTRA_ADMIN_HOST, SUTRA_ADMIN_PORT127.0.0.1, 4800Studio and admin API (STUDIO_PORT, ENGINE_PORT in sutraflow.env)
SUTRA_GATEWAY_HTTP_PORT, SUTRA_GATEWAY_HTTPS_PORT8080, 8443Gateway, until changed in Admin Console, Server, Gateway & TLS
SUTRA_ADMIN_TOKEN(none)Bearer token for the command line and automation; acts as an administrator. Prefer system account tokens, limited by their roles
SUTRA_ENGINE_IDcomputer nameThis engine's name in a cluster (STUDIO_ENGINE_ID, ENGINE_ENGINE_ID)
SUTRA_CAN_LEAD10: this engine never leads (also May lead in Engines)
STUDIO_MEMORY_MB, ENGINE_MEMORY_MB0Node memory of each process; 0 lets Node.js decide
SUTRA_WORKERSby machineSteps run at once (4 on 1 vCPU / 1 GB up to 32 on 8 cores); 0 serves only, running no steps
SUTRA_MEMORY_WORKERS0Steps at once for Sutras that run in memory; 0 means the same as SUTRA_WORKERS
SUTRA_VISITOR_DAYS30How long a chat visitor's signed identity lasts (agent channels without a policy); renewed while the visitor keeps coming back.
SUTRA_STREAM_BUFFER_MB8A streaming step (batches of a big file) waits while the steps it handed on hold more input than this, so many workers do not hold many big batches at once; one batch always goes on. Raise it for more batches in parallel, lower it to keep memory down.
SUTRA_POLL_MSby machineHow often an idle engine looks for due steps (200 to 500 ms)
SUTRA_SETTINGS_REFRESH_MSby machineHow long an engine keeps Project and Engine properties; 0 reads them again for every step
SUTRA_PG_POOLhalf of SUTRA_WORKERS (4 to 20)Connections of an engine's PostgreSQL pool; keep engines × (pool + 1) under max_connections
SUTRA_PG_NOTIFY10: no LISTEN/NOTIFY wake hint (polling only)
SUTRA_DEPLOY_DIR(none)Folder of packages deployed at start
SUTRA_PUBLIC_URL(none)The studio address as people reach it behind a proxy (single sign-on)
SUTRA_KEEPALIVE_MS65000Idle connections kept by the admin and gateway servers; above the idle time of a load balancer in front
SUTRA_HEARTBEAT_MS, SUTRA_DRAIN_MS5000, 30000Heartbeat (dead after three missed); time running steps get on shutdown
SUTRA_RUN_RETENTION_DAYS, SUTRA_AUDIT_RETENTION_DAYS30, 365Delete finished runs and audit entries after so many days; 0 keeps them
SUTRA_DESIGN_RUN_RETENTION_DAYS7Delete finished design runs (tests, debugging, drafts) after so many days, before the runtime retention; 0 leaves them to the runtime retention
SUTRA_REPLY_TIMEOUT_MS, SUTRA_MAX_STEPS60000, 10000How long API callers wait for a reply; steps per run
SUTRA_LOG_FORMAT, SUTRA_METRICS_TOKENtext, (none)json: log lines on standard output; bearer token for /metrics
OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_SERVICE_NAME(none), sutraflowOpenTelemetry collector (OTLP/HTTP) and the service name on traces
SUTRA_DNS_SERVERS(none)DNS servers for the Node process only (for example for MongoDB SRV records)

9. Where SutraFlow keeps its data

Everything SutraFlow knows is in one database and one data folder. This chapter says what is where, what is encrypted, what grows, and how to back it up. Look, but change things through the designer, the Admin Console or the sutra command: they check permissions, write the audit log and keep the engines in step, which a direct database change does not.

The database

  • SQLite (the start): the file <data>/sutra.db. Open it read-only with DB Browser for SQLite or HeidiSQL, ideally from a copy.
  • PostgreSQL (after Moving to PostgreSQL): the database named in SUTRA_DB, for example sutraflow, schema public. In HeidiSQL or pgAdmin, open that database; the server's other databases (such as postgres) hold nothing of SutraFlow.

Text columns hold JSON and ISO dates, so the same tables work on both databases and move between them as they are. The Admin Console's Database page shows which database is in use and its main row counts.

The data folder

In <data>What
master.keyThe key that encrypts every stored secret: database passwords, API keys, OAuth and Git tokens, certificate private keys, the TLS key (made by the installer, or with the first secret). If it is lost (a disk failure, a move to a new server, a restore without it), those secrets can never be read again and every connection must be entered again. Keep a copy away from the server, apart from the database backups; every engine of a cluster needs the same key. SUTRA_MASTER_KEY can give it instead. The installer shows a new one once (The master key and the admin token).
sutra.dbThe SQLite database (kept as a backup after a move to PostgreSQL).
admin-token.txtA full-rights key for the admin API: the launcher (sutraflow stop, status), the sutra command and scripts or CI use it instead of a password. Keep it private. To replace it: stop SutraFlow, delete the file, start again.
logs/Project logs and the server's output log.
files/<project>/Each project's files folder (${files} in variables): documents, scripts and files that release zips bring.
workspaces/Git working copies of projects in Git.
knowledge/Knowledge bases kept in a folder.
config/Deployment configs dropped here as <project>.json are loaded at start.
run/, migration/The launcher's process ids; the status and log of a move to PostgreSQL.

The tables

36 tables, by what they are for. Encrypted marks values only readable with the master key; Grows marks tables that get longer with use, and what keeps them in check.

Projects and Sutras

TableHoldsColumns
projectsProjects with their variables, logging and deployment config.id name description config updated_at owner restricted
flowsSutra drafts: the document being edited and its latest version number.id name doc version updated_at project_id folder
flow_versionsPublished, unchangeable versions of each Sutra. Grows: one row per published version; kept for rollback.flow_id version doc note created_at
deploymentsWhich version of each Sutra is deployed, and whether it is enabled.flow_id version enabled deployed_at tuning
resourcesConnections, security profiles, API policies, AI providers and MCP servers (secret names only).id kind name config updated_at folder project_id
schemasShared schemas and WSDLs of each project.id project_id name kind root text updated_at folder
foldersExplorer folders of a project kept while nothing is in them, per area (sutras, resources, schemas, wsdl); each item keeps its own folder in a folder column.project_id area path
countersCounter activity values per project.project_id name value updated_at
mem_rowsThe database copy of memory tables kept with a failsafe: key, row, expiry, and the version of the change that wrote it (a removed row keeps its key with no row).store_id k value expires_at version
mem_metaPer memory table: the latest change version and when it was last loaded from its source, so engines pick up each other's changes.store_id version loaded_at reload_at

Runs and the work queue

TableHoldsColumns
runsOne row per run: the Sutra document it started with, status, trigger input, state (outputs, variables, branch tokens, logs) and times. Grows: one row per run; housekeeping deletes runs older than the retention days (Admin Console > Engines > Tuning).id flow_id flow_name version doc status source trigger_node input state error steps started_at finished_at started_by project_id debug stage client priority
tasksOne row per step execution: status, attempt, not-before time, owner engine and claim number (counted up at each claim, for fencing), input, output, port, wait details, error and duration. The work queue. Grows: one row per step; deleted with their run.id run_id node_id input status attempt not_before phase port output error ms wait started_at finished_at released owner priority queued_at claim
connection_permitsOne row per place in use on a limited connection (Maximum concurrent activities). kind task: a durable step, valid while its claim (task, owner, claim) is running. kind lease: a listener poll or background job, valid until expires_at and renewed while held. Ended claims and expired leases are removed at the next admission.resource_id task_id owner claim kind holder project since expires_at
connection_waitsSteps waiting for a limited connection: the connection, the reason shown in the Admin Console, since when, and how many times it was checked (the pause between checks grows to 5 s). Removed when the step runs or leaves the queue.task_id resource_id reason since checks
connection_usageSamples of each limited connection (in use, waiting, limit) taken by the leader every 30 s for the Admin Console graphs; kept 7 days.at resource_id active waiting limit_n
run_outputsThe output of each step of a run, one row per step name (a later pass of a loop replaces it), read by the steps after it. Kept apart from the run state so a step writes only its own output. Grows: one row per step name of a run; deleted with their run.run_id name out
payloadsLarge parts of a run's input (over 256 KB: a broker message body, a file's content), stored once; the run's data carries a reference to them and each step gets the whole value back. Grows: one row per large input part of a run; deleted with their run.id run_id size data created_at
approval_votesEach approver's decision on an approval: the step's task, the username, approved or not, the comment, when, and whether an administrator decided on behalf of the approvers.task_id username approved comment at on_behalf

Releases and the cluster

TableHoldsColumns
package_deploymentsPackage history per project: version, checksum, who deployed it, the report and the package itself (for rollback). Grows: one row per package deployment, with the package; kept for rollback.id seq project_id name version checksum deployed_at deployed_by report package
enginesEngines of the cluster: host, process, mode, version, heartbeat, workers, active steps, draining.id host pid mode version started_at heartbeat_at workers active draining drain_requested can_lead memory restart_requested
leasesCluster-wide locks with an expiry: the leader lease and the deploy-folder lock.name holder expires_at
file_listener_stateOne row per deployed file trigger after its first folder baseline, shared by leaders so a takeover does not baseline the folder again.flow_id node_id
file_listener_filesThe last durably handled size and modification time of each path for a file trigger, shared across leader changes. Grows: one row per path currently known by each file trigger; removed when the path is removed.flow_id node_id path size mtime
bus_messagesDurable queue/topic delivery identities and their reserved run: Kafka offset or RabbitMQ/AMQP message id, used to avoid starting a second run after redelivery or leader takeover. Grows: one row per protected broker delivery; failed deliveries are removed for retry and completed identities follow run retention.flow_id node_id message_key run_id status updated_at

People, access and audit

TableHoldsColumns
usersPeople and system accounts: password hash, name, email, disabled, must change password, failed sign-ins, lock, sessions valid after, last sign-in. Encrypted: passwords are salted hashes, never reversible.username hash role created_at kind display_name email disabled must_change failed locked_until sessions_after last_login updated_at idp_subject
rolesBuilt-in and custom roles with their permissions.id name description perms builtin updated_at
grantsWhich role each account holds, for all projects (empty project) or one project.username role_id project_id
api_tokensAPI tokens of system accounts: hash, name, expiry and last use. Token values are never stored.id username name hash created_at expires_at last_used
sso_statesOne-time SAML browser or API-client sign-in requests: random state, request id, callback and return path, shared by every engine and paired with a signed client cookie; removed when used or expired. Grows: one row per SAML sign-in start; consumed by the callback and expired rows are deleted at the next sign-in.state protocol request_id redirect_uri return_to expires_at
auditAudit log: time, actor, address, action, target, project, status, outcome and safe details. Grows: one row per change; the audit retention days apply (Admin Console > Audit log).id at actor actor_kind ip action method path target project_id status outcome details project_name sutra_id sutra_name environment engine

Vault and server settings

TableHoldsColumns
secretsThe vault: encrypted values with their IV and tag. Encrypted: every value.name iv tag data updated_at project_id
settingsServer settings and policies, gateway and TLS settings, Engine properties, the deploy generation. Encrypted: the gateway TLS key, the OAuth tokens of connections, Git account tokens.key value

API gateway

TableHoldsColumns
gw_appsGateway apps: name, contact, scopes, plan, disabled.id name description contact plan_id scopes disabled created_at updated_at
gw_keysAPI keys of gateway apps: hash, name, expiry and last use. Key values are never stored.id app_id name hash created_at expires_at last_used
gw_plansGateway plans: requests per minute, hour and day, and a monthly quota.id name description per_minute per_hour per_day per_month updated_at
gw_usageRequests per app in the current minute, hour, day and month windows, shared by every engine. Grows: short windows, replaced as they pass.app_id win n expires
gw_requestsThe gateway request log: time, engine, method, path, service, app, caller, status, time taken, sizes, address, run and error. Grows: one row per gateway request; kept for the retention days.id at engine kind method path route flow_id project_id app_id caller status ms bytes_in bytes_out ip run_id error
replay_guardSignatures of HMAC-signed requests seen recently, so a replay to any engine is refused; each row expires after twice the allowed age. Grows: one row per signed request; housekeeping deletes expired rows.k expires_at
acme_challengesShort-lived HTTP-01 tokens and public key authorisations for a Let's Encrypt order, shared so any gateway engine can answer the challenge. Grows: one row per active HTTP-01 proof; removed after validation, with expired rows removed before the next order.token key_authorization engine_id expires_at
ws_connectionsOpen WebSocket connections of every engine: id, engine, service path, Sutra, caller. Lets a step on one engine reach a connection held by another.id engine_id path flow_id subject opened_at
ws_outboxMessages for WebSocket connections held by another engine, waiting a fraction of a second for that engine to deliver them.id engine_id connection_id path item created_at

Alerts

TableHoldsColumns
alert_rulesWhat to watch: kind, settings, severity, channels, on or off, tell when resolved, reminder minutes.id name kind params severity channels enabled notify_resolved repeat_min updated_at
alert_channelsWhere alerts go: email (an SMTP connection and addresses), webhook (address and signing secret name), or a Sutra.id name kind config enabled updated_at
alertsAlerts: rule, severity, state (firing, acknowledged, resolved), message and details, times, who acknowledged, what was sent where. Grows: one row per alert; resolved alerts follow the run retention.id rule_id rule_name severity state message details started_at last_seen_at last_notified_at resolved_at ack_by ack_at notified

AI

TableHoldsColumns
ai_sessionsOne row per conversation of an AI memory store: running summary, last turn number, counts, and which run holds it.store_id session project_id summary summary_upto last_seq turns tokens lock_run lock_until created_at updated_at
ai_memoryTurns of AI conversations kept in the built-in memory store (role, text or sealed text, tokens). Encrypted: sealed turns, when the memory store seals them. Grows: turns older than the store's days to keep are deleted.store_id session seq role name content tokens at
ai_session_queueRuns waiting for a conversation, in arrival order; the first one holds it.seq store_id session run_id at
ai_agent_stateProgress of an AI agent step in a run (tool steps, tokens, the tool it waits for), removed when the step finishes.run_id node_id state updated_at
guard_cacheAnswers the AI guard keeps for repeated questions: per Sutra and per person (a hash of the question and of the caller), with the time they expire.flow_id question person answer expires_at
agent_conversationsConversations of published agents: the agent, the owner (a hash of the caller), when it began, its last message, when it expires and how many messages; no message text. Expired ones are cleared with their memory in Agent conversations.id agent project_id owner created_at last_at expires_at messages
ai_knowledgePassages of built-in knowledge bases with their source, details and vector. Grows: one row per passage of built-in knowledge bases.kb_id id source chunk text meta vector at
kb_adminServer knowledge bases (Knowledge admin): who may search each (every project or granted projects) and its MCP search tool (server, tool name, description, area).kb_id access mcp_server mcp_tool mcp_description mcp_area updated_at updated_by
kb_grantsGrants of server knowledge bases: the project, the area (a folder of sources; empty for the whole base) and whether it may change the area. Grants made by a "Sutra of a project" source are marked with that source.kb_id project_id area can_write created_at created_by
kb_sourcesManaged knowledge sources: what each reads (folder, SFTP/FTP, SharePoint, Google Drive, web pages, database query, HTTP API, or Sutras of a project), its connection and settings, the area it writes, its schedule, whether it is paused or exported as a Sutra, and when it runs next.id kb_id name description kind connection_id config area schedule enabled exported_project exported_flow next_at requested created_at updated_at updated_by
kb_source_itemsWhat each managed source last added: the item (file, row key, address) and its fingerprint, so a sync makes vectors only for new and changed items and removes the items gone from the source.source_id item hash at
kb_sync_runsSyncs of managed knowledge sources (the last 50 per source): when, who asked, the status, and how many items were found, added, changed, unchanged, removed and failed, with notes.id source_id kb_id engine started_at finished_at status found added changed unchanged removed failed error started_by notes

Git

TableHoldsColumns
git_accountsGit accounts of each person: provider, host, login, encrypted token, author name and email. Encrypted: tokens.id username provider host label login token author_name author_email created_at last_used
git_workspacesProjects connected to Git: the working copy folder, remote, branch, team or personal, owner, trusted.id project_id owner kind dir remote_url branch account_id trusted source_project_id created_at updated_at
git_idsPer workspace, repository ids of Sutras, connections and schemas against the ids of its project here.workspace_id kind repo_id local_id

Backups

  • SQLite: stop SutraFlow (or use sqlite3 sutra.db ".backup copy.db" while it runs) and copy the whole data folder.
  • PostgreSQL: pg_dump -Fc sutraflow > sutraflow.dump (or the hosted service's backups), plus the data folder without sutra.db.
  • Always master.key, kept apart from the database backup: a stolen database backup without the key reveals no secrets.
  • Restore: put the folder and the key back (and pg_restore for PostgreSQL), then start SutraFlow.

10. Moving to PostgreSQL

SutraFlow keeps its own data (projects, Sutras, runs, people, the vault) in SQLite until you move it to PostgreSQL. PostgreSQL lets several engines share the data and holds more. The move takes a minute and is one button in the Admin Console, or one script on Windows and Linux.

Do you need to move?

On a single server, SQLite needs no database server and handles about 420 small steps a second. Move when you add engines, need failover, need more throughput on one busy server, or must run the database apart. See Sizing and performance.

1. Prepare PostgreSQL

  • On this machine (Laragon includes PostgreSQL), on another server, or hosted: Azure Database for PostgreSQL, Amazon RDS, Google Cloud SQL. Version 14 or later.
  • A user for SutraFlow with a password. Either an empty database it owns (CREATE DATABASE sutraflow OWNER sutra;), or CREATEDB, so the move makes the database.
  • Remote servers: PostgreSQL must listen on the network (listen_addresses), its pg_hba.conf must accept the SutraFlow machine (for example hostssl sutraflow sutra 10.0.0.15/32 scram-sha-256), and the firewall or network security group must open port 5432 to it. Hosted services do this in their portal.
  • Knowledge bases stored in PostgreSQL also need pgvector; SutraFlow's own data does not.

2. Save and test the connection

The Database page: the database in use, the PostgreSQL connection with Test connection, and Migrate now.
The Database page: the database in use, the PostgreSQL connection with Test connection, and Migrate now.

Reconnecting after a lost connection

On PostgreSQL, the Database page also sets how an engine opens its database connection again after it was lost (a database restart, a network cut): Tries (1 to 5, default 1), Wait between tries (0 to 2,000 ms, default 500) and Time per try (0.5 to 10 s, default 3). The engine pauses while a statement waits for the connection, so the page shows the longest pause these give; keep it to a few seconds. A statement that cannot reach the database fails at once and the work around it retries on its own: steps by their retry settings, listeners at their next poll, the cluster heartbeat at its next beat. Start-up always tries 10 times with growing waits. The settings apply to the engine you save them on at once and to the others at their next start.

Admin Console → Server → Database shows the database in use. Fill in host, port, database, user, password and SSL:

SSLUse for
offPostgreSQL on this machine or a trusted private network
requireEncrypted; the server's certificate is not checked. Servers with their own (self-signed) certificate
verifyEncrypted and the certificate checked against the host name. Hosted PostgreSQL (Azure, AWS, Google Cloud)

Test connection signs in and reports the PostgreSQL version, whether it signed in with the password and over SSL, whether the database exists or will be made, pgvector, and SutraFlow tables already there. Its messages say what to fix: a refused password, a host name that cannot be found, a port a firewall blocks, a server that does not accept this machine (pg_hba.conf) or wants SSL, a certificate that cannot be checked. Save keeps the connection; the password goes to the vault and never comes back to the page. A changed connection must be tested again before it can be used.

3. Migrate

Migrate now runs tools/migrate-to-postgres. The page shows each step and waits while SutraFlow restarts:

  1. SutraFlow stops gracefully: no new work, running steps finish. Triggers and APIs pause for about a minute.
  2. Every table is copied to PostgreSQL (the database is made when missing), and the rows of every table are counted on both sides.
  3. sutraflow.env gets SUTRA_DB=postgres://user@host:5432/sutraflow and the password apart as SUTRA_DB_PASSWORD (so the address can be shown and logged); the old file is kept beside it; on Linux the file is made readable only by its owner.
  4. SutraFlow starts again (and the engine, when it was running) and must answer on PostgreSQL.
  5. If the copy or the start fails, the old sutraflow.env is put back and SutraFlow starts on SQLite again. The SQLite file is never changed, so it stays as a backup.

Tick Replace SutraFlow tables already in the target database only to overwrite an earlier copy.

By hand, or on a server without the Admin Console

tools\migrate-to-postgres.cmd                         (Windows)
tools/migrate-to-postgres.sh                          (Linux, macOS)
tools/migrate-to-postgres.sh --url "postgres://sutra:password@db.example.com:5432/sutraflow?sslmode=verify-full"

Without --url the script uses the connection saved on the Database page. It needs SutraFlow started with the launcher (sutraflow start, the Laragon Procfile, the Windows task or the systemd unit), because it stops and starts it. With a systemd unit, stop the service first, run the script, then start the service again. Progress goes to the console and to <data>/migration/status.json; the full output is in <data>/migration/migration.log.

Afterwards

  • Back up PostgreSQL (pg_dump, or the hosted service's backups); the master key in the data folder still decrypts the vault and must be kept with the backups.
  • More engines on other machines use the same SUTRA_DB, SUTRA_DB_PASSWORD and master key (see Running in production).
  • To go back to SQLite: stop SutraFlow, put the kept sutraflow.env.sqlite-... file back, start it (changes made on PostgreSQL stay there).

11. Monitoring, runs and housekeeping

EndpointPurpose
GET /healthLiveness: the process answers
GET /readyReadiness: storage answers, packages are deployed, the gateway listens, not draining; 503 with reasons otherwise. The health check for load balancers
GET /metricsPrometheus text, per engine; protect it with SUTRA_METRICS_TOKEN

Metrics

  • sutra_runs_started_total{sutra,source,stage}, sutra_runs_finished_total{sutra,status,stage}, sutra_run_duration_seconds{sutra,status,stage}; stage is design or runtime, so dashboards can leave out tests with stage="runtime"
  • sutra_steps_total{activity,outcome} (done, error handled by an error output, failed), sutra_step_duration_seconds, sutra_step_retries_total
  • sutra_gateway_requests_total{kind,status}, sutra_gateway_request_duration_seconds
  • sutra_tasks{status}, sutra_engine_running_steps, sutra_engine_workers, sutra_engine_leader, sutra_engines_alive, sutra_listeners{state}, sutra_info{version,mode,engine}
  • PostgreSQL pool: sutra_db_pool_connections, sutra_db_pool_waiting, sutra_db_pool_acquire_ms, sutra_db_transaction_ms; sutra_event_loop_delay_ms

Traces and logs

  • Set OTEL_EXPORTER_OTLP_ENDPOINT (an OpenTelemetry collector, Jaeger, Tempo, Honeycomb): a run is one trace with a span per step (activity, outcome, attempt, engine, error), across engines; a caller's traceparent is continued and every gateway answer carries the run's.
  • SUTRA_LOG_FORMAT=json writes one JSON object per line on standard output: time, level, engine, project, Sutra, run, step, message. Each project's own log file stays as configured.
  • The launcher's output log of each process: <data>/logs/studio.out.log, engine.out.log; the installer's: installer.log.

Design runs and runtime runs

Every run records its stage:

  • design: a test or debug run from the designer, any run of a draft (version 0), and a Sutra called by a design run;
  • runtime: deployed work, started by its trigger, the Run API or a runtime caller.

Runs started by hand also record the client: studio, api or cli (the sutra command sends x-sutra-client: cli); automatic starts have none. One rule decides the stage, so every figure agrees: the Admin Console Overview and Applications, alerts, Traceability, the Operator view and the runs-at-once limit count runtime runs only. Traceability shows runtime runs by default with a Stage filter (Runtime, Design, All); the designer's Runs shows all, with the same filter. The upgrade to 2.1.7 fills the stage of older runs from their source and version, in batches, on SQLite and PostgreSQL.

Runs and housekeeping

  • Finished design runs older than SUTRA_DESIGN_RUN_RETENTION_DAYS (7; engine tuning Keep design runs; sutra engines tune --design-retention-days) are deleted first, so tests do not fill the database; 0 leaves them to the runtime retention below. Runtime runs are not affected.
  • Finished runs (done, failed, cancelled) older than SUTRA_RUN_RETENTION_DAYS (30; 0 keeps everything, per Sutra in its tuning) are deleted with their steps by the leader, about once a minute. Waiting runs, such as approvals and timers, are never deleted. Admin Console, Engines, Delete old runs now runs it at once.
  • Run again from the failed step (Admin Console, Traceability or Applications, Runs; sutra runs resubmit <id>): the failed step runs again with the same input; everything the earlier steps produced is kept.
  • Audit entries older than SUTRA_AUDIT_RETENTION_DAYS (365) are deleted the same way; Admin Console, Audit log has the retention and clearing.

Alerts that tell people when something goes wrong (failed runs, slow runs, gateway errors, engines down, work waiting, certificates ending) are set in the Admin Console: Alerts.

Engines and clusters

12. Running in production: engines, Docker, clusters

Headless engines

The same program started with SUTRA_MODE=engine runs Sutras without the studio: no designer pages and no editing. It keeps /health, /ready and /metrics, the Admin Console at /admin for its users, and an automation API for API tokens (the admin token or system account tokens). Packages in SUTRA_DEPLOY_DIR are deployed when it starts; a package that cannot be deployed stops the start.

Docker

docker build -t sutraflow:2.1.8 .
docker run -e SUTRA_MODE=engine -e SUTRA_ADMIN_TOKEN=... -e SUTRA_MASTER_KEY=... \
           -v ./deploy:/deploy:ro -p 8080:8080 sutraflow:2.1.8

The image runs as a non-root user, checks its own health, and writes JSON logs. docker-compose.yml has a studio and an engine; docker-compose.cluster.yml has PostgreSQL, a studio and two engines.

Clusters

Several engines share one database (SUTRA_DB=postgres://...), each with its own SUTRA_ENGINE_ID and all with the same SUTRA_MASTER_KEY.

A cluster needs a load balancer

  • Put a load balancer in front of the engines' gateways (Apache, nginx, IIS, a cloud load balancer) and send every caller of REST, SOAP, MCP and agent services to it, with /ready on the admin port as the health check. A run starts on the engine that receives its call. Measured: four engines did about three times the work of one with calls spread over them, and little more than one when every call went to the same engine.
  • Timers, folder and mailbox listeners run on the leader only, so they never start twice; the steps that follow are shared by every engine.
  • Sutras that run in memory stay on the engine that started them: only a load balancer spreads them.

Database connections

Remote activity databases. Resources → Database connection accepts the remote host and service port for PostgreSQL, MySQL/MariaDB, SQL Server and Oracle. These activity connections are separate from the engine's own SUTRA_DB. Configure network/firewall access, a least-privilege database user and a vault password. For PostgreSQL/MySQL/SQL Server, enable TLS; use the server certificate's DNS host and paste a private CA PEM into Trusted database CA when needed. Certificate verification remains enabled by default. Project/Engine properties can supply environment-specific fields. Oracle can use a DBA-supplied connect string (including supported TCPS/wallet configuration); consult its driver documentation. SQLite is a local file, not a remote database service: do not use a shared network SQLite file for a cluster.

On 24 October 2026, external PostgreSQL 17.2 and MariaDB 11.8.9 endpoints passed bound queries and rollback through the PostgreSQL and MySQL connectors with client TLS verification enabled. The PostgreSQL endpoint negotiated client TLS 1.3, but its pool-to-database backend reported no TLS; check the provider's internal transport policy. The MariaDB endpoint used port 3306 and TLS_AES_256_GCM_SHA384. These short connector checks are not the separate-machine 24-hour engine soak or SQL Server/Oracle certification.

  • On PostgreSQL each engine runs its steps through a pool of connections (SUTRA_PG_POOL, by default half of Steps at once, from 4 to 20) and keeps one more for everything else. Many steps then have their database work in flight at once.
  • Keep engines × (pool + 1), plus the studio and your own tools, under PostgreSQL's max_connections (100 by default). Four engines with a pool of 8 use 36.
  • /metrics shows the pool: sutra_db_pool_connections, sutra_db_pool_waiting (transactions waiting for a connection), sutra_db_pool_acquire_ms and sutra_db_transaction_ms. Waiting that grows means the pool is too small for the work; transactions that grow mean the database is the limit.
  • SUTRA_PG_ASYNC=0 runs the engine through one synchronous connection: a fallback, several times slower.
  • PostgreSQL LISTEN/NOTIFY wakes engines when committed work enters the durable queue. Polling remains active as the correctness fallback. Set SUTRA_PG_NOTIFY=0 only to disable the wake hint.

Engine names. SUTRA_ENGINE_ID is an engine's identity in the cluster: the steps it runs record it as their owner, and the leader uses it to hand a stopped engine's steps to the others. Without it, the launcher uses the computer name (vm-west-01-studio, vm-west-01-engine); the Laragon set-up names its engines laragon and laragon-engine. Set it once per engine (in sutraflow.env: STUDIO_ENGINE_ID, ENGINE_ENGINE_ID) and keep it. For the name people see, use Rename in Admin Console → Engines or sutra engines name <id> "Azure West Europe 1": a display name that can change at any time.

  • Work is shared, and each step is run by exactly one engine.
  • One engine leads and runs timers and folder, mailbox, queue and Drive listeners, so they fire once. If it stops, another takes over within a few heartbeats.
  • Steps of an engine that stopped are finished by another.
  • Callers get their replies from whichever engine they reached.
  • A deploy reaches every engine.

Step-by-step set-ups for one machine, two machines, engines only and Docker are in Setting up a cluster, step by step. SUTRA_CAN_LEAD=0 keeps an engine from ever leading.

Engines with SUTRA_WORKERS=0 only serve APIs. sutra status or GET /api/engine/status lists the engines, the leader and the queue.

Stopping without losing work

On docker stop, Ctrl+C or POST /api/engine/drain, an engine:

  1. reports not ready, so load balancers stop sending it requests;
  2. hands leadership over;
  3. lets running steps finish for SUTRA_DRAIN_MS, and hands the rest back to the queue for another engine;
  4. closes.

Monitoring

WhatWhere
Liveness and readiness/health, /ready on the admin port
Metrics/metrics (Prometheus): runs, steps by outcome, retries, durations, gateway requests, queue, leader, listeners
TracesSet OTEL_EXPORTER_OTLP_ENDPOINT: each run is a trace with a span per step, continuing a caller's traceparent
LogsSUTRA_LOG_FORMAT=json: one JSON line per event on standard output, plus each project's log file

Runs

Finished runs older than SUTRA_RUN_RETENTION_DAYS (30 by default) are deleted; waiting runs are kept. A failed run can continue with Run again from the failed step in Runs: the failed step runs again with the same input, and the earlier steps' results are kept.

Checklist

  1. Set SUTRA_MASTER_KEY from your secret store, the same on every engine.
  2. Keep the studio on 127.0.0.1 or behind a VPN. Expose only the engines' gateway ports, behind a load balancer pointed at /ready.
  3. Set a long SUTRA_ADMIN_TOKEN; give it only to the release pipeline.
  4. Set the gateway certificate and require HTTPS in every API policy.
  5. Put environment-specific values in the deployment config, with ${env:NAME} for anything secret or host-specific.
  6. Release with packages; keep the files, they are your rollback.
  7. Back up the database (or the data folder).

Settings for every engine are in The sutraflow command and server settings; releases reach the engines as in Receiving releases on a server.

13. Setting up a cluster, step by step

A cluster is several SutraFlow processes (a studio and engines) sharing one PostgreSQL database. They share the work, and keep running when one of them stops. This chapter sets one up from scratch, for each common layout.

What every engine does, and what the leader does

Every process of a cluster is an engine: it runs steps, and it serves the gateway (REST, SOAP, WebSocket, MCP and agent services) on its own ports, applying the services' API security policies itself. There is no central gateway: a caller reaches whichever engine the load balancer picks, and that engine checks the caller, starts the run and answers.

One engine at a time is also the leader. The leader runs what must happen once in the cluster, not once per engine:

Every engineThe leader as well
Runs steps from the shared work queue (each step exactly once)Timers (each timer fires once, not once per engine)
Serves the gateway: REST, SOAP, WebSocket, MCP, chat, OpenAI-compatible and A2AListeners: folders, SFTP and FTP, mailboxes, queues and topics, Drive, Microsoft files, Discord, Telegram, Twitch, Data Factory, WebSocket client streams
Applies API security policies, validation and threat protection to its callersRecovery: steps of an engine that stopped are put back in the queue for the others
Writes a heartbeat every 5 secondsRun time limits, queued runs, alerts (every 30 seconds) and housekeeping (old runs, logs, audit)
Reloads deploys and settings on its next heartbeatForgetting engines that have been silent for ten minutes

The leader holds a lease in the database and renews it every heartbeat. If it stops renewing (stopped, crashed, cut off), the lease runs out after three heartbeats (15 seconds) and another engine takes it, starting the timers and listeners there. Nothing needs to be told: there is no leader to configure, only engines that may or may not lead (below).

Leader and gateway are separate

Security does not depend on the leader: each engine checks its own callers with the same policies, read from the shared database. A cluster whose leader stops keeps serving APIs on every other engine without a pause; only timers and listeners wait up to 15 seconds for the new leader.

The settings that make a cluster

SettingOn every process
SUTRA_DBThe same PostgreSQL address (postgres://user@host:5432/sutraflow), with SUTRA_DB_PASSWORD when it needs a password.
SUTRA_MASTER_KEYThe same key on every machine (it decrypts the vault). Copy it from the first machine's data/master.key, or put it in each sutraflow.env.
SUTRA_ENGINE_IDDifferent on every process: its name in the cluster. The launcher names them <computer>-studio and <computer>-engine (STUDIO_ENGINE_ID, ENGINE_ENGINE_ID in sutraflow.env to choose).
SUTRA_ADMIN_TOKENOptional; the same long token lets one release pipeline talk to every engine.
SUTRA_CAN_LEAD0 on engines that must never lead, for example machines that cannot reach the folders the folder triggers watch. At least one process must be able to lead.
SUTRA_PG_POOLOptional: connections per engine. Keep processes × (pool + 1) under PostgreSQL's max_connections.
SUTRA_PG_NOTIFYPostgreSQL queue wake hint (default on). Set to 0 to use polling alone; polling always remains enabled.

Before you start: PostgreSQL

  1. Install PostgreSQL 14 or later on its own machine (or use a managed service). On one test machine, the local one will do. Keep it near the engines: same data centre or cloud region, a round trip of about 2 ms or less. Over the internet (75 ms) a cluster still works but each call takes seconds (measurements).
  2. Create a database and a user: CREATE USER sutra_owner PASSWORD '...'; CREATE DATABASE sutraflow OWNER sutra_owner;
  3. Allow the engine machines in pg_hba.conf (with scram-sha-256), and turn SSL on for anything that crosses a network.
  4. If you already have data in SQLite, move it once: Admin Console → Server → Database, or sutraflow db copy --to postgres://... (see Moving to PostgreSQL).

Layout 1: one machine, a studio and an engine

The simplest cluster, and a good way to try one: two processes on one server share the work, and one keeps serving while the other restarts.

  1. Install SutraFlow with PostgreSQL and A headless engine beside it (The web installer), or set SUTRA_DB in sutraflow.env of an existing installation to the PostgreSQL address.
  2. Start the studio: sutraflow start. It listens on 4800, its gateway on 8080 and 8443.
  3. Start an engine beside it: sutraflow start engine. It uses the same folder and settings, and listens on 4801, its gateway on 9080 and 9443 (ENGINE_PORT, ENGINE_GATEWAY_HTTP, ENGINE_GATEWAY_HTTPS).
  4. Check: sutraflow status, or Admin Console → Engines: two engines alive, one marked leader.
  5. Point your load balancer (or Apache or nginx on the same machine) at both gateways: 8080 and 9080, health check /ready on 4800 and 4801.
  6. Start both with the machine: sutraflow service prints the systemd units or the Windows scheduled tasks, one for the studio and one for the engine.

Layout 2: two machines, the studio and an engine on one, an engine on the other

  1. On machine A, set up layout 1, or just the studio.
  2. Copy data/master.key from machine A (or set SUTRA_MASTER_KEY on both).
  3. On machine B, install SutraFlow, and in its sutraflow.env set the same SUTRA_DB and SUTRA_MASTER_KEY, and SUTRA_ADMIN_HOST=0.0.0.0 only if a load balancer checks its /ready from another machine.
  4. Start only an engine on B: sutraflow start engine. Machine B has no studio: design on A, deploy from A, and B picks the deploy up on its next heartbeat.
  5. Check Admin Console → Engines on A: the engines of both machines are listed.
  6. Add B's gateway (9080, 9443) to the load balancer.
  7. Folder triggers: the leader may be either machine. Make the watched folders reachable from both (a shared drive), or set SUTRA_CAN_LEAD=0 on B so A always leads (and A's engines take over from each other).

Layout 3: engines only, behind a load balancer, with a separate studio

For production: no designer on the servers that serve traffic.

  1. Keep the studio on a design or test server; build releases there (Releases) or from Git in a pipeline (CI/CD).
  2. On each production machine install SutraFlow with the same SUTRA_DB (the production database) and SUTRA_MASTER_KEY, SUTRA_ENVIRONMENT=production, and start engines only: sutraflow start engine. On a machine with many cores, a second process (another folder with other ports) uses them better than one big one.
  3. Create the first administrator for the engines' Admin Console: sutraflow cli user add admin --role administrator.
  4. Deploy a release: sutra deploy release.zip against any engine (with its admin token), or drop the package in SUTRA_DEPLOY_DIR; every engine loads it.
  5. Put the load balancer in front of every engine's gateway port, health check /ready. Leave the admin ports (4801) on the private network.

Layout 4: Docker

sutraflow docker cluster up starts docker-compose.cluster.yml: PostgreSQL, a studio and two engines with the shared settings filled in. To add engines, copy the engine-2 service as engine-3 and so on, each with its own SUTRA_ENGINE_ID.

Which layout

NeedLayout
One server, more throughput, restarts without downtime1: studio and engine on one machine
Survive the loss of a machine2 or 3, with PostgreSQL replicated or managed
Separate design from production3: engines only in production
Containers or Kubernetes4: Docker, one engine per container

Checking a cluster

  • Admin Console → Engines: every engine, alive or not, the leader, steps running, never leads where set; drain one from there.
  • sutraflow status or GET /api/engine/status: the same as JSON.
  • /metrics: sutra_engine_leader is 1 on exactly one engine; sutra_engines_alive counts the others.
  • To restart an engine without losing work: sutraflow stop engine drains it (running steps finish or go back to the queue), then start it again.
Try a failover

With two engines running, stop the leader (sutraflow stop). Within 15 seconds the other one shows as leader in Engines, and its timers fire. Calls to the remaining gateway never stopped.

14. Sizing and performance

How much work a server takes, what to run on which machine, and the settings that change it. Every number here was measured with the load test that comes with SutraFlow (tools/loadtest.mjs), on the machine named under each table; run it on your own servers before you size production.

What a step costs

A Sutra runs durable by default: before a step starts, it is a row in the work queue, and when it ends, its output, the run state and the next steps are written in one database transaction. That is why a run survives a crash, a restart or a redeploy, and why it can wait for days for an approval. The price is a few database round trips per step. For most integrations this does not matter: a step that calls an API or a database takes 20 to 500 ms, and the engine's own work is 2 to 5 ms of it.

It matters when a Sutra has many tiny steps and must answer fast, such as a REST service that maps a request, checks it and replies in 30 ms. For those, a Sutra can run in memory.

Durable or in memory

Durable (default)In memory
Where the steps live while the run is openThe databaseA private in-memory database of the engine
Written to the databaseEvery stepOnce, when the run ends: the run and all its steps
A restart or crash while the run is openThe run carries on, on this engine or anotherThe run is lost (the caller gets an error or no answer)
Waits: approvals, Ask a person, Call Sutra with waitYesNo: the tuning is refused, or the step fails with the reason
Wait steps, timers, retries with a delayYesYes, within the engine
Run history, logs, resubmitYesYes, once the run has ended
Seen in Runs while open, cancelYesCancel yes; the run shows up in Runs when it ends
Small steps per second, one engine (measured below)about 120 on PostgreSQL, 520 on SQLiteabout 460 on PostgreSQL, 680 on SQLite
Which engine runs itAny engine of the cluster takes the next stepThe engine that started it runs all its steps: spread the callers over the engines (a load balancer in front of the gateways)

Set it per deployed Sutra: Admin Console > Applications > the Sutra > Tuning > Execution, or sutra sutras tune "Quote API" --project Shop --execution in-memory. Tests and debugging in the designer always run durable.

Choosing

In memory suits short request-reply Sutras (REST, SOAP and MCP services, lookups, mappings, validations) where a lost run is simply retried by the caller. Keep durable everything that moves money or data one way (orders, payments, file transfers, queue consumers that acknowledge), everything that waits, and every long run.

Machine profiles

When the environment does not set them, an engine takes its Steps at once, Queue check and Settings refresh from the profile of the machine it runs on: the smaller of what its cores and its memory allow. The engine reads its machine each time it starts, so the advice is for each install: a laptop, an Azure or Google VM of 2 vCPU, a container held to 1 core (a container limit counts). In a cluster, each engine reads its own machine.

Steps at once counts steps, not Sutras or palettes: a step is one activity box running in one run. With 32, an engine runs up to 32 boxes at the same moment, from any runs of any Sutras; the rest wait in the queue for a moment. Admin Console > Engines > Tuning > This machine shows the profile of the server, with Apply recommended tuning; sutra engines machine prints it.

Admin Console, Engines: the profile of this machine and its recommended tuning
Admin Console, Engines: the profile of this machine and its recommended tuning
ProfileMachineSteps at onceQueue checkEngines (PostgreSQL)Node memory per engineRead files whole up toRows per streamed batchDatabase
Small1 vCPU, 1 GB4500 ms1384 MB10 MB500SQLite
Small plus2 vCPU, 2 to 4 GB8250 ms11024 MB25 MB1000SQLite; PostgreSQL on another machine for a cluster
Medium4 vCPU, 8 GB16250 ms22048 MB50 MB2000SQLite for one engine at moderate load; PostgreSQL for a busy server or several engines
Large8 vCPU, 16 GB32200 ms43072 MB100 MB5000PostgreSQL for a busy server or several engines; SQLite for a moderate load
Very large16 vCPU or more, 32 GB or more32200 ms84096 MB200 MB5000PostgreSQL on its own machine, for several engines
  • Steps at once is more than the cores because most steps wait for a network or a database, and an engine runs other steps meanwhile. It does not speed up steps that only compute: in the measurements below, 32 steps at once did no better than 16. Raise it for Sutras that mostly wait (APIs, AI); lower it when steps compute (big mappings, scripts) and the engine CPU is near 1 core.
  • One engine is one Node.js process and uses about one core for its own work. To use more cores, run more engines on the same machine against PostgreSQL (the launcher starts them: sutraflow start engine), not more steps at once.
  • Node memory is the heap limit to give each engine (384 MB on the smallest machines, so the operating system and the database keep the rest). Each engine is its own Node.js process with its own memory: two engines on one machine each take their own share, they do not draw from one pool. Set it in the Admin Console under Engines, Tuning, Node memory (for every engine or one), with sutra engines tune --memory-mb, as STUDIO_MEMORY_MB or ENGINE_MEMORY_MB in sutraflow.env, or in the installer. It applies when the engine restarts: the engine writes the value to its own settings file and the Engines list shows restart for … MB with a Restart button, which lets running steps finish and starts it again. Engines started by a service manager or Docker do not restart themselves: use Drain and stop and set NODE_OPTIONS=--max-old-space-size=… where they are started. The Engines list shows each engine's memory in use of its limit and the machine's memory.
  • SQLite runs inside the engine, with nothing to install: about 420 small steps a second on one engine. Use it on small machines (a PostgreSQL server needs its own few hundred MB) and for most single servers. PostgreSQL runs many steps' database work at the same time through a pool: about 720 small steps a second on one engine on the same machine, and 1,600 with four. Use it for several engines or machines, for failover, for a busy single server, or when the database must be managed apart, ideally on a machine (or a managed service) of its own.

SQLite or PostgreSQL

For smaller workloads, use SQLite. It is the default, needs nothing installed and nothing to look after: the database runs inside the engine. Measured with REST calls on one engine, SQLite ran about 420 small steps a second; held to one core and 512 MB, 365 a second durable and 750 in memory. PostgreSQL on the same machine ran about 720 on one engine (the engine works with PostgreSQL through a pool of connections) and 1,600 with four engines, so a busy server with a PostgreSQL server to hand gains from it.

Use SQLite whenUse PostgreSQL when
One server runs SutraFlow (a VM, a desktop, a Raspberry Pi class box)Several engines share the work, on one machine or several
Small and medium workloads: up to millions of steps a dayYou need failover: another engine takes over when one stops
Request-reply APIs and short Sutras at moderate volumeRuns must survive the loss of the whole machine (PostgreSQL replicated or managed)
Steady load up to a few hundred steps a secondA busy server that needs more (PostgreSQL ran about 70% more on one engine, four times as much with four)
Small machines (1 to 2 GB): no database server to feedYour company requires databases to be run, backed up and monitored by its DBAs
Development, testing, demos, edge sites, departmentsRun history must be queried by other tools while SutraFlow runs

Getting the most out of SQLite:

  • Keep the data folder on a local disk, ideally an SSD. Never on a network share (SMB, NFS): SQLite's locking is not safe there, and every write waits for the network.
  • Run one engine per data folder; for more throughput on the same machine, use Sutras that run in memory and raise Steps at once before you think of more engines. (Several engines on one SQLite file work, but they take turns to write, so they add little.)
  • Keep the database small: Keep finished runs at 7 to 30 days, and Step data in history on errors only or none for busy Sutras. A small database stays fast and backs up in seconds.
  • Back up while it runs with sqlite3 sutra.db ".backup copy.db", or stop SutraFlow and copy the data folder, together with master.key kept apart.
  • When you outgrow it (several engines, failover), the move to PostgreSQL is one button: see Moving to PostgreSQL. Nothing in the Sutras changes.
Rule of thumb

One server with a moderate load: SQLite, with the least to look after. A busy server, more than one engine, or a need for failover: PostgreSQL, ideally on a machine of its own.

What to run on which machine

MachineGood forAvoid
1 vCPU, 1 GB
(a small cloud VM, a Raspberry Pi class box)
Timers and file moves, a few REST or SOAP services, webhooks, email and chat notifications, SFTP transfers, CSV files of any size streamed in batches. Measured on one core with 512 MB and SQLite: 365 small durable steps a second (1.3 million an hour), 750 in memory. Real steps that call APIs take longer, so plan for tens of thousands of runs a day.Local AI models, Python steps that load big libraries, files read whole over 10 MB, a database server on the same machine, many Sutras with Runs at once above 20.
2 vCPU, 2 to 4 GBA department's integrations: tens of Sutras, REST APIs with in-memory Sutras for the fast ones, AI agents that call a cloud model, RAG over a folder with the built-in store, files read whole up to 25 MB.Local models above 3B parameters, PostgreSQL on the same machine with heavy runs.
4 vCPU, 8 GBProduction for a company: two engines and PostgreSQL, hundreds of Sutras, queue consumers (Kafka, RabbitMQ), databases, Databricks and Data Factory orchestration, small local models (Ollama phi4-mini class) for light use.Many local-model calls at once.
8 vCPU, 16 GBHeavy traffic: four engines, high-volume APIs, large file and data movements, local models of 7 to 8B parameters, vector stores (pgvector).Running the model, the database and the engines all on one machine at peak load.
16 vCPU and moreA cluster member, or several engines plus a gateway; PostgreSQL on its own machine.A single engine: it would use only a fraction of the machine.

Files: what size to read whole

  • A file read whole is held in memory several times over (bytes, text, rows, the step output), about 5 to 8 times its size for CSV. Keep Maximum size of Read file at or below the profile's Read files whole up to.
  • Bigger CSV and line files: tick Stream in batches (see Files). Memory then depends on the batch, not the file: a batch of 1,000 rows of 200 bytes is about 1 MB as data.
  • JSON and XML are read whole. For very big ones, ask the source for paged or line-delimited output (one JSON document per line, read as lines and streamed).
  • Binary files (base64) grow by a third in memory as text; move big binary files with Move / copy / delete file or SFTP, which stream, rather than reading them.
  • Each step output is kept in the run history up to 1 MB (bigger ones are cut to a preview). For Sutras that handle big data, set Step data in history to errors only or none.

Settings that change throughput

SettingWhereEffect
Steps at onceEngine tuning; SUTRA_WORKERSSteps one engine runs together. Too low: steps wait in the queue (see Queue wait in the Overview). Too high: memory and the database get busy.
Steps at once in memoryEngine tuning; SUTRA_MEMORY_WORKERSThe same for Sutras that run in memory; 0 means the same as Steps at once.
Queue checkEngine tuning; SUTRA_POLL_MSHow often an idle engine looks for due steps. Steps queued on the same engine start at once anyway; this only delays steps queued by another engine and retries. Lower answers sooner, higher saves database reads on small machines.
Settings refreshEngine tuning; SUTRA_SETTINGS_REFRESH_MSHow long an engine keeps Project and Engine properties before reading them again (a local administrator change applies at once, and the cluster signal clears other engines).
ExecutionSutra tuningDurable or in memory (above).
Runs at once, PrioritySutra tuningProtect a slow back end; let urgent Sutras go first.
Step data in historySutra tuningnone or errors only keeps the database small for busy Sutras.
Keep finished runsEngine and Sutra tuningFewer days, smaller database, faster history.

Measurements

The load test starts a studio and engines on a database of their own and runs a benchmark Sutra: a trigger and ten Transform steps, each computing a little and putting out the size of data shown. It counts finished steps per second, the time steps waited in the queue and took, what the database did, and the CPU and memory of the engines. Engines and PostgreSQL ran on the same machine, so the database took cores from the engines: a real cluster with PostgreSQL on its own server does better with several engines.

1.7.6, asynchronous PostgreSQL storage: REST calls spread over the engines

1.7.6 local; PostgreSQL, 0.2 ms round trip to the database; Node v24.21.0; 600 runs of 10 steps plus the trigger, 16 steps at once per engine.

ExecutionEnginesOutput per stepSteps/sRuns/sStep ms p50 / p95 / p99Queue wait p95 msRun p95 msEngine CPU (cores)Engine memoryFailedRepeated
durable10.1 KB71965.40 / 1 / 2685021.11348 MB00
durable20.1 KB1267.8115.30 / 1 / 2102932.27297 MB00
durable40.1 KB1601.9145.60 / 1 / 241963.75244 MB00

1.7.5, the same scenarios (synchronous PostgreSQL connection)

1.7.5 local; PostgreSQL; Node v24.21.0; 600 runs of 10 steps plus the trigger, 16 steps at once per engine.

ExecutionEnginesOutput per stepSteps/sRuns/sStep ms p50 / p95 / p99Queue wait p95 msRun p95 msEngine CPU (cores)Engine memoryFailedRepeated
durable10.1 KB152.813.92 / 3 / 32770.44202 MB00
durable20.1 KB28425.83 / 14 / 2041700.86254 MB00
durable40.1 KB45741.59 / 33 / 5152971.57233 MB00

1.7.6 with the database on another machine (round trip measured in the table caption)

1.7.6, database 27 ms away; PostgreSQL, 28.7 ms round trip to the database; Node v24.21.0; 400 runs of 10 steps plus the trigger, 16 steps at once per engine.

ExecutionEnginesOutput per stepSteps/sRuns/sStep ms p50 / p95 / p99Queue wait p95 msRun p95 msEngine CPU (cores)Engine memoryFailedRepeated
durable10.1 KB101.99.30 / 1 / 3054636790.2311 MB00
durable40.1 KB621.656.51 / 1 / 4184761.81186 MB00

1.7.5 with the database on another machine (the same proxy)

1.7.5 remote 2 ms; PostgreSQL; Node v24.21.0; 400 runs of 10 steps plus the trigger, 16 steps at once per engine.

ExecutionEnginesOutput per stepSteps/sRuns/sStep ms p50 / p95 / p99Queue wait p95 msRun p95 msEngine CPU (cores)Engine memoryFailedRepeated
durable10.1 KB3.40.376 / 140 / 1638834590.03140 MB00
durable40.1 KB17.71.6239 / 814 / 116112075160.15140 MB0125

1.7.6, one engine, 64 KB outputs per step

1.7.6 local, 64 KB outputs; PostgreSQL, 0.2 ms round trip to the database; Node v24.21.0; 300 runs of 10 steps plus the trigger, 16 steps at once per engine.

ExecutionEnginesOutput per stepSteps/sRuns/sStep ms p50 / p95 / p99Queue wait p95 msRun p95 msEngine CPU (cores)Engine memoryFailedRepeated
durable164 KB605.57 / 18 / 2471460611.06481 MB00

Before the load work (1.6.0 as first released): PostgreSQL

1.6.0 before; PostgreSQL; Node v24.21.0; 300 runs of 10 steps plus the trigger, 16 steps at once per engine.

ExecutionEnginesOutput per stepSteps/sRuns/sStep ms p50 / p95 / p99Queue wait p95 msRun p95 msEngine CPU (cores)Engine memoryFailedRepeated
durable10.1 KB82.47.53 / 4 / 501370.54199 MB00
durable20.1 KB82.47.53 / 14 / 2402360.57185 MB00
durable40.1 KB908.24 / 22 / 3303030.66250 MB00
durable164 KB35.63.24 / 8 / 1303420.54591 MB00
durable264 KB38.83.55 / 48 / 7307690.63611 MB00
durable464 KB45.74.26 / 61 / 9308170.86537 MB00

1.7.5: PostgreSQL, durable and in memory

after; PostgreSQL; Node v24.21.0; 300 runs of 10 steps plus the trigger, 16 steps at once per engine.

ExecutionEnginesOutput per stepSteps/sRuns/sStep ms p50 / p95 / p99Queue wait p95 msRun p95 msEngine CPU (cores)Engine memoryFailedRepeated
durable10.1 KB123.911.32 / 3 / 43940.53322 MB00
durable20.1 KB131.7122 / 17 / 7742930.6250 MB00
durable40.1 KB152.813.92 / 61 / 8455190.8247 MB00
durable164 KB474.33 / 5 / 10142630.53535 MB00
durable264 KB514.63 / 67 / 96187930.61559 MB00
durable464 KB56.35.14 / 53 / 93216410.79583 MB00
memory10.1 KB455.441.40 / 1 / 12170.8332 MB00
memory20.1 KB47643.30 / 1 / 12190.9221 MB00
memory40.1 KB480.843.70 / 1 / 12190.9232 MB00
memory164 KB111.510.11 / 2 / 102740.75639 MB00
memory264 KB112.910.31 / 2 / 42720.8583 MB00
memory464 KB11210.21 / 2 / 32740.8593 MB00

1.7.5: REST calls spread over the engines (as behind a load balancer)

REST calls spread over the engines' gateways; PostgreSQL; Node v24.21.0; 600 runs of 10 steps plus the trigger, 16 steps at once per engine.

ExecutionEnginesOutput per stepSteps/sRuns/sStep ms p50 / p95 / p99Queue wait p95 msRun p95 msEngine CPU (cores)Engine memoryFailedRepeated
durable10.1 KB116.310.62 / 3 / 43970.52205 MB00
durable20.1 KB229.320.85 / 18 / 2452171.05250 MB00
durable40.1 KB352.23211 / 38 / 5663501.73231 MB00
memory10.1 KB544.349.50 / 1 / 11140.9309 MB00
memory20.1 KB983.389.40 / 1 / 11191.79259 MB00
memory40.1 KB1662.9151.20 / 1 / 21233.68186 MB00

1.7.5: 32 steps at once on one engine

32 workers; PostgreSQL; Node v24.21.0; 300 runs of 10 steps plus the trigger, 32 steps at once per engine.

ExecutionEnginesOutput per stepSteps/sRuns/sStep ms p50 / p95 / p99Queue wait p95 msRun p95 msEngine CPU (cores)Engine memoryFailedRepeated
durable10.1 KB118.310.82 / 3 / 431030.56266 MB00

Small server: one core and 512 MB per engine, PostgreSQL

1 core 512 MB; PostgreSQL; Node v24.21.0; 200 runs of 10 steps plus the trigger, 4 steps at once per engine, each engine held to 1 core and 512 MB.

ExecutionEnginesOutput per stepSteps/sRuns/sStep ms p50 / p95 / p99Queue wait p95 msRun p95 msEngine CPU (cores)Engine memoryFailedRepeated
durable10.1 KB978.82 / 5 / 741300.39313 MB00
durable164 KB353.24 / 8 / 19263620.42435 MB00
memory10.1 KB336.230.60 / 1 / 32270.64276 MB00
memory164 KB75.26.82 / 5 / 2241650.51422 MB00

SQLite, one engine

SQLite; SQLite; Node v24.21.0; 300 runs of 10 steps plus the trigger, 16 steps at once per engine.

ExecutionEnginesOutput per stepSteps/sRuns/sStep ms p50 / p95 / p99Queue wait p95 msRun p95 msEngine CPU (cores)Engine memoryFailedRepeated
durable10.1 KB521.247.40 / 1 / 11230.94264 MB00
durable164 KB88.481 / 3 / 14171370.99468 MB00
memory10.1 KB680.861.90 / 1 / 11150.99278 MB00
memory164 KB130.811.91 / 2 / 102711.01485 MB00

Small server: one core and 512 MB, SQLite

SQLite 1 core 512 MB; SQLite; Node v24.21.0; 200 runs of 10 steps plus the trigger, 4 steps at once per engine, each engine held to 1 core and 512 MB.

ExecutionEnginesOutput per stepSteps/sRuns/sStep ms p50 / p95 / p99Queue wait p95 msRun p95 msEngine CPU (cores)Engine memoryFailedRepeated
durable10.1 KB364.733.21 / 2 / 42380.73223 MB00
durable164 KB645.82 / 8 / 25242400.62311 MB00
memory10.1 KB751.468.30 / 1 / 21170.77237 MB00
memory164 KB93.58.52 / 4 / 1841650.53312 MB00

An engine killed under load

Two engines, 600 REST calls spread over both gateways; the second engine was killed (no drain) when a third of the runs were done. Result: every run done, 0 failed, in 48.2 s (steps finished per engine: load-0 5527, load-1 1161). 24 calls that were in flight to the killed engine failed for their caller and were sent again to the other one, as a load balancer or a client retry does. The leader saw the dead engine after three missed heartbeats (15 s), put its running steps back in the queue, and the first engine finished them, also the runs of the calls that had failed. So a caller that retries can start a second run: make such Sutras safe to repeat (an idempotency key from the caller), as with any at-least-once system.

30 minutes of mixed work

Two engines for 30 minutes: a timer every 5 seconds, a Sutra that waits 2 seconds, one that always fails after two retries, the 5-step benchmark Sutra, and a redeploy halfway. 17,619 runs were started; Load 5x1KB: done 5873; Soak flaky: failed 5873; Soak timer: done 360; Soak wait: done 5873. Runs still open at the end: 0. The timer ran exactly once per 5 seconds in the whole cluster (from the leader only).

Memory of the busier engine, every minute of a 15-minute soak (MB): 173, 166, 190, 240, 241, 242, 242, 243, 244, 245, 246, 246, 244, 245, 245. It grows while caches and the heap warm up in the first minutes, then stays level: no leak.

A big file streamed on a small heap

One engine with Node held to 384 MB read a 1000 MB CSV file with Stream in batches (5000 rows per batch, a step per batch): done in 153 s (6.5 MB/s), 3729 steps, peak memory of the process 270 MB (144 MB at the start), database 4 MB at the end with Step data in history: none.

  • What changed in this release. Engines used to take one lock for every write in the cluster, so a second engine added nothing (82 steps a second with one engine or two); each run now has its own lock, and engines claim steps with skip locked. Project and Engine properties are cached for the settings refresh time instead of read for every step; the run state, step count and status are saved in one statement. Database transactions per step went from 14 to 7, and one engine went from 82 to about 120 steps a second. In memory, a step costs less than one transaction.
  • More engines scale when callers reach all of them, as behind a load balancer: with REST calls spread over the gateways, four engines did about three times the durable steps of one (352 against 116 a second), and in memory 1,660 against 540. When every run starts on one engine (a single timer, say), the others only help with the following steps, and in-memory runs not at all.
  • Bigger outputs cost more: each step writes its own output and reads the earlier ones. Because outputs are kept apart from the run state, one engine on PostgreSQL ran 145 steps a second with 64 KB outputs (60 before), 40.7 with 256 KB (14.3) and 7.7 with 1 MB (2.6). For steps that pass large data along, keep the data in a file or a table and pass its name, or stream it.
  • No run failed and none was lost in any scenario, including the one where an engine was killed.

Measuring on your own servers

The soak, load and big-file test tools that produced these figures are in the source repository (they are not part of the release packages); how to run them is in SutraFlow Contributor Information. The full reports are in docs/benchmarks.

Docker, Kubernetes and the application lifecycle

15. Docker in plain words, and making the image

This chapter is for administrators and DevOps engineers who have not used Docker before. It explains the words, what is inside the SutraFlow image and what is not, how to make the image, and the handful of commands you need every day. The chapters after it use these words.

The words

WordWhat it isFor SutraFlow
ImageA program packed with everything it needs to run (here Node.js 24 and the SutraFlow program), as one read-only file. It has a name and a tag, the version.sutraflow:2.1.8, or ghcr.io/spinny007/sutraflow:2.1.8. One image per SutraFlow version.
ContainerA running copy of an image, like a process. It can be stopped, removed and made again from the image at any time.Each studio or engine is one container. Many containers can run from the same image.
VolumeA folder Docker keeps outside the container. It survives when the container is removed and made again.Mounted at /data: logs and work files, and the SQLite database and master.key when there is no PostgreSQL.
Environment variablesSettings given to a container when it starts.SUTRA_MODE, SUTRA_DB, SUTRA_MASTER_KEY, SUTRA_ADMIN_TOKEN, SUTRA_ENGINE_ID
RegistryA store for images that servers pull from.GitHub (GHCR) for the official image; your own (Docker Hub, Azure, AWS, Google, Harbor, GitLab) for copies.
ComposeA file that lists containers to start together on one machine, with their settings.deploy/docker/compose.yml (studio and engine), compose.cluster.yml (PostgreSQL, studio, two engines)
KubernetesRuns containers over several machines: restarts them when they fail, spreads them, adds more under load.deploy/kubernetes
Pod, DeploymentA pod is Kubernetes' running unit (here one container). A Deployment keeps a number of identical pods running.The sutraflow-engine Deployment: 2 engines in base, 3 in prod.
Service, IngressA Service is one stable address for all pods of a kind, spread over them. An Ingress is the public door: host names and TLS.sutraflow-engine Service (gateway and admin ports); the prod Ingress for callers of your APIs.
Secret, ConfigMapSettings kept by Kubernetes and given to pods as environment variables or files: secret ones and ordinary ones.Secret sutraflow (token, master key, database address); ConfigMap sutraflow (mode, environment, workers).

What is in the image, and what is not

In the imageNot in the image (it stays per environment)
The SutraFlow program (studio, engine, gateway, Admin Console, the sutra command), Node.js 24, the guides, the samplesYour projects and Sutras, connections, properties, secrets, people, runs: all in the database. Releases come with sutra deploy, settings with sutra config apply.

The image is the same for every project and every environment. You never build an image per project, per application or per environment. Development, test and production run the same sutraflow:2.1.8; what differs is the database each one points at, its master key, and the releases and settings deployed into it.

When this changesNew image?What to do instead
A new Sutra, or a new version of oneNoDeploy a release (Adding an application)
A new project (application)NoDeploy its release; apply its config file
A connection, property or secretNosutra config apply, or the Admin Console
Number of enginesNoStart more containers from the same image
A new SutraFlow versionYes: its tagPull or build sutraflow:<new version>, then upgrade (below)
Your company's CA certificates, fonts, an extra toolOptionalMount them as files, or build your own image FROM sutraflow:2.1.8

Making the image

Pick one. They give the same image.

WayCommandsWhen
Pull the official onedocker pull ghcr.io/spinny007/sutraflow:2.1.8The server can reach GitHub. Signed; deploy/docker/README.md has the cosign verify command.
Build from a release packageUnpack sutraflow-2.1.8-linux.tar.gz (or the Windows zip), then in that folder bin/sutraflow image build (Windows: bin\sutraflow.cmd image build)No registry, or your own build. Needs Docker only, no npm or internet beyond the base image. Makes sutraflow:2.1.8.
Build from the source folderdocker build -t sutraflow:2.1.8 . in the SutraFlow repository (or sutraflow image build)Developers of SutraFlow itself, and the release pipeline.
Carry it to a server without internetsutraflow image save sutraflow-2.1.8.tar, copy the file, then on the server docker load -i sutraflow-2.1.8.tarClosed networks.
Put it in your registrydocker tag sutraflow:2.1.8 registry.example.com/sutraflow:2.1.8 then docker push registry.example.com/sutraflow:2.1.8Kubernetes and other servers pull from there; set the name in the overlay's images: or in .env (SUTRA_IMAGE).

On Windows, Docker Desktop runs Linux containers inside WSL 2: install it, start it once, and the commands above work in PowerShell. On a Linux server, install Docker Engine from your distribution or docker.com.

Your first container, on your own machine

  1. Make the image (above) and check it is there: docker images sutraflow.
  2. Start a studio with a volume for its data:
    docker run -d --name sutra-studio -p 4800:4800 -p 8080:8080 -v sutra-studio:/data -e SUTRA_ADMIN_TOKEN=<a long random text> sutraflow:2.1.8
  3. Open http://localhost:4800. The first visit creates the administrator, as with the web installer.
  4. Design and run a Sutra as usual. Its REST services answer on http://localhost:8080.
  5. Stop it with docker stop sutra-studio (it drains: running steps finish first) and start it again with docker start sutra-studio. The data is in the sutra-studio volume, so docker rm and a new docker run with the same volume keep everything.

For a studio and an engine together, or a cluster with PostgreSQL, use the Compose files instead: copy deploy/docker/env.example to .env, fill it in, and run docker compose -f deploy/docker/compose.cluster.yml --env-file .env up -d. From a release package, sutraflow docker cluster up does the same and makes the .env for you.

A production install with Compose, step by step

A fresh studio and engine from the official image, in its own folder, on ports chosen in .env (here 4900 and 4901, so it does not clash with another SutraFlow on 4800). The screenshots are from a real install on Windows with Docker Desktop; the commands are the same in a Linux shell.

  1. Remove an old image (only if there is one). Stopped containers made from it go first (docker rm <name>); their volumes stay.
    docker images then docker rmi sutraflow:2.1.8
An image built earlier on this machine, removed before pulling the official one.
An image built earlier on this machine, removed before pulling the official one.
  1. Pull the image. It is public: no sign-in.
    docker pull ghcr.io/spinny007/sutraflow:2.1.8
The official image pulled from GitHub (GHCR).
The official image pulled from GitHub (GHCR).
  1. Make a folder with compose.yml (from deploy/docker in the release package) and an empty deploy-drop folder:
    New-Item -ItemType Directory -Force C:\sutra-production\deploy-drop
    Copy-Item <package>\deploy\docker\compose.yml C:\sutra-production\
  2. Write .env beside it. Two values you make up yourself, nobody hands them to you:
    • SUTRA_ADMIN_TOKEN: the password of the admin API, any long random text. The containers read it on start and accept exactly that value from then on.
    • SUTRA_MASTER_KEY: the vault key, 32 random bytes in Base64. Back it up: without it the secrets cannot be read.
    In PowerShell, both at once:
    $r = [System.Security.Cryptography.RandomNumberGenerator]::Create(); $t = New-Object byte[] 24; $r.GetBytes($t); $k = New-Object byte[] 32; $r.GetBytes($k)
    "SUTRA_ADMIN_TOKEN=" + (($t | ForEach-Object { $_.ToString('x2') }) -join '')
    "SUTRA_MASTER_KEY=" + [Convert]::ToBase64String($k)
    On Linux: openssl rand -hex 24 and openssl rand -base64 32. Add the rest from env.example: the image, the version, the environment name and the ports.
Making the master key and the admin token (blurred here). A master key must be 32 bytes: the last command checks it.
Making the master key and the admin token (blurred here). A master key must be 32 bytes: the last command checks it.

The master key, before the first start:

  • Make it once per environment (development, test and production each have their own) and put it in .env before docker compose up: the engine encrypts every secret with it from the first one on.
  • Check it: [Convert]::FromBase64String("<key>").Length must answer 32.
  • Back it up at once, apart from the server: a password manager or your secret store. A backup of the database is useless without it, and a new key cannot read the secrets saved with the old one.
  • Never change it on a running environment, and never copy production's key to test.
The .env of this install (the token and the key blurred here). COMPOSE_PROJECT_NAME names the containers and volumes; the ports are the ones published on this machine.
The .env of this install (the token and the key blurred here). COMPOSE_PROJECT_NAME names the containers and volumes; the ports are the ones published on this machine.
Setting in .envDefaultWhat it is
SUTRA_STUDIO_PORT4800The studio: designer, Admin Console, Approval Center
SUTRA_STUDIO_GATEWAY_PORT8080The studio's gateway (REST and SOAP services while designing)
SUTRA_ENGINE_PORT4801The engine's Admin Console and admin API
SUTRA_ENGINE_GATEWAY_PORT / SUTRA_ENGINE_GATEWAY_TLS_PORT9080 / 9443The engine's gateway, HTTP and HTTPS: what callers of your APIs use
SUTRA_ENVIRONMENTproductionThe engine's environment name, shown in the console and the logs
COMPOSE_PROJECT_NAMEthe folder namePrefix of the containers and volumes (sutraflow-production-engine-1)
  1. Start it in that folder: docker compose up -d
The volumes, the network and both containers are made and started.
The volumes, the network and both containers are made and started.
  1. Check it: docker compose ps shows both healthy, and /ready answers on each port.
Both healthy, published on the ports from .env, and ready.
Both healthy, published on the ports from .env, and ready.
  1. The studio: create the administrator. Open http://localhost:4900/. The first visit asks for the administrator: a name and a password (twice).
First visit to the studio: Create the administrator.
First visit to the studio: Create the administrator.

The designer (the editor) opens at once, signed in. It is only in the studio.

The designer of the new studio, empty.
The designer of the new studio, empty.

The Admin Console is at http://localhost:4900/admin, with the same sign-in.

The studio's Admin Console.
The studio's Admin Console.
  1. The engine: make its first administrator on the command line. The engine is headless: no designer (/ answers 404), and it does not offer to create the administrator in the browser.
    docker compose exec -e ADMIN_PW="<first password>" engine sutra user add admin --role administrator --password-from-env ADMIN_PW
The engine's first administrator, made inside the container (no token to type).
The engine's first administrator, made inside the container (no token to type).
  1. Sign in to the engine's Admin Console at http://localhost:4901/admin with that name and password.
The engine's Admin Console: Sign in.
The engine's Admin Console: Sign in.

The first sign-in asks for a password only the administrator knows (skipped when the account was made with --keep-password).

Choose your password: replaces the one given on the command line.
Choose your password: replaces the one given on the command line.
The engine's Admin Console: one engine, the leader, ready; the gateway listening.
The engine's Admin Console: one engine, the leader, ready; the gateway listening.
  1. A system account for pipelines, with only the role it needs, and its token (shown once: put it in the pipeline's secret store). Tokens expire and can be revoked one by one; the admin token in .env cannot.
    docker compose exec engine sutra user add ci-deployer --system --role deployer
    docker compose exec engine sutra token create ci-deployer --name pipeline --expires-days 90
A system account and its token (hidden here), listed and revoked.
A system account and its token (hidden here), listed and revoked.

People and system accounts can also be managed in the Admin Console, on the Users and System accounts pages.

After installation: where to sign in

The studio has the designer (the editor). The engine is headless: no designer, only the Admin Console and the Approval Center. Sutras are designed in the studio and deployed to the engine. With the ports of the install above:

PageStudio (4900)Engine (4901)
Designer (editor)http://localhost:4900/Not there: / answers 404
Admin Consolehttp://localhost:4900/adminhttp://localhost:4901/admin
Approval Center (business people)/approvals/approvals
Guides/guide, /admin-guide, /design-guide, /architectureThe same
Gateway (callers of your APIs)HTTP 4980HTTP 4990, HTTPS 4943
First administratorSign in
StudioAsked for on the first visit (Create the administrator); signed in at onceThe same name and password for the designer and its Admin Console
EngineMade on the command line (sutra user add ... --role administrator); the browser does not offer it/admin; the first sign-in asks for a new password (not with --keep-password)

Separate accounts. The studio and the engine each have their own database, so their people and system accounts are separate: an administrator of the studio cannot sign in to the engine, and the other way round. Make the people each one needs on each. In a cluster (compose.cluster.yml, Kubernetes) all engines share one PostgreSQL database and therefore one set of accounts.

A forgotten password or a locked account, from the server (use studio instead of engine for a studio account):
docker compose exec -e NEW_PW="<new password>" engine sutra user password admin --password-from-env NEW_PW
docker compose exec engine sutra user unlock admin

People, system accounts and roles in containers

KindWhoSigns in with
PersonSomeone who opens the studio or a consoleName and password
System accountA pipeline, a script, another systemAn API token (no password)
RoleWhat it may do
administratorEverything, including users, roles and server settings
developerDesign and test Sutras and connections
deployerDeploy packages and Sutras, roll back
operatorRun production: runs, approvals, engines, gateway, alerts, audit
approverDecide approvals
viewerRead what it is granted, change nothing (a person's default)
apiCallerCall gateway services (a system account's default)

Without --project a role applies to all projects; with --project "Orders" to that project only. Run the commands in the container that should hold the account.

TaskCommand
Add a person (the password through a variable, not in the command history; they choose their own at the first sign-in)docker compose exec -e NEW_PW="<first password>" engine sutra user add priya --role operator --display "Priya Shah" --email priya@example.com --password-from-env NEW_PW
List people and system accountsdocker compose exec engine sutra user list
A new passworddocker compose exec -e NEW_PW="<new password>" engine sutra user password priya --password-from-env NEW_PW
Locked after wrong passwordsdocker compose exec engine sutra user unlock priya
A lost laptop: end every sessiondocker compose exec engine sutra user sign-out priya
A leaver (enable brings them back), or deletedocker compose exec engine sutra user disable priya, ... sutra user delete priya
A system account for one project's pipelinedocker compose exec engine sutra user add ci-orders --system --role deployer --project "Orders"
Its token (shown once: straight into the CI secret store)docker compose exec engine sutra token create ci-orders --name github --expires-days 90
Rotate tokensdocker compose exec engine sutra token list ci-orders, then ... sutra token revoke ci-orders <token id>

A brand-new project is not on the engine yet: for its first deploy, give the pipeline's account deployer without --project, or deploy once with the admin token.

Using a token. Inside a container sutra needs none: it uses that container's own SUTRA_ADMIN_TOKEN, which the compose files and manifests set. A container started by hand without it answers A token is required: add -e SUTRA_ADMIN_TOKEN=... to docker run, or pass --token. From another machine or a pipeline: sutra status --server http://localhost:4901 --token <token>, or set SUTRA_SERVER and SUTRA_ADMIN_TOKEN once. A system account's token can do only what its role allows. Do not hand out the admin token from .env: it acts as an administrator and can only be replaced by changing .env and restarting.

Deploying a Sutra package to the engine

  • By the drop folder: put the .sutra file in the folder named by SUTRA_DEPLOY_FOLDER (C:\sutra-production\deploy-drop above), then docker compose restart engine. Packages there are deployed when the engine starts; the pipeline that put them there had them approved.
  • With a plan and an approval:
    docker compose cp orders-1.4.0.sutra engine:/tmp/
    docker compose exec engine sutra check /tmp/orders-1.4.0.sutra
    docker compose exec engine sutra deploy /tmp/orders-1.4.0.sutra --approve <plan id>
    check lists what is new, unchanged, replaced and undeployed and gives the plan id; nothing is replaced without it (Redeploying needs a person).

Running it day to day (Compose)

TaskCommand, in the install folder
Statusdocker compose ps, docker compose exec engine sutra status
Logsdocker compose logs -f engine
Stop (running steps finish first, up to 45 s)docker compose stop
Start againdocker compose up -d
Move to other portsChange the ports in .env, then docker compose up -d
Upgrade SutraFlowBack up, change SUTRA_VERSION in .env, docker compose pull, docker compose up -d (below)
Remove the containers, keep the datadocker compose down
Remove everything including the datadocker compose down -v: cannot be undone

The data is in the Docker volumes (sutraflow-production_studio-data and sutraflow-production_engine-data above); stopping, upgrading and down keep it. From an unpacked release package, sutraflow docker up (Windows: bin\sutraflow.cmd docker up) uses the same Compose file and makes .env with the admin token and the master key on first use; the ports and the other settings can be added to it afterwards.

Commands you need every day

CommandWhat it does
docker psRunning containers, their ports, and healthy once /health answers
docker logs -f sutra-studioA container's log (JSON lines); Ctrl+C stops following. With Compose, by service name: docker compose logs -f engine-1
docker exec sutra-studio sutra statusRuns the sutra command inside the container: engines, leader, queue. Any sutra command works this way, against that container's own server with its SUTRA_ADMIN_TOKEN; no address or token to type. With Compose: docker compose exec engine-1 sutra status
docker stop / docker start / docker restartStops gracefully (drains), starts, restarts one container
docker compose ... up -d / stop / downStarts everything in a Compose file / stops it / stops and removes the containers (volumes stay unless -v)
docker volume lsThe volumes, where data outside PostgreSQL lives
kubectl -n sutraflow-prod get podsKubernetes: the engine pods and whether they are ready
kubectl -n sutraflow-prod logs deploy/sutraflow-engineKubernetes: an engine's log
kubectl -n sutraflow-prod exec deploy/sutraflow-engine -- sutra statusKubernetes: the sutra command inside an engine pod

Upgrading SutraFlow in containers

Engines of different versions must not run on one database: the new version changes the database for its own program. So a version upgrade is stop all, then start all, not a rolling update:

  1. Back up the database (pg_dump -Fc, or your managed service's snapshot) and keep the master key safe.
  2. Make or pull the new image, for example sutraflow:2.1.8.
  3. Stop every engine and the studio: docker compose stop, or in Kubernetes kubectl -n sutraflow-prod scale deploy/sutraflow-engine --replicas=0 (and the studio, if any).
  4. Change the tag: SUTRA_VERSION in .env, or newTag in the overlay's kustomization.yaml.
  5. Start: docker compose up -d, or kubectl apply -k deploy/kubernetes/overlays/prod (which also sets the replicas back). The first engine to start makes the database changes; the others wait for it.
  6. Check: sutra status shows the new version on every engine.

Restarts with the same version (a changed setting, a moved node, kubectl rollout restart) are rolling and lose nothing: each engine drains before it stops and the others keep serving.

Remember

One image for everything; projects travel as releases, settings as config files.
The database and the master key are the environment: back them up, and never share them between test and production.

16. Containers and Kubernetes

SutraFlow runs from one image: studio, engine or both, chosen with SUTRA_MODE. The image is the same for every environment; settings come from environment variables and config files, and releases from sutra deploy.

Image fromHow
The official registryghcr.io/spinny007/sutraflow:2.1.8 (also 2.1 and latest), for amd64 and arm64. It is signed with cosign (keyless) and carries an SBOM and provenance. deploy/docker/README.md gives the verify command.
Your registryCopy the official image, or build on it: FROM ghcr.io/spinny007/sutraflow:2.1.8
A site without internetsutraflow image build in the release package (no npm needed), sutraflow image save sutraflow-2.1.8.tar, then docker load -i on the server

The container runs as an ordinary user (uid 1000) and keeps its data in /data. It answers /health (alive) and /ready (ready for work, not while draining) on port 4800. When stopped it drains, so running steps finish first: give it 45 to 60 seconds.

Docker

deploy/docker/compose.yml runs a studio and an engine, and compose.cluster.yml runs PostgreSQL with pgvector, a studio and two engines. Copy env.example to .env and fill it in. In a release package, sutraflow docker up and sutraflow docker cluster up use these files.

Kubernetes

deploy/kubernetes holds Kustomize files:

  • base: engines with readiness and liveness checks, a disruption budget, and a network policy that opens the gateway but keeps the admin API inside;
  • overlays/test: one engine and the optional studio;
  • overlays/prod: three engines, an autoscaler and an Ingress;
  • jobs/config-and-deploy.yaml: a Job that applies the config file and deploys an approved release.
kubectl -n sutraflow-test create secret generic sutraflow --from-literal=SUTRA_ADMIN_TOKEN=... --from-literal=SUTRA_MASTER_KEY=... --from-literal=SUTRA_DB=postgres://...
kubectl apply -k deploy/kubernetes/overlays/test

Engines in a cluster share one PostgreSQL database and one master key; back the key up. Behind an Ingress, put the controller's address range in server.gateway.trustedProxies in the config file, so callers' addresses are read correctly. Project files that every engine must see need a shared (ReadWriteMany) volume at /data/files.

17. From development to production, step by step

How an application (a SutraFlow project and its Sutras) moves from a designer's machine to test (UAT) and to production, with or without Docker, by hand or by a pipeline. The steps are the same whichever way the servers run; only where the commands are typed changes.

Three things travel separately

WhatWho makes itHow it travelsHow often
The SutraFlow programThe SutraFlow releaseA release package (installer zip or tar.gz) for servers without Docker; the image for containersWhen you upgrade SutraFlow
The application: a project's SutrasDesigners, in the studioA release: orders-1.4.0.zip, versioned, built in the studio or from GitEvery version of the application
The environment's settings: connections, properties, secrets, gateway, rolesDevOps and administratorsA config file for what every environment has, and an environment file per environment for what differs (hosts, users, secrets), kept in GitWritten once per project; changed when the environment changes

The database and the master key do not travel: each environment has its own.

The environments

StageWithout DockerWith Docker
Development: designers build and try SutrasA laptop or a small VPS: sutraflow install (the web installer) or Laragon; one studio, SQLite is enough (The web installer, Development machines)sutraflow docker up: a studio and an engine in containers on the laptop (Docker in plain words)
Test / UAT: testers and business users try a releaseA VPS installed silently (sutraflow install --config install.json) with PostgreSQL; a studio for looking around, or engines onlycompose.cluster.yml on one VPS, or Kubernetes overlays/test: one engine and the optional studio
ProductionTwo or more VMs with engines only (sutraflow start engine), one PostgreSQL (managed or replicated), a load balancer (Setting up a cluster)Kubernetes overlays/prod: three engines, the autoscaler, an Ingress; PostgreSQL managed or run by an operator

Mixing is fine: development without Docker and production in Kubernetes is common. A release built on a laptop deploys to a container exactly as to a VM, because both run the same SutraFlow version.

The path of one application, step by step

  1. Design and try in the development studio: Sutras, their test data, the project's connections pointing at development systems.
  2. Build a release: Designer, Releases, Build (choose the version), or from Git in a pipeline: sutra package --from-git . --version 1.4.0 --out orders-1.4.0.zip. The release holds the Sutras, not the passwords.
  3. First time only: write the config files. Export what the project uses from development:
    sutra config export --project "Orders" --out config/orders.yaml
    Commit it to Git. Then write a small environment file per environment, config/env/uat.yaml and config/env/prod.yaml, with that environment's hosts and users, and secrets as ${env:NAME} (read from the pipeline's secret store) or file:/run/secrets/name. Add --server-settings to the export the first time you set up a whole server (gateway options, roles, system accounts, alerts). See Configuration as files.
  4. Test / UAT:
    1. sutra config check config/orders.yaml --env config/env/uat.yaml: what would be created, and the checklist of what is already there. Changes nothing.
    2. sutra config apply config/orders.yaml --env config/env/uat.yaml: creates the missing connections, properties and secrets.
    3. sutra check orders-1.4.0.zip: the plan (new, unchanged, replaces, undeployed) and its plan id.
    4. sutra deploy orders-1.4.0.zip: asks for yes if something is replaced; in a pipeline --approve <plan id> after the approval gate.
    5. Testers use the APIs, approvals and dashboards on UAT.
  5. Production: the same four commands with --env config/env/prod.yaml and the same orders-1.4.0.zip. Never rebuild a release for production: what was tested is what goes live.
  6. Later versions: only steps 2, 4 and 5. The config apply creates only what is new (a connection added in 1.5.0, say) and lists everything else for checking; nothing set by hand on a server is overwritten.

Each command talks to a server's admin port: give --server https://uat-engine:4800 --token <token>, or set SUTRA_SERVER and SUTRA_ADMIN_TOKEN once. The token is a system account's (sutra token create ci-deployer), with Deploy on the project. A brand-new project needs Deploy on all projects (or the admin token) the first time.

Three ways to deploy, the same result

WayHowGood for
Admin ConsoleReleases: upload the release zip, read the plan and the checklist, type the project's name if something is replaced, Deploy. Each project's package history, with Roll back, on the same page.Small teams, the first deployments, anyone who prefers pages
The sutra command (silent)sutra config apply, sutra check, sutra deploy from a terminal or script; with Docker, docker exec <engine> sutra ...Repeatable steps, scripts, servers without a browser
A pipelineThe same commands in GitHub Actions, GitLab CI, Azure DevOps or Jenkins, with a manual approval between check and deploy (CI/CD pipelines)Teams with Git: every deployment recorded, approved and repeatable

A fourth way suits fixed set-ups: put .sutra packages in the deploy folder (SUTRA_DEPLOY_DIR, /deploy in the image). Engines deploy them when they start. It is how an engine-only appliance carries its applications, but it has no approval step, so use it only where the folder is controlled.

"Silent" for the program, and for applications

  • Installing SutraFlow without a browser: on a VM, sutraflow install --config install.json (Silent installation); in Docker, the environment variables are the installation: there is nothing else to run.
  • Deploying applications without a browser: the sutra commands above.
  • The first administrator of an engine-only server: sutra user add admin --role administrator --password-from-env ADMIN_PW on the server (with Docker, docker exec -e ADMIN_PW=... <engine> sutra user add ...). A studio asks for it on its first visit instead.

CI/CD with or without Docker

The pipeline only needs the sutra command and the target's admin address. It does not matter how the target runs:

Pipeline runsTarget runsNotes
In the SutraFlow image (the files in deploy/ci)VMs, Docker or KubernetesThe easiest: sutra is the same version as the server
On a runner with Node.js 24 and the release packageVMs, Docker or KubernetesUse bin/sutraflow cli from the unpacked package of the server's version
Inside KubernetesKubernetesThe Job in deploy/kubernetes/jobs/config-and-deploy.yaml runs the config apply and the approved deploy from inside the cluster, so the admin port never leaves it
Good practice

Keep the config file, the environment files and the pipeline in the project's Git repository; secrets only in the CI secret store.
Number releases (1.4.0, 1.4.1) and keep the zips: an earlier zip is the way back.
Read the checklist after the first deployment to each environment: a connection kept from before may still point at the wrong host.

18. Adding an application to a running cluster

A cluster is running, in Docker, in Kubernetes or on VMs, and a new application (a new project) must go live, or a new version of an existing one. No new image, no new container and no restart are needed. The application goes into the shared database through any one engine, and every engine serves it within one heartbeat (5 seconds).

What you need

  • The release zip from the designers, for example billing-1.0.0.zip.
  • The project's config file and the environment file for this environment (From development to production, step 3), with its secrets in environment variables or files.
  • The admin address of any engine, and a token: a system account's with Deploy on all projects for a new project (on the project for a new version), or the cluster's SUTRA_ADMIN_TOKEN.

The steps

  1. Tell sutra where the cluster is (once per terminal):
    SUTRA_SERVER=http://<admin address>, SUTRA_ADMIN_TOKEN=<token> (PowerShell: $env:SUTRA_SERVER = "...").
  2. Check the settings: sutra config check billing.yaml --env env/prod.yaml. It lists what will be created and stops on any problem (a missing environment variable, a connection naming one that does not exist).
  3. Create them: sutra config apply billing.yaml --env env/prod.yaml --checklist checklist.md. All or nothing; existing items are kept and listed in checklist.md.
  4. Check the release: sutra check billing-1.0.0.zip. For a new project every Sutra is new, so no approval is needed. For a new version, the Sutras it replaces are listed, with the plan id.
  5. Deploy: sutra deploy billing-1.0.0.zip (type yes when asked), or --approve <plan id> in a pipeline.
  6. Verify: Admin Console, Applications shows the project and its Sutras deployed; Engines shows every engine alive; call one of its APIs through the load balancer or Ingress.

The Admin Console way is the same in pages: Releases, upload, read the plan and checklist, Deploy. Settings that the release needs and the server lacks show in the checklist; create them with sutra config apply or in the Admin Console before the Sutras run.

Where the admin address is

ClusterAdmin address for the steps
Docker Compose on one machinehttp://localhost:4800 (the studio in compose.cluster.yml), or run the commands inside an engine container: docker compose cp billing-1.0.0.zip engine-1:/tmp/ then docker compose exec engine-1 sutra deploy /tmp/billing-1.0.0.zip (inside a container, sutra needs no address or token: it uses that container's own engine and SUTRA_ADMIN_TOKEN)
Kubernetes, from your laptopkubectl -n sutraflow-prod port-forward svc/sutraflow-engine 4800:4800 in one terminal; then http://localhost:4800 in another
Kubernetes, from a pipelineThe Job in deploy/kubernetes/jobs/config-and-deploy.yaml: it runs inside the namespace, with the release address and the approved plan id
VMsAny engine's admin port on the private network, for example https://engine-1.internal:4801

Kubernetes keeps the admin port inside the namespace: its network policy lets in only pods labelled sutraflow-admin: "true" (the studio and the Job) and other SutraFlow pods. kubectl port-forward goes through your Kubernetes sign-in, so it works without opening the port.

After it is live

TaskHow
A new versionThe same steps with the new zip; the plan lists what it replaces and needs a person's yes
Go back to the previous versionAdmin Console, Releases: the project's package history, Roll back; or sutra history --project Billing then sutra rollback --project Billing
Pause itAdmin Console, Applications, Stop on the Sutra; or sutra sutras stop <sutra> --project Billing (its triggers stop; deployed versions stay)
Files it reads or writesIf every engine must see them, a shared volume at /data/files (ReadWriteMany in Kubernetes, a shared drive on VMs)
Timers and folder or mailbox listenersNothing to do: the leader runs them, once for the cluster
Many applications, one cluster

A cluster runs any number of projects. They share the engines and the database; roles keep each team to its own projects. Give a project its own cluster only when it must be isolated (separate data, a separate network) or sized on its own.

19. One Admin Console for the whole cluster

Every engine of a cluster, and the studio, serves the Admin Console on its admin port. They all read the same database, so each one shows the whole cluster: every engine, every project and deployed Sutra, every run, the queue, the gateway, people and the audit log. It does not matter which one you open. The Admin Console is not the leader's: the leader only runs timers and listeners (Setting up a cluster).

Give people one address

Put the admin ports of all engines behind one address on your private network (an internal load balancer, an internal Ingress, or a VPN host name) with /ready as the health check. A sign-in is a cookie signed with a key kept in the shared database, so it is valid on every engine: when an engine stops, the load balancer sends the next page to another engine and the person stays signed in.

ClusterThe Admin Console
One machine (studio and engine)http://localhost:4800, or the engine's 4801
VMsAn internal load balancer over every engine's admin port (4801), for example https://sutra-admin.internal
Docker Composehttp://localhost:4800 (the studio); to open an engine's too, publish its port 4800 in the Compose file
Kuberneteskubectl -n sutraflow-prod port-forward svc/sutraflow-engine 4800:4800, then http://localhost:4800/admin. For a permanent address, an internal Ingress to the sutraflow-engine Service's admin port, and a rule in base/network.yaml that lets the ingress controller's namespace reach port 4800

Without a load balancer, keep the addresses of two engines. If one does not answer, open the other: it shows the same.

When an engine, the leader or the studio stops

What stopsWhat happensWhat you do
Any engineIts running steps are finished by the others; callers reach the others through the load balancer; the Admin Console shows it as not aliveNothing; start it again when you can. Kubernetes restarts it by itself.
The leaderIts lease runs out within 15 seconds and another engine becomes leader; timers and listeners start there. APIs never pause.Nothing. Engines shows the new leader; sutra status and /metrics (sutra_engine_leader) say the same.
The studioDesigners cannot design. Deployed Sutras keep running on the engines; their Admin Consoles keep working.Start it again; on Kubernetes it restarts by itself.
The databaseEngines keep running what they can, retry, and report not readyRestore the database; engines recover by themselves

Nobody needs to know which engine leads. There is no leader to choose or configure: engines elect one among themselves (Never lead keeps one out of it).

Keep PostgreSQL near the engines

Every step is several database round trips, and the cluster's leader, queue and heartbeats run through the database. Put PostgreSQL in the same data centre or cloud region as the engines, with a round trip of about 2 ms or less (SELECT 1 from an engine machine). A managed PostgreSQL in the engines' region is ideal.

Measured 4 November 2026, image 2.1.6, two enginesRound tripResult
PostgreSQL 18.2 on the same machine0.4 msReady in 4 s; 120 simultaneous calls answered in 3.9 s, steps shared by both engines, each step once; leader killed: 8 of 8 slow calls answered, new leader in 5.6 s; docker stop drained and exited 0
Hosted PostgreSQL 17.2 over the internet (through the provider's connection pooler)75 msStarted, deployed once, elected one leader, no errors, but each call took 3 to 8 s instead of 0.15 s, and 120 calls at once were not answered within 60 s

A database far away works for a Sutra's own database connections (Resources, Database connection), where a few queries per run are fine. It is not suitable as the engines' own SUTRA_DB.

20. Questions from DevOps teams

QuestionAnswer
Do we need a separate image for each project or application?No. One image per SutraFlow version, for every project and environment. Projects are releases deployed into the database (Docker in plain words).
Do we rebuild the image when designers change a Sutra?No. They build a release; you deploy it (Adding an application).
Which database for a cluster? Can it be remote or managed?PostgreSQL 14 or later (17 and 18 tested), with pgvector for knowledge bases kept in PostgreSQL. A managed service is recommended, in the engines' region (round trip about 2 ms or less). MySQL, SQL Server and Oracle can be connections for Sutras but not SutraFlow's own database. SQLite means one engine only.
Can the cluster use a database through a connection pooler (PgBouncer and the like)?Prefer a direct connection, or a pooler in session mode: the engines use session features (locks for the leader, notifications that wake the queue).
Where do passwords and keys go?SUTRA_MASTER_KEY, SUTRA_ADMIN_TOKEN and SUTRA_DB (or SUTRA_DB_PASSWORD) in a Kubernetes Secret or the Compose .env, never in the image. Application secrets go into the vault through config files (${env:NAME}, file:) or the Admin Console.
What must we back up?The PostgreSQL database and the master key. Without the key, the vault's secrets cannot be read. Volumes hold only logs and work files, unless the server runs on SQLite.
How many engines?Two at least, for failover. Then by load: the prod overlay's autoscaler adds engines between 2 and 10 at 70% CPU (it needs the Kubernetes metrics server). See Sizing.
Does adding engines always add throughput?For API calls and steps, yes, until PostgreSQL is the limit. Timers and folder or mailbox listeners run on the leader only; the steps they start are shared.
Do we need the studio in UAT or production?No. Engines serve the Admin Console, the APIs and the automation API. A studio in UAT is handy for looking at Sutras; production usually has engines only.
Which Admin Console do we use, and what if the leader goes down?Any engine's: they all show the whole cluster. The leader is not special for the Admin Console; if it stops, another engine leads within 15 seconds (One Admin Console).
How do we deploy without a browser?sutra config apply, sutra check, sutra deploy --approve, from a terminal, a pipeline or docker exec (From development to production).
What config do we export, and from where?Per project, from the development studio: sutra config export --project "Orders". Once per server set-up, add --server-settings. People are never exported; secrets come out as ${env:...} placeholders.
Will a deployment overwrite what an administrator set by hand?No. Config apply and deploy create only what is missing and list the rest in a checklist. Replacing Sutras needs a person's approval.
How do we upgrade SutraFlow?New image tag; stop all engines, start them on the new tag. Never run two versions on one database (Upgrading SutraFlow in containers).
How do we see logs and health?docker logs or kubectl logs (JSON lines), /health and /ready, /metrics for Prometheus, OpenTelemetry traces (Monitoring).
How do callers reach our APIs?Through the gateway ports (8080, 8443) behind a load balancer or Ingress. Add its address range to trustedProxies so callers' addresses are read correctly.
Can we run without Docker in production?Yes: VMs with the release package, engines only, one PostgreSQL, a load balancer (Setting up a cluster). The release and config steps are identical.
Can we run without internet?Yes: the offline release package, or sutraflow image save and docker load.

The Admin Console

21. The Admin Console

The Admin Console manages what is deployed: running projects and Sutras, approvals, engines, people, system accounts, roles and the audit log. Designing stays in the designer. Open it with Admin Console in the designer's top bar, or at /admin on the admin port (http://127.0.0.1:4800/admin). Headless engines serve the console too, without the designer.

The Overview: engines, deployed Sutras, runs of the last day, approvals, the work queue and the gateway, with recent failures.
The Overview: engines, deployed Sutras, runs of the last day, approvals, the work queue and the gateway, with recent failures.

Operate

  • Overview: tiles for engines, deployed Sutras, runs of the last 24 hours, waiting approvals, the work queue and the gateway certificate, and the latest failed runs with Resubmit. Design runs (tests, debugging and drafts) are not counted.
  • Applications: every deployed project with its package version and its Sutras: version, started or stopped, what starts it (REST path, SOAP path, timer, skill), runs of the last day and the last run. Stop makes the Sutra's triggers start nothing (its address answers 404, timers and listeners pause) while it stays deployed; Start brings it back on every engine; Restart does both at once, so its address, timers and listeners start fresh with the current connections. Runs opens its runs with every step's result, Resubmit and Cancel run; Versions deploys an earlier version; Tuning sets how the Sutra runs (below); Package history rolls the project back to an earlier package.
  • Agent conversations (View permission to see, Server permission to clear): the conversations of every published agent, active and expired, with their messages and the time of the last one. A conversation token continues a conversation only until it expires (the agent channel's Conversation lasts); expired conversations keep their AI memory in the database until Clear expired removes them, with their messages and summaries, for one agent or all (sutra agents clear-expired [--agent name]). Active conversations are never touched. It is recorded in the audit log.
  • Knowledge admin (Server permission): every knowledge base with its home project; share one as a server knowledge base with every project or granted projects and areas, managed sources that keep areas in step (Sync now, Re-index, History, Export as Sutra), the MCP search tool and Rebuild vectors. See Knowledge admin.
  • Traceability (View permission): every project you may see with its runs by outcome (done, failed, cancelled, open) over the last hour to 90 days. Open a project for its Sutras, deployed or not, with their ids, success rate, last run and last failure; open a Sutra for its runs. Find a run takes a run id (or its first characters), who started it, or a value anywhere in the data it started with, such as an order number. A run shows its ids (run, Sutra, project, each with Copy), who started it, what it started with, every step with its status, try, time, engine, error and full input and output (opened on request), its reply and log, and the runs it called or was called by (Call Sutra), each a click away. Download saves the whole run as JSON. Started by is a person (their account, for Run in the designer or Admin Console), an API client (the security policy's method and the caller it names: the token's subject, the API key's name or the user, with the address and gateway app; anonymous where the route has no policy), the system (a timer, listener, channel or alert), or another run. Runs from before 2.1.0 show only the kind of starter. What a step's data shows follows the Sutra's Step data tuning: all, only for failed runs, or none.
  • Approvals: what waits for a person and for whom (roles, accounts, progress, due time), with a button to open the Approval Center, where the approvers decide.
  • Releases: deploy a release zip (or .sutra package): choose the file, see its Sutras, the secrets present or missing on this server, where it was built from and its deployment config, change the project or give another config, then Deploy. Below, every project's current package with its history: Roll back, or Deploy again for any earlier one. This is how a production server receives Sutras.
  • Engines: the cluster's name, and every engine sharing the database: its name, alive or silent, leader, steps running, heartbeat, Node memory and May lead. Rename gives an engine a name people read; the cluster name is changed at the top (sutra engines cluster-name "Shop cluster"). Turning May lead off keeps an engine from leading (sutra engines lead <engine> --no); at least one engine must be allowed. Drain and stop asks one engine to finish its steps, hand the rest to the others and stop; your service manager starts it again. Delete old runs now runs housekeeping at once. Tuning on the same page sets engine values (below).
Traceability: a project's runs by outcome, its Sutras, and a run with every step.
Traceability: a project's runs by outcome, its Sutras, and a run with every step.
Every confirmation offers the same action from a shell: the sutra command and the HTTP call, for Windows PowerShell or Linux and macOS.
Every confirmation offers the same action from a shell: the sutra command and the HTTP call, for Windows PowerShell or Linux and macOS.

The Console panel and commands for every action

Console in the top bar opens a panel with every action taken in this browser tab: what was done, whether it worked, how long it took, and the server's answer. Each entry also shows the same action as a command, for Windows PowerShell and for Linux and macOS shells: the sutra command and the HTTP call (Invoke-RestMethod or curl). Every confirmation has Run it from a shell instead with the same commands, so an action can be scripted, put in a runbook, or tried again from a shell when the console is not at hand. Commands read the server address and token from SUTRA_SERVER and SUTRA_ADMIN_TOKEN; use a system account's API token. Passwords never appear in commands: they read NEW_PASSWORD from the environment.

sutra sutras list
sutra sutras restart "Order lookup API" --project "Orders"
sutra runs list --status failed
sutra runs resubmit 3f2c...
sutra approvals approve 42 --comment "checked"
sutra engines drain engine-2
The Console panel: what was done, its output, and the same action as commands to copy.
The Console panel: what was done, its output, and the same action as commands to copy.

Tuning

Tuning changes how deployed Sutras run, while they run. Every engine applies a change within a heartbeat, without a restart. Values set by environment variables stay the defaults, and an empty field returns to them.

Engine tuningWhat it does
Steps at onceSteps one engine runs at the same time. Set for all engines, or for one engine (a bigger machine, or 0 for a studio that should not run work).
Steps per run limitStops runs that take more steps, such as loops that never end.
Reply waitHow long REST, SOAP and MCP callers wait for a reply step.
Keep finished runs, Keep audit entriesDays before housekeeping deletes them.
Keep design runsDays before housekeeping deletes finished design runs (tests, debugging, drafts); 7 by default, and 0 keeps them as long as finished runs.
Trace samplingShare of runs sent to the OpenTelemetry collector.
Sutra tuningWhat it does
Runs at onceMore runs wait as queued and start, oldest first, when one ends. Protects a slow partner system or a database.
PrioritySteps of higher priority Sutras are taken from the shared work queue first.
Run time limitRuns still open after this many minutes are cancelled with an error.
Retries, First retry afterFor steps whose own settings have no retries.
Step data in historyall, errors only (step data is kept only for runs that did not finish well), or none (for personal or bulky data).
Keep finished runsDays for this Sutra, instead of the engine setting.
Tuning of one deployed Sutra. Empty fields show what they mean when left empty.
Tuning of one deployed Sutra. Empty fields show what they mean when left empty.
Engines with their tuning for every engine, and Steps at once for one engine.
Engines with their tuning for every engine, and Steps at once for one engine.

Sutra tuning applies to every run of the deployed Sutra, whether its one starter is a REST or SOAP request, timer, file, mailbox, queue, MCP skill or channel, or it is invoked through the Run API. Test and debug runs from the designer are not tuned, and runs started by Call Sutra always start (they count toward the limit, but never wait behind their own caller). Sutra tuning stays when a new version is deployed. Tuned Sutras show tuned in Applications.

Applications: deployed projects and Sutras with their triggers, state and runs; Stop and Start per Sutra.
Applications: deployed projects and Sutras with their triggers, state and runs; Stop and Start per Sutra.

Alerts

The Overview shows open alerts, runs of the last day and gateway traffic as charts. Under Alerts:

  • Channels say where alerts go: email through any project's SMTP connection, a webhook (a JSON POST with event, text and alert; chat tools that read a text field show the message; optionally signed with X-Sutra-Signature from a vault secret), or a deployed Sutra that starts with the alert as its input, to open a ticket or call someone. Send a test tries a channel.
  • Alert rules say what to watch: failed runs (of one Sutra or any), slow runs, gateway error rate, gateway latency (p95), engines (one stopped beating, or fewer alive than needed), work waiting in the queue too long, approvals waiting too long, the gateway certificate ending soon, listeners in error. Each rule has a severity (warning or critical), channels, whether to tell when it resolves, and reminders every few minutes while nobody acknowledged it. Check now shows what the rule finds at this moment.
  • Alerts lists what is open, newest first, and the history. The cluster leader checks every rule every 30 seconds, so a cluster alerts once; one alert per rule stays open until its condition clears. Acknowledge says someone is on it and stops reminders; Resolve closes it by hand. Each alert shows what was sent where, and whether it arrived.
Alerts: an open critical alert with what was found, Acknowledge and Resolve; Details shows what was sent where.
Alerts: an open critical alert with what was found, Acknowledge and Resolve; Details shows what was sent where.
An alert rule: what to watch, its settings, severity, channels and reminders; Check now shows what it finds at this moment.
An alert rule: what to watch, its settings, severity, channels and reminders; Check now shows what it finds at this moment.
sutra alerts                 (open alerts; exit code 1 while a critical alert is firing)
sutra alerts ack <id>
sutra alerts test "Operations team"

Gateway: apps, keys, plans, firewall, traffic

  • Apps and keys: an app is a consumer of your APIs (a partner, a mobile app, a team) with scopes such as orders:read and a plan. Create keys for it; each is shown once. Callers send a key in X-API-Key, or exchange it for an access token at POST /oauth/token on the gateway (client credentials: the app id and a key). Disabling an app or revoking a key refuses its calls at once.
  • To protect a service with apps, give its API security policy the authentication apps and the Required scopes.
  • Plans: requests per minute, hour and day and a monthly quota. All engines count together; over a limit the caller gets 429 with Retry-After, and every answer carries X-RateLimit-Limit and X-RateLimit-Remaining.
  • Firewall: addresses or ranges the whole gateway allows or denies, and the Trusted proxies in front of SutraFlow whose forwarded caller address and HTTPS are believed (by the gateway and the studio).
  • Traffic: requests over time (answered, refused, errors), latency p50/p95/p99, the busiest and slowest services, apps, status codes, and the request log with every request's caller, time and error.
  • APIs: what is served, with its policy; OpenAPI for the REST services, and the options to publish it at /openapi.json and to keep the request log.
Apps and keys: a consumer of your APIs with its scopes, plan and keys.
Apps and keys: a consumer of your APIs with its scopes, plan and keys.
Traffic: requests over time split into answered, refused and errors, latency percentiles, busiest and slowest services, apps and status codes; the request log follows below.
Traffic: requests over time split into answered, refused and errors, latency percentiles, busiest and slowest services, apps and status codes; the request log follows below.
APIs: what the gateway serves with its policy, OpenAPI, and the gateway options.
APIs: what the gateway serves with its policy, OpenAPI, and the gateway options.
sutra gateway plan set Partner --per-minute 120 --per-day 50000
sutra gateway app add "Acme shop" --scopes "orders:read" --plan Partner
sutra gateway key create "Acme shop" --name production --expires-days 365
sutra gateway stats --period 24h

Users, system accounts and roles

  • Users are people. An administrator adds them with a first password (Generate makes a strong one); by default they choose their own at the first sign-in. Five wrong passwords lock an account for 15 minutes; Unlock ends it sooner. Disable ends the person's sessions at once and keeps everything; Sign out everywhere ends sessions and the person's own API tokens. People make their own API tokens in My profile; open a person to see them and Revoke one. Personal tokens: on/off switches them off for the whole server: people cannot make tokens and theirs stop working until it is switched on again.
  • System accounts are for engines, CI pipelines and API callers. They do not sign in to the designer. They get API tokens for the admin API, shown once and stored only as a hash, with an expiry and a Revoke button. A system account with a password can call gateway services whose API security policy accepts system accounts.
  • Roles are sets of permissions. A role is granted for all projects or for one project, and an account can hold several. Built-in roles: Administrator, Developer, Deployer, Operator, Approver, Viewer and API caller. New role combines permissions differently.
PermissionAllows
ViewSee the project, its Sutras, connections, runs and logs.
DesignEdit Sutras, schemas and project settings; test and debug runs.
ConnectionsAdd and change connections and API security policies.
DeployDeploy and undeploy Sutras, deploy packages, roll back, edit the deployment config.
OperateStart, stop, cancel and resubmit; clear runtime variable values.
ApproveDecide approvals.
Call servicesSystem accounts: call the project's gateway services with Basic sign-in.
Secrets, Engines, Gateway, Server settings, Users and roles, Audit, Alerts (channels, rules, acknowledging)Server permissions: they only come with a grant on all projects.
Users: people and their roles, with Unlock, Disable and Sign out everywhere.
Users: people and their roles, with Unlock, Disable and Sign out everywhere.
Roles: built-in and your own, each a set of permissions.
Roles: built-in and your own, each a set of permissions.
Always one administrator

Nobody can disable or delete their own account, and the last active administrator cannot lose the role.

Audit log

Every change, sign-in and refused request is recorded with who, when, from which address, what and the result, and with where it happened:

  • Where: the server (production, test or development, from SUTRA_ENVIRONMENT) and the engine, and whether it was a designer test run or a deployed Sutra.
  • Project and Sutra: name and id. The names are kept with the entry, so a renamed or deleted Sutra still reads as it was.

Filter by server, project, Sutra (choose the project first), person, result, words and dates; Export CSV saves what the filters show, with all these columns. Passwords, secret values and tokens are never recorded. Entries recorded before this version show no server.

Audit retention and clearing

The Retention card at the top of the Audit page shows how many entries there are, the oldest, and when the log was last cleared and by whom. With the Audit settings and clearing permission (Administrators have it):

  • Keep entries (days): housekeeping deletes older entries; 0 keeps everything. The default is SUTRA_AUDIT_RETENTION_DAYS (365).
  • Delete older entries now, Clear before a date, or Clear all, each after a confirmation.

Clearing is recorded as an entry of its own (who, what, how many), so the log always shows that it was cleared. From a shell: sutra audit retention 180, sutra audit clear --before 2026-01-01.

The audit log: who did what, where and with what result, with filters and Export CSV.
The audit log: who did what, where and with what result, with filters and Export CSV.

Server

Runtime: script activities (Python, PowerShell, programs) and release activities, off until an administrator allows them, and the interpreters found. AI command-line tools: AI providers that use the Claude, Gemini or Codex command-line tool and MCP client connections started by a command run a program on the server, so they run only when switched on here and only for the command lines listed (a tool name such as claude, or a whole MCP command such as npx -y @modelcontextprotocol/server-filesystem; never a bare npx or node, which would allow anything). AI tools run in an empty folder, refuse flags that let them act without asking, and get only the system path, home, temporary folder, locale and the environment variables listed here. Every server starts with the switch off after the upgrade to 2.1.8; command lines found in existing connections appear under Waiting for approval with where they were found, and none runs until an administrator approves it. Environment variables for projects: the names of server environment variables that projects may read with ${env:NAME}; the names projects use that are not allowed are listed with Allow. Variables whose names start with SUTRA_ belong to the server and are never given to projects. Gateway & TLS: the gateway's ports and certificate, your own or from Let's Encrypt. Database: the database in use and the move to PostgreSQL (Moving to PostgreSQL).

Server, Runtime: what scripts and releases may do on this server.
Server, Runtime: what scripts and releases may do on this server.

The first administrator of a headless engine

A headless engine has no first-start page, so nobody who reaches it can claim it. Add the first administrator on the server, then sign in at /admin:

sutra user add admin --role administrator --password-from-env ADMIN_PASSWORD
sutra user add ci-orders --system --role deployer --project "Orders"
sutra user list

22. Knowledge admin: server knowledge bases

A knowledge base (RAG) is designed in a project: its store, its vector model, its passages. Knowledge admin in the Admin Console (Server permission) turns one into a server knowledge base that other projects use without copying it, keeps parts of it in step with where the documents live, and offers it to outside assistants. The project it was made in is its home project and keeps full use.

Areas

An area is a folder of sources in the knowledge base: products holds products/P-101, hr holds hr/Leave policy.pdf. Grants, managed sources and the MCP tool each name an area; empty means the whole base. Steps keep working as before: a search with no filter searches every area the project may see.

Who may use it

SettingSearchAdd and remove
Not a server knowledge baseHome project onlyHome project only
Server, Every projectEvery project, the whole baseHome project, and projects granted May add and remove in their areas
Server, Granted projects onlyEach granted project, in its granted areasOnly in areas granted with May add and remove

Removing everything, rebuilding vectors and building the search index stay with the home project and administrators. The checks are made by the engine on every step, agent tool and API call, not by the designer: a Sutra that tries to change an area it was not granted fails with the reason. A granted knowledge base appears in the project's knowledge base lists marked with its home project and areas; its own connections (the pgvector database, the AI provider for vectors) are used through it and never offered to the project.

Managed sources

A managed source keeps one area in step with where the documents or records live. It runs on the leader engine only, on its schedule (minutes, or a cron expression with seconds first) or when you press Sync now, one source after another. Each sync lists the items, reads only the new and changed ones (a file whose size and time did not change is not even read; a row whose text did not change makes no vectors), and removes the items gone from the source. An item that cannot be read keeps its passages and is named in the sync history. A listing that comes back empty while the area holds items removes nothing: a missing folder or a lost connection must not empty a knowledge base.

ReadsSettingsItem
Files in a server folderFull path, file names (*.pdf), sub-folders, largest fileThe path in the folder
SFTP or FTP folderA connection of the home project, folder, file names, sub-foldersThe path in the folder
SharePoint or OneDriveA Microsoft OAuth connection, site, library, folder, file namesThe path in the library; its address kept for answers
Google Drive folderA Google OAuth connection, folder id, file names; Docs, Sheets and Slides read as textThe file name
Web pagesThe addresses, one per lineThe address
Database queryA database connection, the query, the key column, the text ({name}. {description}), the details keptThe key of the row
HTTP API (JSON)An HTTP connection or a full address, where the list is, the key field, the text, the detailsThe key of the element
Sutra of a projectThe project whose Sutras write the areaWhatever those Sutras add; nothing is synced here

Connections are those of the home project, with its properties and connection limits. History shows the last 50 syncs of a source: found, added, changed, unchanged, removed and failed, with notes. Re-index forgets what was read and reads every item again, after you changed the text or details of a source. Remove takes the source and the passages it added. The same is on the command line: sutra knowledge list, sutra knowledge sync "<base>" "<source>" [--reindex], sutra knowledge runs "<base>" "<source>".

One writer per area

Each area has one writer: an enabled managed source, a Sutra exported from one, or one project granted May add and remove. Knowledge admin refuses a second writer on the same area or on an area inside it, and says who writes it now. Two writers would undo each other's work: a sync removes what another writer added.

Export as Sutra

Database, folder and web page sources can be exported as a Sutra of ordinary steps (Timer, read, For each, Add to knowledge, Remove knowledge keeping only what is still there) in the home project, for a designer to change: another filter, more details, a step that cleans the text. The managed sync of the source stops at once, and the exported Sutra may change only its area, although it runs in the home project; the engine enforces it. Deploy it to run on its schedule. For SharePoint, Google Drive, SFTP and APIs, start from the knowledge feed samples and use a Sutra of a project source to give that project the area.

The MCP search tool

A server knowledge base can be a search tool on an MCP server connection of its home project, for Claude, ChatGPT, Copilot and other assistants: give the tool a name (search_policies), a description that tells the assistant when to use it, and an area. The MCP server must have a security policy: who passes it may search, and only that area. Assistants get the closest passages with their sources and write the answer themselves; no AI model is needed on the server.

Using a server knowledge base

From a granted project. The knowledge base appears in the project's knowledge base pickers as Company knowledge (server knowledge from HR project: products), with may change after an area granted May add and remove; it is not copied and is not in the project's explorer. Steps use it like their own:

StepGranted to searchGranted May add and remove
Search knowledge, Ask knowledge, an agent's knowledge toolFinds passages in the granted areas only; a source filter outside them fails and lists the granted areasThe same
Add to knowledge, Remove knowledgeFails: may search the knowledge base but not change itWorks when the source is in the area (products/P-101); outside it fails and names the area

The search runs with the home project's connections (vector store, AI provider), so a granted project needs no connection of its own. How to build the steps is in the user guide, Build RAG step by step.

From an assistant (MCP). With the tool on an MCP server connection at /mcp/knowledge and a policy that asks for an API key in X-API-Key, the gateway answers at https://<gateway>/mcp/knowledge. Check it with curl:

curl -X POST https://sutra.example.com/mcp/knowledge -H "content-type: application/json" -H "accept: application/json, text/event-stream" -H "X-API-Key: %KB_KEY%" -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/list\"}"
curl -X POST https://sutra.example.com/mcp/knowledge -H "content-type: application/json" -H "accept: application/json, text/event-stream" -H "X-API-Key: %KB_KEY%" -d "{\"jsonrpc\":\"2.0\",\"id\":2,\"method\":\"tools/call\",\"params\":{\"name\":\"search_products\",\"arguments\":{\"question\":\"warranty of P-101\",\"top\":5}}}"

The tool takes question and an optional top (1 to 20, 5 when not given) and returns passages, each with text, source, score and, when known, url and title. A wrong key gets 401. Claude Desktop (claude_desktop_config.json), through the mcp-remote bridge, with the key from an environment variable:

{ "mcpServers": { "company-knowledge": { "command": "npx",
  "args": ["-y", "mcp-remote", "https://sutra.example.com/mcp/knowledge", "--header", "X-API-Key:${KB_KEY}"],
  "env": { "KB_KEY": "the key from the policy" } } } }

More on MCP connections and assistants: user guide, AI tools on the gateway.

From the command line. sutra knowledge list shows each knowledge base with its home project, sharing, grants and sources; sutra knowledge sync "Company knowledge" "Products table" asks a sync; sutra knowledge runs "Company knowledge" "Products table" shows its last syncs (The command line by task).

Setting one up

  1. In the designer, make the knowledge base in the project that will own it (for example Company knowledge): a vector database such as PostgreSQL (pgvector) for anything large.
  2. Admin Console, Knowledge admin: Manage, turn on Server knowledge base, choose who may search it.
  3. Add a managed source per area (hr from the HR SharePoint library every hour, products from the product table every 30 minutes) and press Sync now once; read its history.
  4. Grant the projects that need it: the shop project products to search, the HR project hr to search.
  5. Optionally offer it as an MCP tool behind a policy.
Good practice

Grant areas, not the whole base: a project sees only what its callers may see.
Keep personal and confidential documents in their own knowledge base, not an area of a shared one.
After changing the vector model, Rebuild vectors in Knowledge admin; searches find little until it ends.

Security and connections

23. Secrets and studio security

Single sign-on (OpenID Connect or SAML 2.0)

People can sign in to the designer, Admin Console and Approval Center with an OpenID Connect or SAML 2.0 identity provider (Microsoft Entra ID, Okta, Keycloak, Google, Auth0 and compatible providers). Password sign-in stays available, so an administrator can always get in.

  1. Open Admin Console → Users → Single sign-on and choose OpenID Connect or SAML 2.0. Register the callback address shown there, such as https://sutra.example.com/api/auth/sso/callback. Behind a proxy, set SUTRA_PUBLIC_URL so it is the public address people use.
  2. For OpenID Connect, register a web application using the authorization-code flow, put its client secret in the vault, then enter the issuer, client id, secret name and claims. Ask the provider to include the person's groups in the ID token.
  3. For SAML, register SutraFlow as a service provider using the HTTP-POST response binding. Enter the identity-provider Redirect SSO address, the service-provider entity id/audience, the IdP issuer and its signing certificate. Choose the assertion attributes for username and groups, or use NameID as the username.
  4. Map groups to roles: sutra-admins to Administrator on all projects, shop-team to Operator on the Shop project. At every sign-in a person's roles become those of their groups.
  5. Choose Create accounts (people get an account at their first sign-in) and, only when the provider controls usernames, Link existing accounts.
  6. Turn on Offer single sign-on. The sign-in pages show Sign in with your provider.

OpenID Connect uses the authorization-code flow with PKCE, state and nonce; the ID token's signature, issuer, audience and expiry are checked against the provider's published keys. SAML responses must carry a trusted signature and a single assertion bound to the one-time sign-in request, callback address, entity id, issuer and validity period. The one-time state is stored briefly in the shared database, and a signed short-lived cookie proves that the same browser or API client started the sign-in. A browserless client follows the same two requests: retain the sutra_sso cookie from /api/auth/sso/start and send it with the callback. A person is recognised by the provider subject or SAML NameID, so a renamed account stays the same person. Sign-ins with either protocol are in the audit log.

The vault and sessions

24. Connections on production servers

A project deployed to another server brings its connections, but never their passwords, keys or tokens. Each server signs in on its own, so test and production can use different accounts, and a package can go to production without anyone copying a secret.

CredentialHow production gets it
Passwords, keys, client secrets, access tokensA connection takes them from a Secret project property ({{gv.NAME}}) or an engine Secret property ({{ev.NAME}}), whose value is the name of a stored secret. The package lists the names (README, Releases check); put the values in the production vault with sutra secret set NAME --from-env NAME from the pipeline's secret store, or Resources > Secrets. A missing secret stops the deploy before anything changes, and so does a stored secret named directly instead of through a Secret property (a project can read only the secrets behind its own and the engine's Secret properties).
Other settings (hosts, factory, workspace, folders)The deployment config of that environment; any value may read ${env:NAME}.
Azure identitiesBest: a managed identity on the production server (no secret). Else a service principal per environment, its secret in that server's vault.
OAuth accounts (Google, YouTube, Twitch, Dropbox, Facebook, Microsoft)One of: sutra connect (below); a refresh token secret on the connection; or Connect account in that server's studio. Tokens are encrypted with that server's master key and never leave it.

Setting up each provider's app (client ID, secret, redirect address, scopes) and signing in, step by step: OAuth connections step by step.

sutra connect

sutra connect "Sample Google (Drive and YouTube)" --project Media --server https://prod-engine:4800 --token $TOKEN

It prints the sign-in address for that server; open it in a browser, sign in to the account, and the command reports when the server has its tokens. The OAuth app must list that server's redirect address (shown by the command). Headless engines accept it too.

A refresh token secret

When no person may sign in on production, give the OAuth connection a Refresh token (secret): a refresh token of the account, kept as a secret on that server and set by the pipeline. The server signs in with it on first use. Get the refresh token once with the provider's tools (for Google, the OAuth Playground with your own client), store it in your secret manager, and rotate it like any other secret.

Certificates and private keys

Every connection and security policy that needs a certificate or a key (databases, Kafka, RabbitMQ, ActiveMQ, MongoDB, SFTP, outbound TLS and WS-Security, inbound JWT, X.509 and SAML) has one setting for each, and that setting can be any of:

GiveExampleGood for
A file on the serverC:\certs\aiven\ca.pem, \\server\certs\ca.pem, /etc/ssl/sutraflow/ca.pem, ~/certs/ca.pem, or relative to the data folderServers where certificates are files managed by the operating system or a tool. Renew by replacing the file.
A path with a variable{{ev.CERTS}}\ca.pem or {{ev.CERTS}}/ca.pemOne folder per server or environment, set once as an engine property.
A Certificate property{{gv.KAFKA_CA}}: a project or engine property of type certificate holding the PEM text or a file pathContainers and test servers: paste the certificate once; every connection that names it follows a change.
A Private key property{{gv.KAFKA_KEY}}: type private key, kept encrypted in the vault like a Secret, never shown againClient keys when no key file can be placed on the server.

Windows and Linux paths both work; on Linux and macOS a backslash is read as a folder separator too, so a deployment config written on Windows (certs\ca.pem) works unchanged. A key file must be readable only by the account SutraFlow runs as. A key passphrase is always a Secret property. Connections made before 2.1.1 keep the PEM text pasted into them. Passwords and other secrets are chosen from Secret properties only; their values are entered under Configuration, Project variables (engine properties by administrators in the Admin Console), never in the connection.

Good practice

Separate accounts per environment: a test YouTube channel, a test factory, a test workspace.
Least rights: only the scopes and roles the Sutras use.
Test connection after every deploy, from the Admin Console or the Releases check.

Releases on servers

25. Receiving releases on a server

Designers build releases (User Guide: Releases); administrators put them on test and production servers. A release moves a whole project unchanged: the same file goes from test to UAT to production, and each server keeps its own deployment config and its own secrets.

In a release zipHolds
package.sutraEvery Sutra at its version, connections and API policies with secret names only, schemas, project variables and logging, with a checksum
deployment-config.jsonWhat differs per server, to fill in: connection settings, project variables, logging; values may read ${env:NAME}
README.txt, documentation.htmlSutras and their addresses, the secrets the server needs, where it was built from, and the deploy and rollback commands
files/Documents and templates the project needs

Prepare the server

  1. Secrets: put every name the README lists in this server's vault: sutra secret set ORDERS_DB --from-env ORDERS_DB, or Admin Console. A missing secret stops the deploy before anything changes.
  2. Deployment config: hosts, folders and users of this server; keep one file per environment, with ${env:...} for values from the server's environment.
  3. Access: a system account with the Deploy permission on the project (Admin Console, System accounts) and an API token for the pipeline.

Deploy

Admin Console, Releases: deploy a release zip, and each project's packages with Roll back.
Admin Console, Releases: deploy a release zip, and each project's packages with Roll back.

Before anything changes the package is checked: checksum, activities this server knows, every secret present, and no REST or SOAP path or MCP skill already served by another project. Then everything is matched by name: the project (made when missing), schemas, connections, Sutras. Changed Sutras get a new version; unchanged ones are left alone, so deploying the same package twice changes nothing; Sutras of the project not in the package are undeployed (kept, not deleted) unless keep others. Every deployment is recorded with who deployed it, and a rollback is itself a deployment.

Production servers

A server with SUTRA_ENVIRONMENT=production refuses Deploy from the designer: it gets Sutras only from releases. sutra test release.zip runs every Sutra of a package with its test data in a throw-away server before it goes anywhere.

The first administrator of a headless engine

A headless engine has no first-start page, so nobody who reaches it can claim it. The installer makes the administrator; on an engine installed by hand, add one on the server, then sign in at /admin:

sutra user add admin --role administrator --password-from-env ADMIN_PASSWORD
sutra user add ci-orders --system --role deployer --project "Orders"
sutra token create ci-orders --name github --expires-days 90
Good practice

Promote the same zip from UAT to production; never rebuild it for production.
Give each environment its own system account and token, with Deploy on the project only.
Keep the zips: they are the record of what went live, and the way back.

26. Redeploying needs a person

A newer version of a Sutra is the point of a release, so a deployment may replace what is deployed, but never without someone seeing what is replaced and saying yes. Before anything changes, every deployment works out its plan:

Each Sutra isMeaningNeeds approval
newNot on this server yetNo
unchangedThe same content as the version deployed hereNo
deployed againThe same content as here, not deployed nowNo
replacesOn this server with other content: the version here is replacedYes
undeployedDeployed here and not in the release (unless keep others)Yes

A changed schema also needs approval. The plan ends with a plan id: a short hash of the release and of what is on this server now. If someone changes a Sutra on the server after the plan was read, its id changes.

Approving

Packages in SUTRA_DEPLOY_DIR, sutra test and rollbacks count as approved: the person who put the file there, or asked for the rollback, approved it. Every deployment records who approved it, and the plan id, in the audit log.

Connections and properties are never overwritten

A deployment creates the connections, project properties and logging settings that are missing. Those already on the server are kept exactly as they are and listed in the plan's checklist: name, type, where it points (host, address or file, without credentials) and which fields the release or config file has different values for. Values are never shown. --checklist checklist.md writes the checklist as Markdown for the team that verifies it.

Good practice

Read the checklist after every deploy to a new environment: a connection kept from before may point at the wrong host.
Approve in the pipeline, not by hand on the server: the approval is then recorded with the run.

27. Configuration as files

A server's settings and its projects' connections can be kept in Git as a config file (YAML or JSON) and put on any server with one command. This lets the team that runs servers set up test and production the same way, from a pipeline.

PartHolds
serverEngine properties, roles, system accounts (without tokens), connections shared by all projects, gateway options, firewall, trusted proxies, script and release policies, gateway plans and apps (without keys), alert channels and rules, server knowledge bases and their grants
projectsEach project's properties, logging and connections

People are never in a config file: they come from single sign-on or the Admin Console. Single sign-on and certificates are set on each server.

Commands

sutra config export --server-settings --project "Orders" --out config/sutraflow.yaml   # what is set now
sutra config check config/sutraflow.yaml --env config/env/prod.yaml                   # what would be created; changes nothing
sutra config apply config/sutraflow.yaml --env config/env/prod.yaml --checklist checklist.md

Environment files and secrets

Keep one config file for what every environment has, and a small environment file per environment (--env env/prod.yaml) for what differs: hosts, users, folders, secrets. The environment file is merged over the config file; lists are matched by name. A value can be:

Written asExampleRead
The valuevalue: s3cretAs it is; for a secret, config check warns unless --allow-plain-secrets
${env:NAME}value: ${env:ERP_DB_PASSWORD}From the environment where sutra config runs: the CI system's secret variables
file:/pathvalue: file:/run/secrets/erp-dbFor secret, private key and certificate properties: from a file, such as a Kubernetes or Docker secret
$${env:NAME}value: $${env:REGION}Kept as the reference ${env:NAME}, read on the server when Sutras run

Secret values go into the target server's vault, encrypted with its master key. Messages and checklists name secrets but never show their values, and config export writes secrets as ${env:SUTRA_<PROJECT>_<NAME>} placeholders. A missing environment variable or file stops check and apply before anything is sent.

# config/sutraflow.yaml
sutraflow: config
version: 1
server:
  gateway:
    trustedProxies: [10.0.0.0/8]
  systemAccounts:
    - name: ci-deployer
      roles: [{ role: Deployer, project: Orders }]
projects:
  - name: Orders
    properties:
      - { name: REGION, type: string, value: eu-1 }
      - { name: ERP_DB_PASS, type: secret, value: ${env:ERP_DB_PASSWORD} }
    connections:
      - name: ERP
        kind: database
        settings: { driver: postgres, host: erp-test.internal, database: erp, user: sutra, password: "{{gv.ERP_DB_PASS}}" }

# config/env/prod.yaml: only what differs
projects:
  - name: Orders
    properties: [{ name: REGION, value: eu-prod }]
    connections: [{ name: ERP, settings: { host: erp.internal } }]

sutra deploy release.zip --config prod.yaml --env env/prod.yaml also takes an environment file, merged over the release's deployment config.

28. CI/CD pipelines

deploy/ci has the same release pipeline for GitHub Actions, GitLab CI, Azure DevOps and Jenkins. Each one runs in the SutraFlow image, so sutra has the server's version.

  1. Build the release from the project's Git repository: sutra package --from-git . --version 1.4.0 --out release.zip.
  2. Test it in a throw-away server: sutra test release.zip --secrets-from-env.
  3. Check against the target: sutra config check (what would be created, and the checklist) and sutra check (the plan and its id). Nothing changes.
  4. Approve: a person reads the plan and the checklist. GitHub uses environment reviewers, GitLab a manual job, Azure DevOps environment approvals, and Jenkins an input step that asks for the plan id.
  5. Deploy: sutra config apply --yes (creates what is missing), then sutra deploy release.zip --approve <plan id>.

The pipeline signs in with a system account's token (sutra token create), kept in the CI system's secret store with the environment's secrets. The account needs Deploy on the projects, plus Users or Server settings only if the config file sets those. Set SUTRA_CI_USER to the person who started the pipeline so the audit log names them.

Good practice

One config file for every environment, one small environment file each; all in Git, secrets in the CI secret store.
Promote the same release zip from test to production; never rebuild it for production.

The admin API

29. The admin API: addresses, signing in and conventions

Everything the designer, the Admin Console and the sutra command do goes through one HTTP API on the admin port (4800 by default; 4801 for an engine beside the studio). This part of the guide lists all 271 endpoints: what each does, who may call it, whether headless engines serve it, and the sutra command that calls it. The tables are made from the server's own route and permission tables, so they match the version you run.

This is the API for running SutraFlow. The APIs your Sutras offer to callers (REST, SOAP, MCP, agents) are on the gateway ports and are described by the gateway's OpenAPI document (GET /api/gateway/openapi) and the SutraFlow Design Guide.

Addresses

WhereBase address
Studio on this machinehttp://127.0.0.1:4800
An engine beside the studiohttp://127.0.0.1:4801
A clusterAny engine's admin port, or the internal load balancer in front of them (One Admin Console for the whole cluster): every engine answers for the whole cluster
Docker or KubernetesThe container's port 4800; from inside a container, sutra finds it by itself

Keep the admin port on a private network or behind a VPN. Callers of your APIs never need it.

Signing in

CallerHowMay
Admin tokenAuthorization: Bearer <SUTRA_ADMIN_TOKEN>Everything. For the launcher and bootstrapping; give pipelines a system account instead.
System account tokenAuthorization: Bearer <token> from sutra token create <account> (or Admin Console, System accounts)What the account's roles allow. Tokens can expire and are revoked at once.
A personPOST /api/auth/login (or single sign-on) sets the sutra_session cookie, valid 12 hours on every engine of the clusterWhat their roles allow. Changing requests also need the header X-Sutra: 1.

Who may call what

Each endpoint needs one permission, on a project or for the server. Roles are sets of permissions given to a person or system account on one project or on all projects. "Signed in" means any caller; the answer then holds only the projects the caller may see.

PermissionNameGivenAllows
viewViewPer projectSee the project, its Sutras, connections, runs and logs.
designDesignPer projectEdit Sutras, schemas and project settings; test and debug runs.
connectionsConnectionsPer projectAdd and change connections and API security policies.
deployDeployPer projectDeploy and undeploy Sutras, deploy packages, roll back, edit the deployment config.
operateOperatePer projectStart, cancel and resubmit runs; clear runtime variable values.
approveApprovePer projectDecide approvals of running Sutras.
callCall servicesPer projectSystem accounts: call the project's gateway services with Basic sign-in.
secretsSecretsServerStore and delete vault secrets.
enginesEnginesServerDrain engines, run housekeeping, change tuning.
gatewayGatewayServerGateway apps, keys, plans, firewall, request log and traffic.
serverServer settingsServerGateway ports and certificates, Engine properties, scripts and release policies, model installs.
usersUsers and rolesServerProvision users and system accounts, roles and access.
auditAuditServerRead and export the audit log.
auditManageAudit settings and clearingServerChange how long the audit log is kept and clear it; clear project logs on production servers.
alertsAlertsServerAlert rules and channels.

Requests and answers

StatusMeaning
200, 202Done (202: started, such as a drain)
400The request is wrong: {"error": "..."} says why
401Not signed in, wrong token, or wrong password
403Signed in but not allowed (the error names the permission), the X-Sutra header missing, or a password to change first
404Not found, or not served by a headless engine
409In conflict with the server's state. A deployment that would replace or undeploy Sutras without approval answers 409 with plan: deploy again with approve set to plan.planId
423, 429Account locked after wrong passwords; too many sign-in attempts from one address
503/ready only: not ready, with the reasons

Examples

# bash: the cluster's engines, with a system account's token
curl -s -H "Authorization: Bearer $SUTRA_TOKEN" https://sutra-admin.internal/api/engine/status

# bash: check a release and deploy it with the approved plan id
ZIP=$(base64 -w0 orders-1.4.0.zip)
curl -s -X POST -H "Authorization: Bearer $SUTRA_TOKEN" -H "content-type: application/json" \
  -d "{\"zip\":\"$ZIP\"}" https://sutra-admin.internal/api/packages/open        # .plan.planId
curl -s -X POST -H "Authorization: Bearer $SUTRA_TOKEN" -H "content-type: application/json" \
  -d "{\"zip\":\"$ZIP\",\"approve\":\"<plan id>\"}" https://sutra-admin.internal/api/packages/deploy
# PowerShell
$h = @{ Authorization = "Bearer $env:SUTRA_TOKEN" }
Invoke-RestMethod -Headers $h https://sutra-admin.internal/api/engine/status
Invoke-RestMethod -Headers $h "https://sutra-admin.internal/api/runs?status=failed&limit=20"

The sutra command is this API

With --server (or SUTRA_SERVER) and a token, every sutra command is one or more of these calls; it resolves names to ids, reads files and environment variables on your side (config files, release zips) and prints the answers. Anything the command does, a script can do with the endpoint beside it:

sutra commandEndpoint
sutra user listGET /api/access/users
sutra user add <name> --role <role> [--project <name>] [--system]POST /api/access/users
sutra user disable | enable <name>PUT /api/access/users/:name
sutra user delete <name>DELETE /api/access/users/:name
sutra user password <name> --password-from-env <VAR>POST /api/access/users/:name/password
sutra user unlock <name>POST /api/access/users/:name/unlock
sutra user sign-out <name>POST /api/access/users/:name/sign-out
sutra token list <account>GET /api/access/users/:name/tokens
sutra token create <account> [--expires-days n]POST /api/access/users/:name/tokens
sutra token revoke <account> <id>DELETE /api/access/users/:name/tokens/:id
sutra audit [--actor name] [--outcome ...] [--from date]GET /api/audit
sutra audit --csvGET /api/audit/export
sutra audit retentionGET /api/audit/policy
sutra audit retention <days>PUT /api/audit/policy
sutra audit clear --before <date> | --older | --allPOST /api/audit/clear
sutra history --project <name> (and others, to find the project)GET /api/projects
sutra doc --project <name>GET /api/projects/:id/documentation
sutra doc --project <name> --sutra <name>GET /api/flows/:id/documentation
sutra package --project <name> [--version 1.4.0]GET /api/projects/:id/package
sutra package --project <name> --zipGET /api/projects/:id/release
sutra check <release.zip>POST /api/packages/check
sutra deploy <release.zip> [--approve <plan id>]POST /api/packages/deploy
sutra test <release.zip>POST /api/packages/test
sutra history --project <name>GET /api/projects/:id/packages
sutra rollback --project <name> [--to <id>]POST /api/projects/:id/rollback
sutra config export [--server-settings] [--project "A,B"]POST /api/config/export
sutra config check <file> [--env file]POST /api/config/check
sutra config apply <file> [--env file] [--yes]POST /api/config/apply
sutra doc, sutra sutras (to find a Sutra by name)GET /api/flows
sutra sutras deploy <sutra> --project <name> --version <n>POST /api/flows/:id/deploy
sutra connect (to find the connection)GET /api/resources
sutra connect <connection> --project <name>GET /api/oauth/:id
sutra connect <connection> --project <name>GET /api/oauth/:id/start
sutra secret set <NAME> --from-env <VAR>PUT /api/secrets/:name
sutra runs list [--sutra <name> --project <name>] [--status failed]GET /api/runs
sutra runs show <run id>GET /api/runs/:id
sutra runs resubmit <run id>POST /api/runs/:id/resubmit
sutra runs cancel <run id>POST /api/runs/:id/cancel
sutra approvals listGET /api/approvals
sutra approvals approve | reject <id> [--comment text]POST /api/approvals/:id
sutra status, sutra engines listGET /api/engine/status
sutra engines housekeepingPOST /api/engine/housekeeping
sutra engines machineGET /api/console/machine
sutra engines name <engine id> <name>PUT /api/console/engines/:id/name
sutra engines lead <engine> --yes|--noPUT /api/console/engines/:id/lead
sutra engines cluster-name <name>PUT /api/console/cluster/name
sutra engines drain <engine>POST /api/console/engines/:id/drain
sutra engines restart <engine>POST /api/console/engines/:id/restart
sutra engines tune (reads it first)GET /api/console/tuning
sutra engines tune [--workers n] ...PUT /api/console/tuning/engine
sutra engines tune --engine <id> ...PUT /api/console/tuning/engines/:id
sutra secret checkGET /api/console/secret-scope
sutra sutras list [--project <name>]GET /api/console/apps
sutra sutras start | stop <sutra> --project <name>PUT /api/console/sutras/:id/enabled
sutra sutras restart <sutra> --project <name>POST /api/console/sutras/:id/restart
sutra sutras tune <sutra> --project <name> [--max-runs n] ...PUT /api/console/sutras/:id/tuning
sutra agents conversationsGET /api/console/conversations
sutra agents clear-expired [--agent <name>]POST /api/console/conversations/clear-expired
sutra memory list [--project <name>]GET /api/console/memory
sutra memory reload <table> --project <name>POST /api/console/memory/:id/reload
sutra memory clear <table> --project <name>POST /api/console/memory/:id/clear
sutra memory rows <table> --project <name>GET /api/console/memory/:id/rows
sutra memory set <table> --project <name> --row <json>PUT /api/console/memory/:id/rows
sutra memory remove <table> --project <name> --key <key>DELETE /api/console/memory/:id/rows/:key
sutra knowledge listGET /api/console/knowledge
sutra knowledge sync <knowledge base> <source> [--reindex]POST /api/console/knowledge/:id/sources/:sid/sync
sutra knowledge runs <knowledge base> <source>GET /api/console/knowledge/:id/sources/:sid/runs
sutra gateway appsGET /api/gateway/apps
sutra gateway app add <name> [--scopes ...] [--plan <name>]POST /api/gateway/apps
sutra gateway app disable | enable <name>PUT /api/gateway/apps/:id
sutra gateway app delete <name>DELETE /api/gateway/apps/:id
sutra gateway key create <app> [--expires-days n]POST /api/gateway/apps/:id/keys
sutra gateway key revoke <app> <key id>DELETE /api/gateway/apps/:id/keys/:keyId
sutra gateway plansGET /api/gateway/plans
sutra gateway plan set <name> --per-minute n ...POST /api/gateway/plans
sutra gateway plan set <name> ...PUT /api/gateway/plans/:id
sutra gateway plan delete <name>DELETE /api/gateway/plans/:id
sutra gateway firewallGET /api/gateway/firewall
sutra gateway firewall --allow ... --deny ...PUT /api/gateway/firewall
sutra gateway proxiesGET /api/gateway/proxies
sutra gateway proxies --trusted ...PUT /api/gateway/proxies
sutra gateway stats [--period 24h]GET /api/gateway/stats
sutra gateway log [--status errors]GET /api/gateway/requests
sutra gateway openapiGET /api/gateway/openapi
sutra alerts [list | history]GET /api/alerts
sutra alerts checkPOST /api/alerts/check
sutra alerts ack <id>POST /api/alerts/:id/acknowledge
sutra alerts resolve <id>POST /api/alerts/:id/resolve
sutra alerts rulesGET /api/alerts/rules
sutra alerts channelsGET /api/alerts/channels
sutra alerts test <channel>POST /api/alerts/channels/:id/test
sutra db infoGET /api/server/database
sutra pythonGET /api/scripts/python
sutra python --set <path> | --clearPUT /api/scripts/python

The admin port's other endpoints

EndpointWhat it does
GET /healthAlive: version, mode, environment, engine name, database kind. No sign-in. For liveness checks.
GET /readyReady for work: 200, or 503 with the reasons (database unreachable, packages still deploying, draining, gateway not listening). No sign-in. For load balancers and readiness checks.
GET /metricsPrometheus metrics of this engine. Needs Authorization: Bearer <SUTRA_METRICS_TOKEN> when that is set.

30. Admin API: signing in, people and system accounts

Sign-in for people, single sign-on, and the accounts, roles and API tokens of the server. Creating a system account and a token for it is how a pipeline or script gets access.

34 endpoints. Permissions, conventions and examples: The admin API.

EndpointWhat it doesWho may call itsutra command
GET /api/auth/statusWhether the server still needs its first administrator (setup), who is signed in with this cookie, the version, mode, environment and the single sign-on button name. Open: no sign-in needed.Open
POST /api/auth/setupCreates the first administrator on a fresh studio and signs them in. Body: {username, password}. 409 once set up; 403 on a headless engine, where the first administrator comes from sutra user add. Open.Open
POST /api/auth/loginSigns a person in and sets the session cookie (12 hours). Body: {username, password}; answers {ok, mustChange}. 401 wrong name or password, 423 locked after repeated failures, 429 too many attempts from one address, 403 for system accounts (they use tokens). Open.Open
POST /api/auth/logoutEnds this session: clears the cookie. Open.Open
POST /api/auth/passwordChanges the signed-in person's own password. Body: {current, password}. The only call allowed while a password set by an administrator must be changed.Signed in
GET /api/auth/sso/startStarts single sign-on (OpenID Connect or SAML): redirects to the identity provider. Query: return (page to come back to). Open.Open
GET /api/auth/sso/callbackWhere the identity provider returns after OpenID Connect sign-in; signs the person in. Open.Open
POST /api/auth/sso/callbackWhere the identity provider posts a SAML response; signs the person in. Open.Open
GET /api/oauth/callbackWhere an OAuth provider returns after a person authorised a connection (Connect); stores the tokens in the vault. Open.Open
GET /api/access/meThe caller: name, kind (person, system account, admin token), roles and permissions per project.Signed in
GET /api/access/me/tokensThe own API tokens of the signed-in person (names, created, expiry, last use, expired; never the token), whether personal tokens are switched on, and the expiry choices (30, 60, 90 days).Signed in
POST /api/access/me/tokensCreates a personal API token that acts as the signed-in person, with their roles. Body: {name, expiresDays: 30|60|90}. Only from a studio session (a token cannot make tokens); at most 20. The token is in the answer once and never again.Signed in
POST /api/access/me/tokens/:id/renewReplaces an own token (expired or not) with a new value, the same name and period. Only from a studio session.Signed in
DELETE /api/access/me/tokens/:idRevokes one of your own tokens at once.Signed in
GET /api/access/personal-tokensWhether people may create and use their own API tokens.Users and roles
PUT /api/access/personal-tokensSwitches personal API tokens on or off. Body: {allowed}. Off: people cannot create tokens and theirs stop working until switched on; system accounts are not affected.Users and roles
GET /api/access/permissionsEvery permission with its scope (project or server) and meaning.Signed in
GET /api/access/rolesRoles: built-in and your own, with their permissions.Users and roles
POST /api/access/rolesCreates a role. Body: {name, description, perms: [...]}.Users and roles
PUT /api/access/roles/:idChanges a role of your own (built-in roles cannot change).Users and roles
DELETE /api/access/roles/:idDeletes a role of your own that nobody holds.Users and roles
GET /api/access/ssoSingle sign-on settings (no secrets) and the redirect address to register with the identity provider.Users and roles
PUT /api/access/ssoSaves single sign-on settings: protocol, issuer or metadata, client, claim and group-to-role mapping.Users and roles
GET /api/access/usersPeople and system accounts with their roles. Query: kind=user|system.Users and rolessutra user list
POST /api/access/usersAdds a person or a system account. Body: {username, kind: "user"|"system", password, displayName, email, mustChange, grants: [{role, project}]} (project "" = all projects).Users and rolessutra user add <name> --role <role> [--project <name>] [--system]
GET /api/access/users/:nameOne account with its roles.Users and roles
PUT /api/access/users/:nameChanges an account: display name, email, roles, disabled.Users and rolessutra user disable | enable <name>
DELETE /api/access/users/:nameDeletes an account (not your own).Users and rolessutra user delete <name>
POST /api/access/users/:name/passwordSets a person's password. Body: {password, mustChange} (default: they choose a new one at the next sign-in).Users and rolessutra user password <name> --password-from-env <VAR>
POST /api/access/users/:name/unlockClears the lock after repeated wrong passwords.Users and rolessutra user unlock <name>
POST /api/access/users/:name/sign-outEnds every session of the account.Users and rolessutra user sign-out <name>
GET /api/access/users/:name/tokensAPI tokens of an account (own tokens of a person can be listed and revoked here, not created) (names, created, expiry, last use; never the token).Users and rolessutra token list <account>
POST /api/access/users/:name/tokensCreates an API token for a system account. Body: {name, expiresDays}. The token is in the answer once and never again.Users and rolessutra token create <account> [--expires-days n]
DELETE /api/access/users/:name/tokens/:idRevokes a token at once.Users and rolessutra token revoke <account> <id>

31. Admin API: releases, packages and config files

Everything a release pipeline uses: build a package, check it and see its plan, deploy it with an approval, roll back, and apply config files. These are what sutra package, check, deploy, rollback and config call.

15 endpoints. Permissions, conventions and examples: The admin API.

EndpointWhat it doesWho may call itsutra command
GET /api/projects/:id/packageBuilds a package (.sutra) of the project: every deployed Sutra at its deployed version. Query: version, note, sutras (names, comma separated). Studio only.View on the projectsutra package --project <name> [--version 1.4.0]
GET /api/projects/:id/releaseThe same as a release zip: the package, a deployment config to fill in, and a README. Studio only.View on the projectsutra package --project <name> --zip
POST /api/packages/openOpens a release zip ({zip: base64}) or package ({package}): its contents, its check against this server and the deployment plan, without changing anything. What the Releases page shows after an upload.Deploy on a project
POST /api/packages/checkChecks a package against this server: missing activities and secrets, addresses in use, and the plan (new, unchanged, replaced, undeployed) with its plan id. Body: {package, project, ops, keepOthers}. Changes nothing.Deploy on the package's project (a new project: on all projects)sutra check <release.zip>
POST /api/packages/deployDeploys a package or release zip. Body: {package} or {zip: base64}, with project, ops, keepOthers, approve (the plan id). Replacing or undeploying Sutras without the matching approve answers 409 with the plan; nothing changes.Deploy on the package's project (a new project: on all projects)sutra deploy <release.zip> [--approve <plan id>]
POST /api/packages/testInstalls a package in a throw-away server and runs every Sutra with its test data. Body: {package, skip}.Deploy on the package's project (a new project: on all projects)sutra test <release.zip>
GET /api/projects/:id/packagesThe project's deployment history: package, version, who, when, plan.View on the projectsutra history --project <name>
POST /api/projects/:id/rollbackDeploys the previous package again (or {to: <deployment id>}).Deploy on the projectsutra rollback --project <name> [--to <id>]
POST /api/projects/importA new project from chosen Sutras of a package. Body: {package | zip, project, sutras, asDrafts}; deploying while importing needs Deploy on all projects. Studio only.Design on all projects
POST /api/projects/:id/copyA new project from chosen Sutras of this one, as drafts. Body: {project, sutras}. Studio only.Design on all projects
GET /api/releases/policyWhether designers may build releases on this server. Studio only.Signed in
PUT /api/releases/policyAllows or stops building releases. Body: {allowed}. Studio only.Server settings
POST /api/config/exportWhat is set now, as a config file document. Body: {server, projects: [names], allProjects}. Secrets come out as ${env:...} placeholders; people never.Signed insutra config export [--server-settings] [--project "A,B"]
POST /api/config/checkRuns a config document as an apply would and undoes it: what would be created, the checklist of what already exists, errors. Body: {config} (values already resolved by the sutra command). Changes nothing.Signed insutra config check <file> [--env file]
POST /api/config/applyCreates what the config document has and the server lacks, all or nothing; existing items are kept and listed in the checklist. Body: {config}.Signed insutra config apply <file> [--env file] [--yes]

32. Admin API: engines and the cluster

The cluster's engines, their leader and tuning, draining and restarting. Any engine answers for the whole cluster.

12 endpoints. Permissions, conventions and examples: The admin API.

EndpointWhat it doesWho may call itsutra command
GET /api/engine/statusThe cluster: every engine (alive, leader, workers, steps running, version), the queue by status, this engine's readiness and health.Signed insutra status, sutra engines list
POST /api/engine/drainStops this engine gracefully: not ready, hands leadership over, finishes or hands back running steps, then exits. Answers 202. Body: {exit: false} to stay up.Engines
POST /api/engine/housekeepingDeletes finished runs and audit entries past their retention now (the leader does it every minute). Body: {retentionDays}.Enginessutra engines housekeeping
GET /api/console/machineThis engine's machine: cores, memory, Node memory, database, pool, runs in memory.Enginessutra engines machine
PUT /api/console/engines/:id/nameThe name people see for an engine (its id stays). Body: {name}.Enginessutra engines name <engine id> <name>
PUT /api/console/engines/:id/leadWhether an engine may lead. Body: {mayLead}.Enginessutra engines lead <engine> --yes|--no
PUT /api/console/cluster/nameThe cluster's name. Body: {name}.Enginessutra engines cluster-name <name>
POST /api/console/engines/:id/drainAsks an engine (any in the cluster) to drain and stop on its next heartbeat.Enginessutra engines drain <engine>
POST /api/console/engines/:id/restartAsks an engine to drain and start again (its launcher or orchestrator restarts it).Enginessutra engines restart <engine>
GET /api/console/tuningEngine tuning for the cluster and per engine (steps at once, reply timeout, retention, tracing), with the fields and their limits.Signed insutra engines tune (reads it first)
PUT /api/console/tuning/engineTuning for every engine. Body: {values}.Enginessutra engines tune [--workers n] ...
PUT /api/console/tuning/engines/:idTuning for one engine, over the cluster's. Body: {values}.Enginessutra engines tune --engine <id> ...

33. Admin API: deployed Sutras, runs and approvals

What the Admin Console's Applications, Traceability and Approvals pages use: deployed Sutras and their tuning, runs, approvals, memory tables, knowledge admin and agent conversations.

46 endpoints. Permissions, conventions and examples: The admin API.

EndpointWhat it doesWho may call itsutra command
GET /api/runsRuns, newest first, of the projects the caller may see, each with its stage (design or runtime) and client. Query: flowId, status, stage (design or runtime; all when absent), limit (at most 500).Signed insutra runs list [--sutra <name> --project <name>] [--status failed]
GET /api/runs/:idOne run with every step, its input, output and error.View on the run's projectsutra runs show <run id>
POST /api/runs/:id/resubmitRuns a failed run again from the step that failed, with the same input; earlier steps' results are kept.Operate on the run's projectsutra runs resubmit <run id>
POST /api/runs/:id/cancelCancels a running or waiting run.Operate on the run's projectsutra runs cancel <run id>
POST /api/runs/:id/debugControls a debug run. Body: {action: "step"|"continue"|"pause"|"breakpoints", breakpoints}.Design on the run's project
GET /api/eventsServer-sent events: run status changes as they happen (text/event-stream). Only runs the person may see when the event is sent: View on the project, Design for test and debug runs. Studio only.Signed in
GET /api/approvalsApprovals the caller may decide (or mine=1: assigned to them).Signed insutra approvals list
GET /api/approvals/historyDecided approvals. Query: days (at most 365).Signed in
POST /api/approvals/:idDecides an approval. Body: {approved, comment, onBehalf}.Signed insutra approvals approve | reject <id> [--comment text]
POST /api/approvals/:id/reassignGives an approval to other people or roles. Body: {approvers, roles, dueHours}.Operate on the approval's project
GET /api/console/overviewThe Admin Console overview: engines, deployed Sutras, runs of the last day, approvals, queue, gateway, recent failures.Signed in
GET /api/console/secret-scopeUpgrade check (2.1.8): connections, Sutra drafts and deployed Sutras that name a stored secret their project can no longer read, because it is not behind a Secret property of the project or the engine. Names only.Secretssutra secret check
GET /api/console/appsProjects and their deployed Sutras with state and runs of the last 24 hours.Signed insutra sutras list [--project <name>]
PUT /api/console/sutras/:id/enabledStarts or stops a deployed Sutra's triggers. Body: {enabled}.Operate on the Sutra's projectsutra sutras start | stop <sutra> --project <name>
POST /api/console/sutras/:id/restartStops and starts a deployed Sutra's triggers.Operate on the Sutra's projectsutra sutras restart <sutra> --project <name>
GET /api/console/sutras/:id/tuningA deployed Sutra's tuning: runs at once, priority, time limit, retries, step data kept, retention.View on the Sutra's project
PUT /api/console/sutras/:id/tuningSaves a deployed Sutra's tuning. Body: {values}.Operate on the Sutra's projectsutra sutras tune <sutra> --project <name> [--max-runs n] ...
GET /api/console/traceTraceability: projects and their Sutras by run outcome. Query: hours.View on a project
GET /api/console/trace/runsRun search. Query: projectId, flowId, status, hours, q, before, limit.View on ?projectId (any project when absent)
GET /api/console/trace/runs/:idOne run with who started it and the runs it called or was called by.View on the run's project
GET /api/console/trace/payloads/:idA large value a run stored once, as a JSON file.View on a project
GET /api/console/connectionsCapped connections now (in use, by whom, waiting) and their history. Query: hours (at most 168).View on a project
GET /api/console/conversationsAI agent conversations: active and expired per agent.View on a projectsutra agents conversations
POST /api/console/conversations/clear-expiredDeletes expired conversations. Body: {agent} (all agents when absent).Server settingssutra agents clear-expired [--agent <name>]
GET /api/console/memoryMemory tables with their figures on this engine. Query: project, find, keep.View on a projectsutra memory list [--project <name>]
GET /api/console/memory-quotasMemory limits for memory tables, and their use.Server settings
PUT /api/console/memory-quotasSaves the memory limits.Server settings
PUT /api/console/memory/:id/configTunes a deployed memory table: key, source, load and lookup SQL, refresh, time to live, size limits.Server settings
POST /api/console/memory/:id/reloadLoads a table again now on this engine; the others within their sync time.Deploy on the connection's projectsutra memory reload <table> --project <name>
POST /api/console/memory/:id/clearEmpties a table.Deploy on the connection's projectsutra memory clear <table> --project <name>
GET /api/console/memory/:id/rowsRows of a table. Query: find, field, value, offset, limit.View on the connection's projectsutra memory rows <table> --project <name>
PUT /api/console/memory/:id/rowsSets one row by hand. Body: {row, key}.Deploy on the connection's projectsutra memory set <table> --project <name> --row <json>
DELETE /api/console/memory/:id/rows/:keyRemoves one row.Deploy on the connection's projectsutra memory remove <table> --project <name> --key <key>
GET /api/console/knowledgeServer knowledge bases with their sources, grants and sync state.Server settingssutra knowledge list
GET /api/console/knowledge/:id/figuresA knowledge base's figures: passages, sources, size, searches.Server settings
GET /api/console/knowledge/:id/connectionsConnections a knowledge base's sources may read from.Server settings
PUT /api/console/knowledge/:idKnowledge admin settings of a knowledge base.Server settings
POST /api/console/knowledge/:id/rebuildBuilds the knowledge base's vectors again.Server settings
PUT /api/console/knowledge/:id/grantsGrants a project search (and optionally write) in an area of the knowledge base.Server settings
POST /api/console/knowledge/:id/grants/removeRemoves a project's grant. Body: {projectId, area}.Server settings
POST /api/console/knowledge/:id/sourcesAdds a managed source (folder, site, database, drive) to a knowledge base.Server settings
PUT /api/console/knowledge/:id/sources/:sidChanges a managed source.Server settings
DELETE /api/console/knowledge/:id/sources/:sidRemoves a source. Query: passages=remove also removes what it added.Server settings
POST /api/console/knowledge/:id/sources/:sid/syncSyncs a source now. Body: {reindex}.Server settingssutra knowledge sync <knowledge base> <source> [--reindex]
GET /api/console/knowledge/:id/sources/:sid/runsThe last syncs of a source.Server settingssutra knowledge runs <knowledge base> <source>
POST /api/console/knowledge/:id/sources/:sid/exportExports a managed source as a Sutra its project can change.Server settings

34. Admin API: gateway, alerts and audit

API consumers (apps, keys, plans), the firewall and trusted proxies, traffic and the request log; alert rules and channels; the audit log.

42 endpoints. Permissions, conventions and examples: The admin API.

EndpointWhat it doesWho may call itsutra command
GET /api/auditThe audit log: who did what, from where, with which outcome. Query: actor, action, outcome=ok|failed|denied, projectId, sutraId, environment, from, to, q (text), before, limit.Auditsutra audit [--actor name] [--outcome ...] [--from date]
GET /api/audit/exportThe same as CSV, with the same filters.Auditsutra audit --csv
GET /api/audit/policyHow long the audit log is kept, and its size.Auditsutra audit retention
PUT /api/audit/policyDays to keep the audit log. Body: {retentionDays} (0 keeps everything, at most 3650).Audit settings and clearingsutra audit retention <days>
POST /api/audit/clearDeletes audit entries. Body: {before: "2026-10-01"}, {olderThanRetention: true} or {all: true}. The clearing itself is recorded.Audit settings and clearingsutra audit clear --before <date> | --older | --all
GET /api/gateway/appsGateway apps (API consumers) with their plan, scopes and usage.Gatewaysutra gateway apps
POST /api/gateway/appsAdds an app. Body: {name, scopes, planId, contact}.Gatewaysutra gateway app add <name> [--scopes ...] [--plan <name>]
PUT /api/gateway/apps/:idChanges an app, or disables it (disabled).Gatewaysutra gateway app disable | enable <name>
DELETE /api/gateway/apps/:idDeletes an app and its keys.Gatewaysutra gateway app delete <name>
GET /api/gateway/apps/:id/keysAn app's API keys (never the key).Gateway
POST /api/gateway/apps/:id/keysCreates an API key. Body: {name, expiresDays}. The key is in the answer once.Gatewaysutra gateway key create <app> [--expires-days n]
DELETE /api/gateway/apps/:id/keys/:keyIdRevokes an API key at once.Gatewaysutra gateway key revoke <app> <key id>
GET /api/gateway/plansRate plans: calls per minute, hour, day and month.Gatewaysutra gateway plans
POST /api/gateway/plansAdds a rate plan. Body: {name, perMinute, perHour, perDay, perMonth}.Gatewaysutra gateway plan set <name> --per-minute n ...
PUT /api/gateway/plans/:idChanges a plan.Gatewaysutra gateway plan set <name> ...
DELETE /api/gateway/plans/:idDeletes a plan no app uses.Gatewaysutra gateway plan delete <name>
GET /api/gateway/firewallThe gateway firewall: allowed and denied addresses.Gatewaysutra gateway firewall
PUT /api/gateway/firewallSaves the firewall. Body: {allow, deny}. Every engine applies it.Gatewaysutra gateway firewall --allow ... --deny ...
GET /api/gateway/proxiesTrusted proxies, whose X-Forwarded-For and X-Forwarded-Proto are read.Gatewaysutra gateway proxies
PUT /api/gateway/proxiesSaves the trusted proxies. Body: {trusted}.Gatewaysutra gateway proxies --trusted ...
GET /api/gateway/optionsGateway options: whether calls are written to the request log and for how many days, and whether the OpenAPI document is published.Gateway
PUT /api/gateway/optionsSaves the gateway options. Body: {logRequests, logDays, publishOpenApi}.Gateway
GET /api/gateway/statsTraffic: calls, errors and response times per API. Query: period=1h|24h|7d|30d.Gatewaysutra gateway stats [--period 24h]
GET /api/gateway/requestsThe request log. Query: route, appId, status=errors|refused|ok, q, before, limit.Gatewaysutra gateway log [--status errors]
GET /api/gateway/apisDeployed APIs on the gateway with their addresses and policies.Gateway
GET /api/gateway/openapiAn OpenAPI document of the deployed REST services the caller may see, for API consumers.Gatewaysutra gateway openapi
GET /api/alertsAlerts, firing first. Query: state=open (not resolved), or a state (firing, acknowledged, resolved), none for all; limit (at most 500).View on a projectsutra alerts [list | history]
GET /api/alerts/summaryOpen alerts by severity, for the console header.Signed in
POST /api/alerts/checkEvaluates every rule now (the leader does it every 30 seconds).Alertssutra alerts check
POST /api/alerts/:id/acknowledgeAcknowledges an alert: still open, reminders stop.Alertssutra alerts ack <id>
POST /api/alerts/:id/resolveResolves an alert by hand.Alertssutra alerts resolve <id>
GET /api/alerts/kindsKinds of alert rule and their settings.Signed in
GET /api/alerts/rulesAlert rules with their kind, thresholds and channels.View on a projectsutra alerts rules
POST /api/alerts/rulesAdds an alert rule (see GET /api/alerts/kinds for its settings).Alerts
PUT /api/alerts/rules/:idChanges a rule.Alerts
DELETE /api/alerts/rules/:idDeletes a rule.Alerts
POST /api/alerts/rules/:id/checkEvaluates one rule now and answers what it found, without opening alerts.Alerts
GET /api/alerts/channelsAlert channels, where alerts are sent, without their secrets.Alertssutra alerts channels
POST /api/alerts/channelsAdds a channel.Alerts
PUT /api/alerts/channels/:idChanges a channel.Alerts
DELETE /api/alerts/channels/:idDeletes a channel.Alerts
POST /api/alerts/channels/:id/testSends a test message through a channel.Alertssutra alerts test <channel>

35. Admin API: server settings, secrets and the database

Gateway ports and certificates, engine properties, the vault, script and release policies, Python, and SutraFlow's own database.

21 endpoints. Permissions, conventions and examples: The admin API.

EndpointWhat it doesWho may call itsutra command
GET /api/engine-variablesEngine properties: values every project can read (ev.NAME), secrets as names. Studio only.Signed in
PUT /api/engine-variablesSaves the engine properties (the whole list). Every engine reloads them. Studio only.Server settings
GET /api/secretsNames of stored secrets (never values). With ?projectId=: only the ones that project can use (behind its Secret properties and the engine's). Without: the whole list, for Secrets, Server settings or Alerts.View on ?projectId (any project when absent)
PUT /api/secrets/:nameStores a secret in the vault, encrypted with the master key. Body: {value}.Secretssutra secret set <NAME> --from-env <VAR>
DELETE /api/secrets/:nameDeletes a secret.Secrets
GET /api/serverServer settings and state: gateway ports and status, TLS and certificate, routes, listeners, schedule errors, run counts, admin address. Studio only.View on a project
PUT /api/server/gatewayGateway address and ports. Body: {host, httpPort, httpsPort}. The gateway restarts on them. Studio only.Server settings
PUT /api/server/tlsTLS settings. Body: {mode: "off"|"selfSigned"|"uploaded"|"acme", domains, email, staging, agreeTos, clientCaPem}. Studio only.Server settings
POST /api/server/tls/self-signedMakes a self-signed certificate for the domains and uses it. Studio only.Server settings
POST /api/server/tls/uploadUses your certificate. Body: {certPem, keyPem}. Studio only.Server settings
POST /api/server/tls/acmeRequests a Let's Encrypt certificate (renewed automatically). Studio only.Server settings
GET /api/server/databaseSutraFlow's own database: kind, address without password, size, and a move in progress.Server settingssutra db info
PUT /api/server/database/targetSaves the PostgreSQL to move to. Body: {host, port, database, user, sslMode} (password in the vault).Server settings
POST /api/server/database/testTests a PostgreSQL target: sign-in, SSL, version, existing SutraFlow tables.Server settings
POST /api/server/database/migrateCopies the data to the saved PostgreSQL target. Body: {replace}.Server settings
GET /api/server/database/reconnectHow the engine reconnects when PostgreSQL is lost.Server settings
PUT /api/server/database/reconnectSaves the reconnect settings.Server settings
GET /api/scripts/policyWhether script steps (JavaScript, Python) may run on this server. Studio only.Signed in
PUT /api/scripts/policyAllows or stops script steps. Body: {allowed}. Studio only.Server settings
GET /api/scripts/pythonWhich Python runs Python steps here, and the path an administrator set.Signed insutra python
PUT /api/scripts/pythonSets the Python to use. Body: {path} (empty: find it).Server settingssutra python --set <path> | --clear

36. Admin API: projects, Sutras and connections (studio)

What the designer uses. Served by the studio only: headless engines answer 404 except for the few marked. Useful for tooling around projects; releases are the way to move Sutras between servers.

77 endpoints. Permissions, conventions and examples: The admin API.

EndpointWhat it doesWho may call itsutra command
GET /api/metaThe activity catalog: step kinds, their settings and palettes, with the server's version and mode.Signed in
GET /api/projectsProjects the caller may see. The sutra command uses it to find a project by name.Signed insutra history --project <name> (and others, to find the project)
POST /api/projectsCreates a project. Body: {name, description}.Design on all projects
GET /api/projects/:idOne project with its properties (secrets as names, never values). Studio only.View on the project
PUT /api/projects/:idSaves a project: name, description, properties. Studio only.Design on the project
DELETE /api/projects/:idDeletes a project with its Sutras, connections and schemas. Studio only.Design on the project
PUT /api/projects/:id/variables/:name/secretStores the value of a secret or private key project property in the vault. Body: {secretValue, type, create, onlyCreate}. Also needs the Secrets permission. Studio only.Design on the project
GET /api/projects/:id/opsThe project's deployment config on this server: property values, connection settings, logging. Studio only.Deploy on the project
PUT /api/projects/:id/opsSaves the deployment config. Studio only.Deploy on the project
GET /api/projects/:id/ops/fileThe deployment config as a JSON file to download. Studio only.Deploy on the project
POST /api/projects/:id/ops/fileLoads a deployment config file into the project. Studio only.Deploy on the project
GET /api/projects/:id/logThe end of the project's log. Query: lines (at most 2000), level, q, origin. Studio only.View on the project
POST /api/projects/:id/log/clearClears the project's log (not on production servers). Studio only.Design on the project
POST /api/projects/:id/runs/clear-testsDeletes the project's test and debug runs (not on production servers). Studio only.Design on the project
GET /api/projects/:id/usageWhat deleting an item or folder would affect. Query: item. Studio only.View on the project
GET /api/samplesThe sample Sutras that can be added to a project. Studio only.Signed in
POST /api/projects/:id/samplesAdds sample Sutras to a project as new Sutras. Body: {ids} (all when absent). Studio only.Design on the project
GET /api/samples/sutra-sample-shop.zipThe chat sample's website as a zip. Studio only.Signed in
GET /api/sample-projectsSample projects shipped with SutraFlow. Studio only.Signed in
GET /api/sample-projects/:fileOne sample project file to download. Studio only.Signed in
GET /api/projects/:id/documentationDocumentation of a project made from its Sutras and step descriptions. Query: format=html|md. Studio only.View on the projectsutra doc --project <name>
GET /api/flows/:id/contractThe input contract of a Sutra for Call Sutra (2.1.7): its Manual start payload schema (JSON Schema or XSD) for use (draft or deployed), whether it is strict, and a fingerprint that changes with the schema; or the problem (not deployed, another project, no Manual start). Studio only.View on the Sutra's project
GET /api/flows/:id/page-linkWhere a Dashboard page step publishes its page (2.1.7): node is the step; deployed or not, the deployed version and name, the name in the draft, and the page address on the gateway. Studio only.View on the Sutra's project
GET /api/flows/:id/documentationThe same for one Sutra. Studio only.View on the Sutra's projectsutra doc --project <name> --sutra <name>
GET /api/flowsSutras of a project. Query: projectId. Studio only.View on ?projectId (any project when absent)sutra doc, sutra sutras (to find a Sutra by name)
POST /api/flowsCreates a Sutra. Body: {projectId, doc, folder}. Without projectId it goes to the default project, which needs Design there. Studio only.Design on projectId of the body
GET /api/flows/:idOne Sutra: its draft and its deployed version. Studio only.View on the Sutra's project
PUT /api/flows/:idSaves a Sutra's draft. It stays in its project: a body naming another project is refused. Studio only.Design on the Sutra's project
DELETE /api/flows/:idDeletes a Sutra (undeployed first). Studio only.Design on the Sutra's project
POST /api/flows/:id/renameRenames a Sutra. Body: {name}. Studio only.Design on the Sutra's project
PUT /api/flows/:id/folderMoves a Sutra to a folder. Body: {folder}. Studio only.Design on the Sutra's project
POST /api/flows/validateChecks a Sutra document and lists errors and warnings. Query: projectId (required; Design on that project). Studio only.Design on ?projectId (any project when absent)
GET /api/flows/:id/versionsThe Sutra's published versions and which one is deployed.View on the Sutra's project
POST /api/flows/:id/deployDeploys a version of a Sutra (the draft when no version). Body: {version, note}. Refused on production servers, which take releases only.Deploy on the Sutra's projectsutra sutras deploy <sutra> --project <name> --version <n>
DELETE /api/flows/:id/deployUndeploys a Sutra: its triggers and addresses stop.Deploy on the Sutra's project
POST /api/flows/:id/testTest run of the draft (or {doc}), optionally in the debugger ({debug: {stepping, breakpoints}}). Answers the run id. Studio only.Design on the Sutra's project
GET /api/flows/:id/sampleThe newest test or debug run's outputs, used as design-time samples. Studio only.View on the Sutra's project
POST /api/flows/:id/runStarts the deployed version of a Sutra with a manual start. Body: the input. Query: wait (ms, at most 120000) to answer with the finished run. Studio only.Operate on the Sutra's project
GET /api/projects/:id/foldersFolders of the explorer. Query: area=sutras|resources|schemas|wsdl. Studio only.View on the project
POST /api/projects/:id/foldersCreates a folder. Body: {path, area}. Studio only.Design on the project
POST /api/projects/:id/folders/moveMoves or renames a folder. Body: {from, to, area}. Studio only.Design on the project
DELETE /api/projects/:id/foldersRemoves a folder. Query: path, area; with withItems=1&confirm=delete also everything in it. Studio only.Design on the project
GET /api/projects/:id/folders/contentsWhat a folder holds. Query: path, area. Studio only.View on the project
POST /api/design/schemasDesign-time shapes of every step of a Sutra document (process data, inputs, outputs), for the mapper. Body: {projectId, doc}; only schemas and called Sutras of that project are read. Studio only.Design on projectId of the body
POST /api/design/mapping-previewRuns a mapping against sample data and answers the result. Studio only.Design on projectId of the body
POST /api/design/schema-from-sampleA schema made from a sample JSON or XML document. Studio only.Design on projectId of the body
POST /api/design/query-previewRuns one read-only SQL activity against its connection and answers at most ten rows. Studio only.Design on projectId of the body
POST /api/expr/evalEvaluates a formula against sample data. Studio only.Design on a project
POST /api/soap/describeReads a WSDL: services, operations and messages. Body: {projectId, wsdlUrl | wsdlRef, connection, auth}. A WSDL, connection and security profile of that project (or shared ones), or an http(s) address such as the published service of another project. Studio only.Design on projectId of the body
GET /api/schemasShared schemas of a project. Query: projectId. Studio only.View on ?projectId (any project when absent)
GET /api/schemas/:idOne shared schema with its definition. Studio only.View on the schema's project
POST /api/schemasCreates a schema. Body: {project_id, name, kind, text, root}. An id that already exists is refused (409): change it with PUT. Studio only.Design on projectId of the body
PUT /api/schemas/:idSaves a schema. It stays in its project: a body naming another project is refused. Studio only.Design on the schema's project
DELETE /api/schemas/:idDeletes a schema. Studio only.Design on the schema's project
POST /api/schemas/:id/renameRenames a schema. Body: {name}. Studio only.Design on the schema's project
PUT /api/schemas/:id/folderMoves a schema to a folder. Body: {folder}. Studio only.Design on the schema's project
GET /api/schemas/:id/treeThe schema as a tree for the mapper. Query: root. Studio only.View on the schema's project
POST /api/schemas/:id/impactWhich Sutras a change of the schema would affect. Studio only.Design on the schema's project
GET /api/resourcesConnections of a project (and knowledge bases granted to it). Query: projectId, kind.View on ?projectId (any project when absent)sutra connect (to find the connection)
POST /api/resourcesCreates a connection. Body: {project_id, kind, name, config}; secrets as {{gv.NAME}} references. An id that already exists is refused (409): change it with PUT.Connections on projectId of the body
PUT /api/resources/:idSaves a connection. It stays in its project: a body naming another project is refused. Studio only.Connections on the connection's project
DELETE /api/resources/:idDeletes a connection. Studio only.Connections on the connection's project
POST /api/resources/:id/renameRenames a connection. Body: {name}. Studio only.Connections on the connection's project
PUT /api/resources/:id/folderMoves a connection to a folder. Body: {folder}. Studio only.Connections on the connection's project
POST /api/resources/testTests connection settings as sent (saved or not) and reports the result. Studio only.Connections on projectId of the body
POST /api/resources/modelsThe models an AI provider connection offers. Studio only.Connections on projectId of the body
POST /api/resources/ai/resolveWhich provider and model an AI connection would use now, without generating text. Studio only.Connections on projectId of the body
POST /api/resources/ollama/:actionOllama: pull a model (online) or import a .gguf file on this server (offline). Body: {model, file}. Studio only.Server settings
GET /api/resources/:id/search-indexThe search index of a knowledge base: size and when built. Studio only.View on the connection's project
POST /api/resources/:id/search-indexBuilds the knowledge base's search index again. Studio only.Connections on the connection's project
GET /api/oauth/:idWhether an OAuth connection is authorised, and the redirect address to register.View on the connection's projectsutra connect <connection> --project <name>
GET /api/oauth/:id/startThe address where a person authorises the connection.Connections on the connection's projectsutra connect <connection> --project <name>
DELETE /api/oauth/:idForgets the connection's OAuth tokens.Connections on the connection's project
GET /api/ai/cli-policyAI command-line tools (2.1.8): whether AI providers that use a command-line tool and MCP servers started by a command may run, the allowed command lines (the command line of a connection must start with one, word for word) and further environment variable names the programs get. Studio only.Signed in
PUT /api/ai/cli-policyChanges the AI command-line tools policy. Body: {allowed, commands, env, approve, dismiss}; any part may be left out. approve and dismiss name command lines waiting for approval (found in connections when the server was upgraded to 2.1.8): approved ones join the allowed commands. Server settings permission. Studio only.Server settings
GET /api/env-bindingsEnvironment variables projects may read with ${env:NAME} in their properties, deployment config, logging and connections (2.1.8), and requested: names projects use that are not allowed, with where (names only, never values). Server settings permission. Studio only.Server settings
PUT /api/env-bindingsSets the environment variables projects may read. Body: {allowed: [names]}. The server's own variables (SUTRA_...) are refused. Server settings permission. Studio only.Server settings

37. Admin API: Git

Git accounts of each person, and each project's repository: commit, push, pull, branches and conflicts. Studio only.

24 endpoints. Permissions, conventions and examples: The admin API.

EndpointWhat it doesWho may call itsutra command
GET /api/git/providersSupported Git hosts and the Git engine on this server. Studio only.Signed in
GET /api/git/accountsThe caller's Git accounts (no tokens). Studio only.Signed in
POST /api/git/accountsAdds a Git account for the caller. Studio only.Signed in
PUT /api/git/accounts/:idChanges one of the caller's Git accounts. Studio only.Signed in
DELETE /api/git/accounts/:idDeletes one of the caller's Git accounts. Studio only.Signed in
POST /api/git/accounts/:id/testTests a Git account against a repository. Body: {url}. Studio only.Signed in
POST /api/git/cloneClones a repository as the caller's personal project. Studio only.Signed in
GET /api/projects/:id/gitThe project's repository: branch, changes, ahead and behind. Studio only.View on the project
POST /api/projects/:id/git/initStarts a repository for the project. Studio only.Design on the project
POST /api/projects/:id/git/publishPublishes the project to a new remote. Body: {url, accountId}. Studio only.Design on the project
POST /api/projects/:id/git/commitCommits the changes. Body: {message, push}. Studio only.Design on the project
POST /api/projects/:id/git/pushPushes to the remote. Studio only.Design on the project
POST /api/projects/:id/git/pullPulls from the remote. Studio only.Design on the project
POST /api/projects/:id/git/fetchFetches from the remote without changing the project. Studio only.Design on the project
POST /api/projects/:id/git/discardDiscards uncommitted changes (of one path, or all). Studio only.Design on the project
GET /api/projects/:id/git/branchesLocal and remote branches of the project's repository. Studio only.View on the project
POST /api/projects/:id/git/switchSwitches branch. Body: {branch, create}. Studio only.Design on the project
GET /api/projects/:id/git/logCommit history. Query: max. Studio only.View on the project
GET /api/projects/:id/git/commits/:shaFiles of one commit. Studio only.View on the project
GET /api/projects/:id/git/diffDifferences of a file. Query: path, sha. Studio only.View on the project
POST /api/projects/:id/git/resolveResolves a conflict. Body: {path, side: "ours"|"theirs"}. Studio only.Design on the project
POST /api/projects/:id/git/abortAbandons a merge in progress. Studio only.Design on the project
POST /api/projects/:id/git/trustTrusts the repository's scripts and settings after a review. Studio only.Design on the project
DELETE /api/projects/:id/gitDisconnects the repository (a personal clone is removed with its project). Studio only.Design on the project

Reference and troubleshooting

38. The command line by task

SutraFlow has two commands. This chapter groups them by the task you have, says what each does and when to use it, and gives an example you can copy. The full list of every option, read from the commands themselves, is in Command reference; sutraflow help and sutra help print it too.

CommandWorks onUse it for
sutraflowThis machine: the SutraFlow folder, its processes and its settings fileInstalling, upgrading, starting and stopping, logs, Docker, moving the database
sutraWhat is inside SutraFlow: projects, packages, people, secrets, deployed Sutras, runs, enginesReleases, people and secrets, and every Admin Console action from a shell or a pipeline

How to run them

1. Installing and upgrading (sutraflow)

CommandWhat it doesWhen to use it
sutraflow installOpens the web installer on this machine: administrator, database with a connection test, ports, cluster, samplesA new server, by a person at the machine
sutraflow install --config install.json [--dry-run]The same without a browser, from a JSON file; --dry-run prints the plan and changes nothingServers built by scripts (Ansible, a golden image, a VM template)
sutraflow upgrade --config upgrade.json [--dry-run]Upgrades an installation from 2.1.0 on: backup, new files, data compared before and after, an automatic way back; keeps, adds, removes or refreshes the samples. With "reinstall": true, the same version again over a damaged installationEvery new version; run with --dry-run first in a change window. Reinstall: program files damaged or changed
sutraflow samples list | add | removeThe samples of an installation and their sample_ data: lists them, adds them, or removes them with their dataAdd on designer and training machines; remove before a server goes live
sutraflow setup [--ports]Installs the packages and builds SutraFlow from a source folder; makes sutraflow.envDevelopment machines working from the source
sutraflow versionThe installed versionBefore and after an upgrade; in support requests
sutraflow install --config install.json --dry-run      # read the plan
sutraflow install --config install.json                # install
sutraflow upgrade --config upgrade.json --dry-run      # {"from": "/opt/sutraflow", "samples": "remove"}
sutraflow samples remove --folder /opt/sutraflow       # going live: the samples and their data leave

2. Starting, stopping and watching (sutraflow)

CommandWhat it doesWhen to use it
sutraflow start [engine] [--foreground]Starts the studio (designer, Admin Console, engine and gateway), or a headless engine beside itAfter installing, after a restart of the machine, to add an engine on the same database
sutraflow stop [engine|all] [--force]Stops gracefully: no new work, running steps finish (up to 30 seconds)Before maintenance, a database copy or an upgrade by hand
sutraflow restart [engine]Stops, then startsAfter changing sutraflow.env
sutraflow statusStudio and engines: running, ready, addresses, databaseThe first look when something seems wrong
sutraflow logs [engine] [--follow]The last lines of the output logAn engine does not start, or stops on its own
sutraflow open adminOpens a page in the browser: designer, admin, guide, admin-guide, design-guide, architectureOn the server's desktop
sutraflow serviceShows how to start SutraFlow with the machine (a systemd unit, a Windows task)Once per server, so it survives reboots
sutraflow status
sutraflow logs engine --follow
sutraflow stop all && sutraflow start

3. Engines, clusters and Docker (sutraflow)

CommandWhat it doesWhen to use it
sutraflow engine-file <name> [--port] [--http] [--https] [--workers]A settings file for one more engine on another machine joining this cluster (PostgreSQL only)Adding an engine machine: copy the file and data/master.key there, then sutraflow start engine
sutraflow docker up | down | status | logs | buildThe studio and an engine in DockerTrying SutraFlow in containers on one machine
sutraflow docker cluster up | down | status | logsPostgreSQL, a studio and two engines in DockerTesting a cluster, failover and draining
sutraflow image build [--tag] | image save [file.tar]Builds the SutraFlow image from this folder or release package (no npm needed for a package), and saves it to a fileSites without internet, or your own registry
sutraflow engine-file engine-b --host 0.0.0.0 --port 4801 --http 9080 --https 9443
sutraflow docker cluster up

4. The database (sutraflow and sutra)

CommandWhat it doesWhen to use it
sutraflow db info / sutra db infoWhich database is in use, and its row countsBefore a move, and to check a move
sutraflow db copy --to postgres://... [--replace]Copies all data to another database (stop first)Moving from SQLite to PostgreSQL, or to a new database server
sutra db migrate [--url] [--write-env sutraflow.env]Copies SQLite data to PostgreSQL, checks every table arrived, and points the settings file at itThe whole move in one step (also Admin Console, Database, Migrate now)
sutraflow stop all
sutraflow db copy --to postgres://sutra@db1:5432/sutraflow
sutra db migrate --url postgres://sutra@db1:5432/sutraflow --write-env sutraflow.env

5. Releases: packaging, checking, deploying (sutra)

CommandWhat it doesWhen to use it
sutra package --project <name> --version 1.4.0 --zipA release zip of a project: every deployed Sutra at its version, a deployment config to fill in, a README and documentationHanding a tested project to the team that runs test or production
sutra package --from-git <repository> --ref v1.4.0 --out release.zipThe same from the project's Git repository, with no server or databaseCI/CD pipelines: build on every tag
sutra check <release.zip> [--json] [--checklist plan.md]Checks a package against a server: activities it knows, secrets present, addresses already in use; and the plan: Sutras new, unchanged or replacing what is here, what is created, the checklist, the plan id. Changes nothing.Before every deploy, and in a pipeline as a gate
sutra test <release.zip> [--secrets-from-env]Installs the package in a throw-away server and runs every Sutra with its test dataIn the pipeline before the package goes to any server
sutra deploy <release.zip> [--config prod.yaml] [--env env/prod.yaml] [--keep-others] [--approve <plan id>]Deploys a package with this server's deployment config; Sutras of the project not in it are undeployed unless --keep-others. Replacing or undeploying needs yes typed, or --approve with the plan id (exit code 3 without it)Putting a release on test, UAT or production
sutra config export | check | applyServer settings and project connections as a config file: export what is set, check what applying would create, apply (create what is missing, all or nothing; the rest in a checklist)Setting up environments the same way from Git and pipelines
sutra history --project <name>The packages deployed to a project, newest firstBefore a rollback; audits of what went live
sutra rollback --project <name> [--to <id>]Deploys the package before the current one (or the one named)A release misbehaves in production
sutra doc --project <name> | <release.zip> [--format html|md]Documentation from the Sutras and their step descriptionsReviews, hand-over, change records
sutra package --project "Orders" --version 1.4.0 --note "Faster lookup" --zip --out orders-1.4.0.zip
sutra test orders-1.4.0.zip --secrets-from-env
sutra config apply config/sutraflow.yaml --env config/env/prod.yaml --yes --server https://prod:4800 --token $SUTRA_TOKEN
sutra check orders-1.4.0.zip --server https://prod:4800 --token $SUTRA_TOKEN          # prints the plan id
sutra deploy orders-1.4.0.zip --approve 3f9c2a1b7d4e --server https://prod:4800 --token $SUTRA_TOKEN
sutra rollback --project "Orders" --server https://prod:4800 --token $SUTRA_TOKEN

6. People, system accounts, secrets and connections (sutra)

CommandWhat it doesWhen to use it
sutra user add <name> --role <role> [--project] [--system]Adds a person or a system account with a role, for all projects or oneThe first administrator of a headless engine; accounts for pipelines
sutra user list | password | disable | enable | unlock | sign-out | deletePeople and their accessJoiners and leavers, a locked account, a lost laptop (sign-out ends every session)
sutra token create <account> [--expires-days n] | list | revokeAPI tokens of a system account (shown once)A pipeline or a script needs to call the server; rotate them on a schedule
sutra secret set <NAME> --from-env <VAR>Saves a secret in the vault, encryptedBefore deploying a release that needs it; when a password changes
sutra connect <connection> --project <name>Signs in an OAuth connection (Google, Microsoft, YouTube) on a server without the studioProduction servers whose OAuth connections must be signed in once
sutra python --set <path> | --clearWhich Python runs Python stepsAfter installing Python on the server
sutra user add admin --role administrator --password-from-env ADMIN_PASSWORD
sutra user add ci-orders --system --role deployer --project "Orders"
sutra token create ci-orders --name github --expires-days 90
sutra secret set ORDERS_DB --from-env ORDERS_DB

7. Operating what is deployed (sutra, needs --server)

CommandWhat it doesWhen to use it
sutra statusServer health, readiness and enginesMonitoring scripts; after a deploy
sutra sutras list | start | stop | restart | deploy | tuneDeployed Sutras: their state and runs today; stopping and starting their triggers; deploying an earlier version; runs at a time, priority, retries and retentionA partner system is down (stop its Sutra), a Sutra needs more room, going back one version
sutra runs list | show | resubmit | cancelRuns, one run step by step, running it again from its failed steps, cancelling itFailed runs after an outage; a run stuck waiting
sutra approvals list | approve | rejectSteps waiting for a person, and the decisionDecisions from a script or when the Approval Center is not at hand
sutra engines list | drain | restart | lead | tune | machine | name | housekeepingEngines of the cluster: stop one gracefully, choose which may lead, workers and limits, the advice for the machine, clearing old runsPatching a machine (drain it first), sizing, a full disk
sutra memory list | rows | reload | clear | set | removeMemory tables and their rowsReference data changed at its source (reload), a wrong value to fix now
sutra agents conversations | clear-expiredConversations of published agents; removes expired ones with their memoryOn a schedule, so old conversations do not pile up
sutra knowledge list | sync | runsServer knowledge bases with grants and managed sources; Sync now (or --reindex to read everything again); the last syncs of a sourceAfter loading new documents; when answers look out of date (Knowledge admin)
sutra audit [--actor] [--outcome] [--from] [--csv] | retention | clearWho did what and when; how long entries are keptSecurity reviews, auditors, a full disk
sutra sutras list --project "Orders"
sutra sutras stop "Order feed" --project "Orders"           # the partner system is down
sutra runs list --status failed --limit 20
sutra runs resubmit 7f3c...                                 # after it is back
sutra engines drain engine-b                                # before patching that machine
sutra knowledge sync "Company knowledge" "HR folder" --reindex
sutra agents clear-expired

8. Alerts and the gateway (sutra, needs --server)

CommandWhat it doesWhen to use it
sutra alerts [list | history] | ack | resolve | check | rules | channels | testOpen and past alerts, acknowledging and resolving them, checking the rules now, a test message to a channelOn call; after setting up a new channel (test it)
sutra gateway apps | plans | stats | logApps that call your APIs, plans, traffic and the request logA caller says it is refused; traffic reviews
sutra gateway app add | disable | enable | delete, key create | revokeApps and their API keysA new partner; a leaked key (revoke, then create)
sutra gateway plan set | deleteRequest limits per minute, hour, day and monthPartners with different contracts
sutra gateway firewall | proxiesAddresses allowed and refused; reverse proxies whose forwarded headers are believedBlocking an abusive address; a new load balancer
sutra gateway openapiOpenAPI of the deployed servicesPublishing the API description to a developer portal
sutra gateway app add "Partner A" --scopes "orders:read" --plan Standard
sutra gateway key create "Partner A" --expires-days 365
sutra gateway firewall --deny "203.0.113.9"
sutra alerts test ops-teams
Good practice

On the server, use sutraflow cli; from elsewhere, a system account with only the roles the job needs and a token that expires.
Run --dry-run (install, upgrade) and sutra check (releases) before the real thing.
Keep the commands a change needs in the change record: they are the exact steps, and the way back.

39. Command reference

SutraFlow has two command line tools. Both lists below are read from the tools themselves when this guide is built, so they always match the version you have; sutraflow help and sutra help print the same.

sutraflow: running SutraFlow

CommandWhat it does
sutraflow install [--port 4790] [--no-open] [--reset]The web installer: administrator, database (with a connection test), ports, cluster; or an upgrade of an installation from 2.1.0 on. It opens in the browser and answers on this machine only. --reset unlocks it after an install.
sutraflow install --config install.json [--dry-run]
sutraflow upgrade --config upgrade.json [--dry-run]The same without a browser, from a JSON file (passwords as {"env": "NAME"} or {"file": "path"}); --dry-run prints the plan. See docs/install-example.json. upgrade.json: {"from": "<installation>", "backupDir": "...", "start": true, "samples": "keep|add|remove|refresh"} (samples 2.1.5; production: remove).
sutraflow samples list|add|remove [--folder <installation>] [--no-start]The samples of an installation (this folder by default): list them and their sample_ data, add them (project Samples), or remove them with their data; a change stops SutraFlow and starts it again (2.1.5).
sutraflow setup [--ports]Installs the packages and builds SutraFlow (from a source folder), and makes sutraflow.env and the local admin token; asks for the ports when it makes sutraflow.env (or with --ports), checking that each is free.
sutraflow start [engine] [--foreground]Starts the studio (designer, Admin Console, engine and gateway), or a headless engine beside it on the same database. In the background unless --foreground; its output goes to <data>/logs/<name>.out.log.
sutraflow stop [engine|all] [--force]Stops gracefully: no new work, running steps finish (up to 30 s). --force ends the process when it does not stop in time.
sutraflow restart [engine]Stops, then starts.
sutraflow statusStudio and engine: running or not, ready, addresses, database.
sutraflow logs [engine] [--follow]The last lines of the output log.
sutraflow open [designer|admin|guide|admin-guide|design-guide|architecture]Opens the page in the browser.
sutraflow engine-file <name> [--host 0.0.0.0] [--port 4801] [--http 9080] [--https 9443] [--workers n]A settings file for one more engine on another machine, joining this cluster (PostgreSQL only): the same database, its own name and ports, no password. Copy it and data/master.key there, then: sutraflow start engine.
sutraflow cli <sutra command ...>The sutra command, pointed at this studio with the local admin token, for example: sutraflow cli sutras list
sutraflow db info | db copy --to <postgres://...> [--replace]Which database is in use; copies the data to PostgreSQL (stop first). To move to PostgreSQL in one go (stop, copy, switch, start, check): tools/migrate-to-postgres, or Admin Console > Database > Migrate now.
sutraflow serviceHow to start SutraFlow with the machine (systemd unit or Windows task).
sutraflow docker up | down | status | logs [service] | buildThe studio and an engine in Docker (docker-compose.yml).
sutraflow docker cluster up | down | status | logsPostgreSQL, a studio and two engines (docker-compose.cluster.yml).
sutraflow image build [--tag name:version] [--base image] [--platform linux/amd64]Builds the SutraFlow image (2.1.6). From a release package (the offline one holds its runtime packages): no npm and no internet, only the base image (node:24-bookworm-slim, docker pull once or docker load). From a source folder: the Dockerfile, which needs the npm registry.
sutraflow image save [file.tar] [--tag name:version]Writes the image to a file, to carry to a machine without internet: docker load -i file.tar there. Then docker tag and docker push to any registry.
sutraflow versionThe SutraFlow version.

Settings: sutraflow.env in the SutraFlow folder (ports, data folder, SUTRA_DB, Node path); SUTRAFLOW_ENV names another file.

sutra: releases, people and operations

CommandWhat it does
Releases
sutra package --project <name> [--version 1.0.0] [--note text] [--sutras "A,B"] [--zip] [--out file]Builds a package of a project: every deployed Sutra at its deployed version. With --zip or an --out ending in .zip, a release zip: the package, a deployment config to fill in for the target (connections, project variables, secrets needed) and a README.
sutra package --from-git <repository address | folder> [--ref <tag|branch|commit>] [--version 1.0.0] [--note text] [--sutras "A,B"] [--out release.zip]Builds a release zip from the project's files in Git, with no server or database, for CI/CD pipelines. Every Sutra in the repository (or the chosen ones) is deployed by it. A private repository reads its token from SUTRA_GIT_TOKEN (login SUTRA_GIT_LOGIN).
sutra check <release.zip | file.sutra> [--project <name>] [--config file] [--env file] [--keep-others] [--json] [--checklist plan.md]Checks a package against a server: activities, secrets, addresses in use; and the plan (2.1.6): Sutras new, unchanged or REPLACED, those undeployed, what is created, the checklist of connections and properties already there (kept as they are), and the plan id.
sutra deploy <release.zip | file.sutra> [--project <name>] [--config deployment-config.json] [--env file] [--keep-others] [--approve <plan id>] [--checklist checklist.md]Deploys a package with its deployment config (the zip's own, or --config; JSON or YAML, with --env env/prod.yaml merged over it for what differs per environment); Sutras of the project not in it are undeployed unless --keep-others. Connections and project properties are created when missing, never changed: those already there go to the checklist. Replacing or undeploying Sutras needs a person's yes: typed when asked, or --approve with the plan id from sutra check (exit code 3 without it; refused if the server changed since).
sutra config export [--server-settings] [--project "A,B" | --all-projects] [--out file.yaml|file.json]What is set now as a config file (YAML unless .json): server settings (engine properties, roles, system accounts without tokens, shared connections, gateway, policies, plans, apps without keys, alerts, server knowledge bases) and projects. Never people; secrets are written as ${env:NAME} placeholders, never their values.
sutra config check <file> [--env env/prod.yaml] [--allow-plain-secrets] [--json] [--checklist checklist.md]What applying would create and the checklist of what is already there; nothing changes. Values may be written directly, as ${env:NAME} (read here) or, for secrets and certificates, file:/path; $${env:NAME} stays a reference read on the server at run time.
sutra config apply <file> [--env env/prod.yaml] [--allow-plain-secrets] [--yes] [--json] [--checklist checklist.md]Creates what is missing, all or nothing: one item that cannot be created stops it and nothing is created. What is already there is never changed: it is listed in the checklist (name, type, where it points, the fields that differ) to verify by hand. In a terminal it shows the plan and asks first, unless --yes.
sutra test <release.zip | file.sutra> [--skip "A,B"] [--secret NAME=value ...] [--secrets-from-env]Installs the package in a throw-away server and runs every Sutra with its test data.
sutra history --project <name>Deployments of packages to a project.
sutra doc (--project <name> [--sutra <name>] | <release.zip | file.sutra>) [--format html|md] [--out file]Documentation made from the Sutras and their step descriptions: what starts each Sutra, its steps in order with their settings, connections and variables.
sutra rollback --project <name> [--to <id>]Deploys the package before the current one, or the deployment with that id.
Server, data and people
sutra statusServer health, readiness and engines.
sutra connect <connection> --project <name> [--wait-minutes 10]Signs in an OAuth connection (Google, YouTube, Twitch, ...) on a server without the studio: prints the sign-in address, and waits until the account is connected. The server's /api/oauth/callback address must be a redirect address of the OAuth app. Needs --server.
sutra python [--set <path to python> | --clear]Which Python runs Python steps on the server; --set chooses an interpreter.
sutra secret set <NAME> (--value <v> | --from-env <VAR>)Saves a secret in the vault (encrypted); Sutras and connections use it by name.
sutra db copy --to <postgres://user:pass@host/db | file.db> [--replace]Copies this server's data (SUTRA_DATA_DIR or SUTRA_DB) to another database, for example from SQLite to PostgreSQL. A missing PostgreSQL database is created. Stop the server first; then start it with SUTRA_DB set to the new address and the same master key.
sutra db infoWhich database the server uses, and its row counts.
sutra db migrate [--url <postgres://...>] [--replace] [--write-env <sutraflow.env>]Copies this server's SQLite data to the PostgreSQL connection saved on the Admin Console's Database page (or --url), checks every table arrived, and with --write-env points that settings file at PostgreSQL (old file kept). Stop the server first; the script tools/migrate-to-postgres does the whole move, stop and start included.
sutra user add <name> [--role administrator] [--project <name>] [--system] [--display "Name"] [--email e] [--password <p> | --password-from-env <VAR>] [--keep-password]Adds a person (or a system account) with a role for all projects or one project. People choose a new password at their first sign-in unless --keep-password. This is how a headless engine gets its first administrator.
sutra user listPeople and system accounts with their roles.
sutra user password <name> (--password <p> | --password-from-env <VAR>)Sets a new password; the person chooses their own at the next sign-in.
sutra user disable | enable | unlock | sign-out | delete <name>Blocks or allows sign-in, clears a lock after wrong passwords, ends all sessions, or deletes.
Operating deployed Sutras (the same actions as the Admin Console; need --server)
sutra sutras list [--project <name>]Deployed Sutras with their state and runs of the last 24 hours.
sutra sutras start | stop | restart <sutra> --project <name>Starts or stops a deployed Sutra's triggers; restart does both.
sutra sutras deploy <sutra> --project <name> --version <n>Deploys a published version of a Sutra (an earlier one to go back).
sutra sutras tune <sutra> --project <name> [--max-runs n] [--priority n] [--run-timeout-min n] [--retries n] [--retry-delay-ms n] [--step-data all|errors-only|none] [--retention-days n] [--execution durable|in-memory]Tuning of one Sutra: runs at a time, priority, time limit, retries, what runs keep and how long, and whether it runs durable or in memory.
sutra runs list [--sutra <name> --project <name>] [--status failed] [--limit 50]Recent runs, newest first.
sutra runs show | resubmit | cancel <run id>One run step by step; runs it again from its failed steps; or cancels it.
sutra approvals list | approve <id> [--comment text] | reject <id> [--comment text]Steps waiting for a person, and the decision on one.
sutra engines list | drain <engine> | restart <engine> | housekeepingEngines of the cluster; stops one gracefully; deletes runs and audit entries past retention.
sutra engines lead <engine> --yes|--no | cluster-name <name>Whether an engine may lead (the leader is elected among those that may), and the cluster's name.
sutra engines tune [--engine <id>] [--workers n] [--max-steps n] [--reply-timeout-ms n] [--retention-days n] [--design-retention-days n] [--audit-retention-days n] [--trace-sampling 0..1] [--memory-workers n] [--poll-ms n] [--settings-refresh-ms n] [--memory-mb n]Engine tuning, for every engine or one: workers, limits, retention, trace sampling, queue check; Node memory (MB, applies at restart: sutra engines restart <engine>).
sutra engines machineThe cores and memory of the machine the engine runs on (read when it starts), and the settings recommended for it. Every engine reads its own machine, so each install gets its own advice.
sutra engines name <engine id> <display name>The name people see for an engine in the Admin Console ("" = its id). The id stays the same.
sutra memory list [--project <name>] | rows <table> --project <name> [--find text] [--offset n] [--limit 50]Memory tables with their settings and figures on this engine, and their rows a page at a time.
sutra memory reload | clear <table> --project <name>Loads a memory table again from its source on every engine (hot reload), or empties it.
sutra memory set <table> --project <name> --row '{"code":"EUR","rate":1.08}' [--key EUR] | remove <table> --project <name> --key EURChanges one value by hand, or removes it.
sutra agents conversations | clear-expired [--agent <name>]Conversations of published agents, active and expired; clear-expired removes expired ones with their memory.
sutra knowledge list | sync <knowledge base> <source> [--reindex] | runs <knowledge base> <source>Server knowledge bases with their grants and managed sources; Sync now (on the leader, within 15 seconds), optionally reading every item again; the last syncs of a source with what they added, changed and removed.
sutra token create <system account> [--name text] [--expires-days n] | list <account> | revoke <account> <id>API tokens of a system account, for scripts and pipelines.
sutra audit [--actor name] [--outcome ok|failed|denied] [--from 2026-10-01] [--csv]Who did what, when, and with what outcome.
sutra audit retention [<days>]How long audit entries are kept; with a number, sets it (0 = keep everything).
sutra audit clear --before 2026-10-01 | --older | --allClears audit entries before a date, older than the retention, or all; the clearing is recorded.
Alerts (need --server)
sutra alerts [list | history] | ack <id> | resolve <id> | check | rules | channels | test <channel>Open and past alerts, acknowledging and resolving them, checking now, the rules and channels, and a test message to a channel.
Gateway (apps, keys, plans, firewall, traffic; need --server)
sutra gateway apps | plans | stats [--period 1h|24h|7d|30d] | log [--status errors|refused|ok] [--limit n]Apps, plans, traffic statistics and the request log.
sutra gateway app add <name> [--scopes "orders:read orders:write"] [--plan <name>] [--contact text]Adds an app that calls your APIs, with its scopes and plan.
sutra gateway app disable | enable | delete <name>Blocks, allows or deletes an app.
sutra gateway key create <app> [--name text] [--expires-days n] | key revoke <app> <key id>Makes an API key for an app (shown once) or revokes one.
sutra gateway plan set <name> [--per-minute n] [--per-hour n] [--per-day n] [--per-month n] | plan delete <name>Request limits of a plan.
sutra gateway firewall [--allow "10.0.0.0/8,192.168.1.5"] [--deny "203.0.113.9"]Addresses allowed and refused; with no options, shows them.
sutra gateway proxies [--trusted "127.0.0.1,10.0.0.5"]Reverse proxies whose X-Forwarded-For and X-Forwarded-Proto are believed ("" for none); with no options, shows them.
sutra gateway openapiOpenAPI of the deployed services (JSON).

Remote: --server <url> --token <token> (or SUTRA_SERVER, SUTRA_ADMIN_TOKEN). The token is a system account's API token (limited to its roles) or the server's SUTRA_ADMIN_TOKEN.

Exit code 0 = success, 1 = failure, 2 = wrong usage.

Examples

sutraflow setup                               install and build
sutraflow start                               the studio, in the background
sutraflow start engine                        a second engine on the same database
sutraflow status                              what runs, where, on which database
sutraflow cli sutras list                     deployed Sutras with their runs today
sutraflow cli runs list --status failed       failed runs
sutraflow cli user add meera --role developer --password-from-env NEW_PASSWORD
sutraflow db copy --to postgres://postgres@127.0.0.1:5432/sutraflow
sutraflow stop all                            graceful: running steps finish first
sutra package --project Shop --version 1.4.0 --out shop-1.4.0.sutra
sutra deploy shop-1.4.0.sutra --server https://prod:4800 --token $SUTRA_TOKEN
Guidelines

Run sutraflow stop before db copy, so nothing changes while the data is copied.
Give scripts a system account and its API token (sutra user add --system, sutra token create) rather than the local admin token.

40. Troubleshooting servers

What you seeWhat to do
Upgrade: "It already runs 2.1.8, the version of this package"Nothing to upgrade. If the installation is damaged, tick Reinstall (or "reinstall": true in upgrade.json) to put the package's program files back (Upgrading).
Install from an unpacked package does not ask for a folderInstall puts SutraFlow in the folder the package was unpacked to. To bring an existing installation to the package's files, use Upgrade (or Reinstall for the same version) and give that installation's folder.
PowerShell: "The term 'sutraflow' is not recognized"PowerShell runs nothing from the current folder by its name alone: in bin type .\sutraflow.cmd, or from the SutraFlow folder bin\sutraflow.cmd (The sutraflow command).
The installer says SutraFlow is already installed in this folderIt locked itself after the install (data/install.lock). To bring another installation up to this version, choose Upgrade; to install again here, sutraflow install --reset first.
Test connection in the installer: pgvector is not installedInstall pgvector on the PostgreSQL server (Development machines for Laragon and Linux), or choose Continue without pgvector when no knowledge base will be kept in PostgreSQL.
A port is in useAnother program, or another SutraFlow, listens there. Use the suggested free port; sutraflow status shows what each SutraFlow process uses.
The upgrade stopped at Program files freeA program holds files of the installation without sharing; the message names the files and, on Windows, the process (id and name). Stop that program (a SutraFlow process started by hand, an editor with a file open, an indexer) or let it finish, and run the upgrade again: nothing was changed. Web servers, terminals and Explorer windows in the folder do not need closing.
The upgrade stopped at BackupThe dump could not be read back, or the backup folder is full: nothing was changed. Free space, or give another backup folder.
The upgrade failed and put the previous version backThe page and data/logs/installer.log name the step and the reason; the backup is in backups/<version>-<time>. Fix the cause and run the upgrade again.
"The database was not restored" after a failed upgradeA process still held its tables (an engine on another machine). Stop every engine of the cluster and restore the dump from the backup by hand: pg_restore --clean --if-exists -d <database> database.dump.
An engine does not start; the log ends with the Node.js versionThat line only ends a crash: read the error above it in <data>/logs/<name>.out.log. A Node memory size too large for the machine is one cause; lower it in sutraflow.env (STUDIO_MEMORY_MB, ENGINE_MEMORY_MB).
Timers and listeners stopped in a clusterNo engine that may lead is alive. Admin Console, Engines shows the leader and never leads; allow another engine to lead, or start one that may.
Secrets cannot be read after a move or a restoreThe master key differs. Use the same data/master.key (or SUTRA_MASTER_KEY) as the server the data came from.
Callers get 403 behind a proxyThe proxy forwards to the gateway's HTTP port while the policy requires HTTPS: list the proxy under Trusted proxies and have it send X-Forwarded-Proto: https, or forward to the HTTPS port (Planning a server).
Every caller has the proxy's address in the request log, or one caller's rate limit stops everyoneThe proxy is not trusted, so X-Forwarded-For is ignored: list its address under Gateway → Firewall → Trusted proxies.
Let's Encrypt failsPort 80 on the domain must reach the gateway's HTTP port.