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.
| Task | Where |
|---|---|
| Choose a set-up: one server, PostgreSQL, a cluster, Docker | Planning a server |
| Install a server, by pages in the browser or silently from a file | The web installer, Silent installation |
| Upgrade it, with a backup and a way back | Upgrading |
| Start, stop and configure it | The sutraflow command and server settings |
| Engines, clusters and sizing | Running in production, Setting up a cluster, Sizing |
| Deployed Sutras, runs, alerts, the gateway, people and the audit log | The Admin Console |
| Docker and Kubernetes from the start: the words, making the image, upgrading | Docker in plain words, Containers and Kubernetes |
| Take an application from development to test and production, with or without Docker | From development to production, Adding an application to a running cluster |
| One Admin Console for a cluster; what happens when the leader stops | One Admin Console for the whole cluster, Questions from DevOps teams |
| Releases on test and production servers | Receiving releases |
| Script or automate anything: every endpoint of the admin API, with its permission and sutra command | The admin API |
| Health, metrics, traces and logs | Monitoring |
Designers who also run their own development machine need only The web installer and Development machines.
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-up | Database | Good for |
|---|---|---|
| One studio | SQLite in the data folder | A developer machine, a proof of concept, a small server: about 420 small steps a second, nothing to install |
| A studio and an engine beside it | SQLite or PostgreSQL | More work on one machine, and one keeps serving while the other restarts |
| A cluster: engines on several machines | PostgreSQL (14 or later, with pgvector for knowledge bases) | Failover, more throughput, production apart from design |
| Docker | PostgreSQL in the cluster file | Containers 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:
| When | Why a web server in front helps |
|---|---|
| Ports 80 and 443 are already used by Apache, IIS or nginx on the machine | Only 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 address | A 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 point | Certificates, logging, IP rules and firewalls stay where the organisation manages them. |
A friendly local address on a developer machine, such as http://sutra.test | Laragon's Apache gives every project a .test name; SutraFlow keeps its own port behind it. |
| The studio must be reached from other machines | The 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 readsX-Forwarded-For(the caller's address, for the firewall, IP rules, rate limits, logs and sign-in attempts) andX-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 server | Settings |
|---|---|
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. |
| nginx | proxy_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.
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.
- Check the download:
sha256sum -c sutraflow-VERSION-linux.tar.gz.sha256, or on WindowsGet-FileHash sutraflow-VERSION-windows.zip -Algorithm SHA256against the.sha256file. - Unpack it into an empty folder:
tar -xzf sutraflow-VERSION-linux.tar.gz -C /opt, or on Windows with Explorer or 7-Zip intoC:\SutraFlow. - 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).
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.
Database
- SQLite: a file in the data folder,
sutra.dbor 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 withdata/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.envasSUTRA_DB_PASSWORD, readable by this server's account only, apart from the address.
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.
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.
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.
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 is | The 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 lost | The 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 it | With 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. |
| Cluster | Every 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. |
| Backup | Keep 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 one | Not 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.
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-runchecks 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.keyanddata/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
| Server | Samples | Why |
|---|---|---|
| A designer's own machine, training, a proof of concept | Add | Working 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 server | Add when the team learns from them; remove before the server is used for acceptance tests | Their Sutras, connections and sample_ tables sit beside the team's work and can be removed in one go. |
| Production | Do not add | Nothing 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 live | Remove | sutraflow samples list, check the list, then sutraflow samples remove, or choose Remove on the upgrade's Review page. |
| A server upgraded with samples kept | Refresh when the new samples are wanted | Samples 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 thesample_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 collectionsutraflow_sample_orders, counterssample-..., the foldervalidation-samples, the sample documents and script,C:/sutra/samples,inboxandoutbox, andoutbox/orders.csvandarchive/orders-*.csvon 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.comhost, no password) are skipped.
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.
- Unpack
sutraflow-2.1.8-windows-x64-offline.zipanywhere else, for exampleC:\SutraFlow-2.1.8. - From that folder run
bin\sutraflow.cmd upgrade. The upgrade pages open in the browser. - On Installation give
C:\laragon\www\sutraand choose Check: it shows 2.1.7, its PostgreSQL database and data folder. - 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. - When Done says 2.1.7 to 2.1.8, SutraFlow answers on 4810 again with the new version.
C:\SutraFlow-2.1.8can be deleted; 4810 keeps running fromC:\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:
| Setting | At installation | Later |
|---|---|---|
| Cluster name | Cluster page | Engines, Rename the cluster; sutra engines cluster-name "Shop cluster" |
| Engine names people read | Cluster page | Engines, Rename; sutra engines name <id> "Shop engine 2" |
Engine id (SUTRA_ENGINE_ID) | Cluster page | Stays: the steps an engine ran record it. Only its display name changes |
| May lead | Cluster page | Engines, Never lead / May lead; sutra engines lead <engine> --yes|--no |
| Node memory of each engine | Server and Cluster pages | Engines, Tuning, Node memory, then Restart |
| An engine beside the studio | Server page | Its ports in sutraflow.env (ENGINE_PORT, ENGINE_GATEWAY_HTTP, ENGINE_GATEWAY_HTTPS), then sutraflow start engine |
| An engine on another machine | Cluster page writes its settings file | Install 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.
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).
What the upgrade does
- Snapshot of the data: every table's row count and a checksum, read without changing anything.
- 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).
- 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.
- Backup into
backups/<old version>-<time>: the data folder withmaster.key,sutraflow.env, and for PostgreSQL apg_dumpthat is read back withpg_restore --listbefore anything changes (a backup that cannot be read stops the upgrade here). Withoutpg_dumpon the machine, SutraFlow copies the database itself. - 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.envand a site's own.htaccessandweb.configstay where they are. - New settings are added to
sutraflow.envwith their defaults; your values are kept. - Database changes of the new version, then Compare the data with the snapshot: every table must hold what it held.
- Samples (when chosen): removed, added or refreshed; a problem here is reported and the upgrade is kept.
- Start and Check: the studio, and the engine beside it if it was running, start again and must answer with the new version.
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.htaccessorweb.configstay; 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 itspackage.jsonandsutraflow.envare 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
- Stop gracefully:
sutraflow stop all. - Back up the data folder (with
master.key) and, for PostgreSQL, the database (pg_dump -Fc). - Unpack the new release beside the old one; bring over
sutraflow.envand the data folder (or keepSUTRA_DATA_DIRpointing at it). sutraflow setup(installs the runtime packages unless the release is offline), thensutraflow start. The database is upgraded at start.
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.
- Install Laragon (the full edition) and click Start All.
- Unpack a release into
C:\laragon\www\sutraand runbin\sutraflow.cmd install; or copydeploy/laragon/sutraflow.envbeside it for the usual Laragon layout: studio on 4810 (gateway 8090), engine on 4811 (gateway 8091), data inC:\laragon\data\sutraflowoutside the web folder. - For
http://sutra.test, copydeploy/laragon/01-sutra.conftoC:\laragon\etc\apache2\sites-enabled: it loads Apache's proxy modules and forwards the name to the studio. - Let Laragon start it: Menu > Procfile, add
SutraFlow: autorun C:\laragon\www\sutra\bin\sutraflow.cmd start --foreground PWD=www/sutra. - 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:
- Find the version: in Laragon's terminal run
postgres -V(for example 18). - 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.
- Stop PostgreSQL in Laragon; copy
lib\vector.dllintoC:\laragon\bin\postgresql\<version>\lib\and the files ofshare\extension\intoC:\laragon\bin\postgresql\<version>\share\extension\; start it again. - Check:
SELECT name, default_version FROM pg_available_extensions WHERE name = 'vector';returns a row. The installer's Test connection then enables it.
Linux
| Part | Debian / Ubuntu | Fedora / RHEL |
|---|---|---|
| Node.js 24 | Through nvm (nvm install 24), or the NodeSource packages. | |
| MySQL or MariaDB | sudo apt install mariadb-server | sudo dnf install mariadb-server |
| PostgreSQL | sudo apt install postgresql (newer versions from the PostgreSQL apt repository) | sudo dnf install postgresql-server, then sudo postgresql-setup --initdb |
| pgvector | sudo apt install postgresql-<version>-pgvector | sudo 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.
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 type | How to run it |
|---|---|
| Windows PowerShell, in the SutraFlow folder | bin\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 Prompt | bin\sutraflow status, or sutraflow status in bin |
| Linux and macOS | bin/sutraflow status, or ./sutraflow status in bin |
| Anywhere | sutraflow status, once bin is on the PATH or after npm install -g |
| Command | Does |
|---|---|
install, upgrade | The web installer or the upgrade pages; with --config file.json silently (The web installer, Upgrading) |
start, start engine | The 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 all | Graceful: 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 |
service | A 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.
| Variable | Default | Meaning |
|---|---|---|
SUTRA_MODE | studio | studio, or engine (headless) |
SUTRA_ENVIRONMENT | development (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 | ./data | Database file, vault key, logs |
SUTRA_DB, SUTRA_DB_PASSWORD | SQLite | postgres://user@host:5432/db and its password, kept apart |
SUTRA_MASTER_KEY | the key file | The vault key, base64 32 bytes; the same on every engine |
SUTRA_ADMIN_HOST, SUTRA_ADMIN_PORT | 127.0.0.1, 4800 | Studio and admin API (STUDIO_PORT, ENGINE_PORT in sutraflow.env) |
SUTRA_GATEWAY_HTTP_PORT, SUTRA_GATEWAY_HTTPS_PORT | 8080, 8443 | Gateway, 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_ID | computer name | This engine's name in a cluster (STUDIO_ENGINE_ID, ENGINE_ENGINE_ID) |
SUTRA_CAN_LEAD | 1 | 0: this engine never leads (also May lead in Engines) |
STUDIO_MEMORY_MB, ENGINE_MEMORY_MB | 0 | Node memory of each process; 0 lets Node.js decide |
SUTRA_WORKERS | by machine | Steps run at once (4 on 1 vCPU / 1 GB up to 32 on 8 cores); 0 serves only, running no steps |
SUTRA_MEMORY_WORKERS | 0 | Steps at once for Sutras that run in memory; 0 means the same as SUTRA_WORKERS |
SUTRA_VISITOR_DAYS | 30 | How long a chat visitor's signed identity lasts (agent channels without a policy); renewed while the visitor keeps coming back. |
SUTRA_STREAM_BUFFER_MB | 8 | A 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_MS | by machine | How often an idle engine looks for due steps (200 to 500 ms) |
SUTRA_SETTINGS_REFRESH_MS | by machine | How long an engine keeps Project and Engine properties; 0 reads them again for every step |
SUTRA_PG_POOL | half of SUTRA_WORKERS (4 to 20) | Connections of an engine's PostgreSQL pool; keep engines × (pool + 1) under max_connections |
SUTRA_PG_NOTIFY | 1 | 0: 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_MS | 65000 | Idle connections kept by the admin and gateway servers; above the idle time of a load balancer in front |
SUTRA_HEARTBEAT_MS, SUTRA_DRAIN_MS | 5000, 30000 | Heartbeat (dead after three missed); time running steps get on shutdown |
SUTRA_RUN_RETENTION_DAYS, SUTRA_AUDIT_RETENTION_DAYS | 30, 365 | Delete finished runs and audit entries after so many days; 0 keeps them |
SUTRA_DESIGN_RUN_RETENTION_DAYS | 7 | Delete 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_STEPS | 60000, 10000 | How long API callers wait for a reply; steps per run |
SUTRA_LOG_FORMAT, SUTRA_METRICS_TOKEN | text, (none) | json: log lines on standard output; bearer token for /metrics |
OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_SERVICE_NAME | (none), sutraflow | OpenTelemetry 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 examplesutraflow, schemapublic. In HeidiSQL or pgAdmin, open that database; the server's other databases (such aspostgres) 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.key | The 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.db | The SQLite database (kept as a backup after a move to PostgreSQL). |
admin-token.txt | A 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
| Table | Holds | Columns |
|---|---|---|
projects | Projects with their variables, logging and deployment config. | id name description config updated_at owner restricted |
flows | Sutra drafts: the document being edited and its latest version number. | id name doc version updated_at project_id folder |
flow_versions | Published, unchangeable versions of each Sutra. Grows: one row per published version; kept for rollback. | flow_id version doc note created_at |
deployments | Which version of each Sutra is deployed, and whether it is enabled. | flow_id version enabled deployed_at tuning |
resources | Connections, security profiles, API policies, AI providers and MCP servers (secret names only). | id kind name config updated_at folder project_id |
schemas | Shared schemas and WSDLs of each project. | id project_id name kind root text updated_at folder |
folders | Explorer 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 |
counters | Counter activity values per project. | project_id name value updated_at |
mem_rows | The 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_meta | Per 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
| Table | Holds | Columns |
|---|---|---|
runs | One 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 |
tasks | One 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_permits | One 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_waits | Steps 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_usage | Samples 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_outputs | The 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 |
payloads | Large 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_votes | Each 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
| Table | Holds | Columns |
|---|---|---|
package_deployments | Package 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 |
engines | Engines 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 |
leases | Cluster-wide locks with an expiry: the leader lease and the deploy-folder lock. | name holder expires_at |
file_listener_state | One 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_files | The 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_messages | Durable 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
| Table | Holds | Columns |
|---|---|---|
users | People 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 |
roles | Built-in and custom roles with their permissions. | id name description perms builtin updated_at |
grants | Which role each account holds, for all projects (empty project) or one project. | username role_id project_id |
api_tokens | API 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_states | One-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 |
audit | Audit 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
| Table | Holds | Columns |
|---|---|---|
secrets | The vault: encrypted values with their IV and tag. Encrypted: every value. | name iv tag data updated_at project_id |
settings | Server 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
| Table | Holds | Columns |
|---|---|---|
gw_apps | Gateway apps: name, contact, scopes, plan, disabled. | id name description contact plan_id scopes disabled created_at updated_at |
gw_keys | API 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_plans | Gateway 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_usage | Requests 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_requests | The 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_guard | Signatures 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_challenges | Short-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_connections | Open 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_outbox | Messages 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
| Table | Holds | Columns |
|---|---|---|
alert_rules | What 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_channels | Where alerts go: email (an SMTP connection and addresses), webhook (address and signing secret name), or a Sutra. | id name kind config enabled updated_at |
alerts | Alerts: 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
| Table | Holds | Columns |
|---|---|---|
ai_sessions | One 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_memory | Turns 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_queue | Runs waiting for a conversation, in arrival order; the first one holds it. | seq store_id session run_id at |
ai_agent_state | Progress 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_cache | Answers 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_conversations | Conversations 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_knowledge | Passages 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_admin | Server 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_grants | Grants 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_sources | Managed 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_items | What 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_runs | Syncs 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
| Table | Holds | Columns |
|---|---|---|
git_accounts | Git 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_workspaces | Projects 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_ids | Per 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 withoutsutra.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_restorefor 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.
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;), orCREATEDB, so the move makes the database. - Remote servers: PostgreSQL must listen on the network (
listen_addresses), itspg_hba.confmust accept the SutraFlow machine (for examplehostssl 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
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:
| SSL | Use for |
|---|---|
| off | PostgreSQL on this machine or a trusted private network |
| require | Encrypted; the server's certificate is not checked. Servers with their own (self-signed) certificate |
| verify | Encrypted 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:
- SutraFlow stops gracefully: no new work, running steps finish. Triggers and APIs pause for about a minute.
- Every table is copied to PostgreSQL (the database is made when missing), and the rows of every table are counted on both sides.
sutraflow.envgetsSUTRA_DB=postgres://user@host:5432/sutraflowand the password apart asSUTRA_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.- SutraFlow starts again (and the engine, when it was running) and must answer on PostgreSQL.
- If the copy or the start fails, the old
sutraflow.envis 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_PASSWORDand 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
| Endpoint | Purpose |
|---|---|
GET /health | Liveness: the process answers |
GET /ready | Readiness: storage answers, packages are deployed, the gateway listens, not draining; 503 with reasons otherwise. The health check for load balancers |
GET /metrics | Prometheus 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};stageisdesignorruntime, so dashboards can leave out tests withstage="runtime"sutra_steps_total{activity,outcome}(done, error handled by an error output, failed),sutra_step_duration_seconds,sutra_step_retries_totalsutra_gateway_requests_total{kind,status},sutra_gateway_request_duration_secondssutra_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'straceparentis continued and every gateway answer carries the run's. SUTRA_LOG_FORMAT=jsonwrites 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
/readyon 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. /metricsshows the pool:sutra_db_pool_connections,sutra_db_pool_waiting(transactions waiting for a connection),sutra_db_pool_acquire_msandsutra_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=0runs the engine through one synchronous connection: a fallback, several times slower.- PostgreSQL
LISTEN/NOTIFYwakes engines when committed work enters the durable queue. Polling remains active as the correctness fallback. SetSUTRA_PG_NOTIFY=0only 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:
- reports not ready, so load balancers stop sending it requests;
- hands leadership over;
- lets running steps finish for
SUTRA_DRAIN_MS, and hands the rest back to the queue for another engine; - closes.
Monitoring
| What | Where |
|---|---|
| Liveness and readiness | /health, /ready on the admin port |
| Metrics | /metrics (Prometheus): runs, steps by outcome, retries, durations, gateway requests, queue, leader, listeners |
| Traces | Set OTEL_EXPORTER_OTLP_ENDPOINT: each run is a trace with a span per step, continuing a caller's traceparent |
| Logs | SUTRA_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
- Set
SUTRA_MASTER_KEYfrom your secret store, the same on every engine. - 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. - Set a long
SUTRA_ADMIN_TOKEN; give it only to the release pipeline. - Set the gateway certificate and require HTTPS in every API policy.
- Put environment-specific values in the deployment config, with
${env:NAME}for anything secret or host-specific. - Release with packages; keep the files, they are your rollback.
- Back up the database (or the
datafolder).
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 engine | The 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 A2A | Listeners: 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 callers | Recovery: steps of an engine that stopped are put back in the queue for the others |
| Writes a heartbeat every 5 seconds | Run time limits, queued runs, alerts (every 30 seconds) and housekeeping (old runs, logs, audit) |
| Reloads deploys and settings on its next heartbeat | Forgetting 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).
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
| Setting | On every process |
|---|---|
SUTRA_DB | The same PostgreSQL address (postgres://user@host:5432/sutraflow), with SUTRA_DB_PASSWORD when it needs a password. |
SUTRA_MASTER_KEY | The 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_ID | Different 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_TOKEN | Optional; the same long token lets one release pipeline talk to every engine. |
SUTRA_CAN_LEAD | 0 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_POOL | Optional: connections per engine. Keep processes × (pool + 1) under PostgreSQL's max_connections. |
SUTRA_PG_NOTIFY | PostgreSQL queue wake hint (default on). Set to 0 to use polling alone; polling always remains enabled. |
Before you start: PostgreSQL
- 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).
- Create a database and a user:
CREATE USER sutra_owner PASSWORD '...'; CREATE DATABASE sutraflow OWNER sutra_owner; - Allow the engine machines in
pg_hba.conf(withscram-sha-256), and turn SSL on for anything that crosses a network. - 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.
- Install SutraFlow with PostgreSQL and A headless engine beside it (The web installer), or set
SUTRA_DBinsutraflow.envof an existing installation to the PostgreSQL address. - Start the studio:
sutraflow start. It listens on 4800, its gateway on 8080 and 8443. - 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). - Check:
sutraflow status, or Admin Console → Engines: two engines alive, one marked leader. - Point your load balancer (or Apache or nginx on the same machine) at both gateways: 8080 and 9080, health check
/readyon 4800 and 4801. - Start both with the machine:
sutraflow serviceprints 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
- On machine A, set up layout 1, or just the studio.
- Copy
data/master.keyfrom machine A (or setSUTRA_MASTER_KEYon both). - On machine B, install SutraFlow, and in its
sutraflow.envset the sameSUTRA_DBandSUTRA_MASTER_KEY, andSUTRA_ADMIN_HOST=0.0.0.0only if a load balancer checks its/readyfrom another machine. - 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. - Check Admin Console → Engines on A: the engines of both machines are listed.
- Add B's gateway (9080, 9443) to the load balancer.
- Folder triggers: the leader may be either machine. Make the watched folders reachable from both (a shared drive), or set
SUTRA_CAN_LEAD=0on 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.
- Keep the studio on a design or test server; build releases there (Releases) or from Git in a pipeline (CI/CD).
- On each production machine install SutraFlow with the same
SUTRA_DB(the production database) andSUTRA_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. - Create the first administrator for the engines' Admin Console:
sutraflow cli user add admin --role administrator. - Deploy a release:
sutra deploy release.zipagainst any engine (with its admin token), or drop the package inSUTRA_DEPLOY_DIR; every engine loads it. - 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
| Need | Layout |
|---|---|
| One server, more throughput, restarts without downtime | 1: studio and engine on one machine |
| Survive the loss of a machine | 2 or 3, with PostgreSQL replicated or managed |
| Separate design from production | 3: engines only in production |
| Containers or Kubernetes | 4: 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 statusorGET /api/engine/status: the same as JSON./metrics:sutra_engine_leaderis 1 on exactly one engine;sutra_engines_alivecounts the others.- To restart an engine without losing work:
sutraflow stop enginedrains it (running steps finish or go back to the queue), then start it again.
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 open | The database | A private in-memory database of the engine |
| Written to the database | Every step | Once, when the run ends: the run and all its steps |
| A restart or crash while the run is open | The run carries on, on this engine or another | The run is lost (the caller gets an error or no answer) |
| Waits: approvals, Ask a person, Call Sutra with wait | Yes | No: the tuning is refused, or the step fails with the reason |
| Wait steps, timers, retries with a delay | Yes | Yes, within the engine |
| Run history, logs, resubmit | Yes | Yes, once the run has ended |
| Seen in Runs while open, cancel | Yes | Cancel yes; the run shows up in Runs when it ends |
| Small steps per second, one engine (measured below) | about 120 on PostgreSQL, 520 on SQLite | about 460 on PostgreSQL, 680 on SQLite |
| Which engine runs it | Any engine of the cluster takes the next step | The 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.
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.
| Profile | Machine | Steps at once | Queue check | Engines (PostgreSQL) | Node memory per engine | Read files whole up to | Rows per streamed batch | Database |
|---|---|---|---|---|---|---|---|---|
| Small | 1 vCPU, 1 GB | 4 | 500 ms | 1 | 384 MB | 10 MB | 500 | SQLite |
| Small plus | 2 vCPU, 2 to 4 GB | 8 | 250 ms | 1 | 1024 MB | 25 MB | 1000 | SQLite; PostgreSQL on another machine for a cluster |
| Medium | 4 vCPU, 8 GB | 16 | 250 ms | 2 | 2048 MB | 50 MB | 2000 | SQLite for one engine at moderate load; PostgreSQL for a busy server or several engines |
| Large | 8 vCPU, 16 GB | 32 | 200 ms | 4 | 3072 MB | 100 MB | 5000 | PostgreSQL for a busy server or several engines; SQLite for a moderate load |
| Very large | 16 vCPU or more, 32 GB or more | 32 | 200 ms | 8 | 4096 MB | 200 MB | 5000 | PostgreSQL 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, asSTUDIO_MEMORY_MBorENGINE_MEMORY_MBinsutraflow.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 setNODE_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 when | Use 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 day | You need failover: another engine takes over when one stops |
| Request-reply APIs and short Sutras at moderate volume | Runs must survive the loss of the whole machine (PostgreSQL replicated or managed) |
| Steady load up to a few hundred steps a second | A 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 feed | Your company requires databases to be run, backed up and monitored by its DBAs |
| Development, testing, demos, edge sites, departments | Run 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 withmaster.keykept apart. - When you outgrow it (several engines, failover), the move to PostgreSQL is one button: see Moving to PostgreSQL. Nothing in the Sutras changes.
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
| Machine | Good for | Avoid |
|---|---|---|
| 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 GB | A 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 GB | Production 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 GB | Heavy 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 more | A 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
| Setting | Where | Effect |
|---|---|---|
| Steps at once | Engine tuning; SUTRA_WORKERS | Steps 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 memory | Engine tuning; SUTRA_MEMORY_WORKERS | The same for Sutras that run in memory; 0 means the same as Steps at once. |
| Queue check | Engine tuning; SUTRA_POLL_MS | How 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 refresh | Engine tuning; SUTRA_SETTINGS_REFRESH_MS | How 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). |
| Execution | Sutra tuning | Durable or in memory (above). |
| Runs at once, Priority | Sutra tuning | Protect a slow back end; let urgent Sutras go first. |
| Step data in history | Sutra tuning | none or errors only keeps the database small for busy Sutras. |
| Keep finished runs | Engine and Sutra tuning | Fewer 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.
| Execution | Engines | Output per step | Steps/s | Runs/s | Step ms p50 / p95 / p99 | Queue wait p95 ms | Run p95 ms | Engine CPU (cores) | Engine memory | Failed | Repeated |
|---|---|---|---|---|---|---|---|---|---|---|---|
| durable | 1 | 0.1 KB | 719 | 65.4 | 0 / 1 / 2 | 68 | 502 | 1.11 | 348 MB | 0 | 0 |
| durable | 2 | 0.1 KB | 1267.8 | 115.3 | 0 / 1 / 2 | 10 | 293 | 2.27 | 297 MB | 0 | 0 |
| durable | 4 | 0.1 KB | 1601.9 | 145.6 | 0 / 1 / 2 | 4 | 196 | 3.75 | 244 MB | 0 | 0 |
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.
| Execution | Engines | Output per step | Steps/s | Runs/s | Step ms p50 / p95 / p99 | Queue wait p95 ms | Run p95 ms | Engine CPU (cores) | Engine memory | Failed | Repeated |
|---|---|---|---|---|---|---|---|---|---|---|---|
| durable | 1 | 0.1 KB | 152.8 | 13.9 | 2 / 3 / 3 | 2 | 77 | 0.44 | 202 MB | 0 | 0 |
| durable | 2 | 0.1 KB | 284 | 25.8 | 3 / 14 / 20 | 4 | 170 | 0.86 | 254 MB | 0 | 0 |
| durable | 4 | 0.1 KB | 457 | 41.5 | 9 / 33 / 51 | 5 | 297 | 1.57 | 233 MB | 0 | 0 |
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.
| Execution | Engines | Output per step | Steps/s | Runs/s | Step ms p50 / p95 / p99 | Queue wait p95 ms | Run p95 ms | Engine CPU (cores) | Engine memory | Failed | Repeated |
|---|---|---|---|---|---|---|---|---|---|---|---|
| durable | 1 | 0.1 KB | 101.9 | 9.3 | 0 / 1 / 30 | 546 | 3679 | 0.2 | 311 MB | 0 | 0 |
| durable | 4 | 0.1 KB | 621.6 | 56.5 | 1 / 1 / 4 | 18 | 476 | 1.81 | 186 MB | 0 | 0 |
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.
| Execution | Engines | Output per step | Steps/s | Runs/s | Step ms p50 / p95 / p99 | Queue wait p95 ms | Run p95 ms | Engine CPU (cores) | Engine memory | Failed | Repeated |
|---|---|---|---|---|---|---|---|---|---|---|---|
| durable | 1 | 0.1 KB | 3.4 | 0.3 | 76 / 140 / 163 | 88 | 3459 | 0.03 | 140 MB | 0 | 0 |
| durable | 4 | 0.1 KB | 17.7 | 1.6 | 239 / 814 / 1161 | 120 | 7516 | 0.15 | 140 MB | 0 | 125 |
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.
| Execution | Engines | Output per step | Steps/s | Runs/s | Step ms p50 / p95 / p99 | Queue wait p95 ms | Run p95 ms | Engine CPU (cores) | Engine memory | Failed | Repeated |
|---|---|---|---|---|---|---|---|---|---|---|---|
| durable | 1 | 64 KB | 60 | 5.5 | 7 / 18 / 24 | 714 | 6061 | 1.06 | 481 MB | 0 | 0 |
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.
| Execution | Engines | Output per step | Steps/s | Runs/s | Step ms p50 / p95 / p99 | Queue wait p95 ms | Run p95 ms | Engine CPU (cores) | Engine memory | Failed | Repeated |
|---|---|---|---|---|---|---|---|---|---|---|---|
| durable | 1 | 0.1 KB | 82.4 | 7.5 | 3 / 4 / 5 | 0 | 137 | 0.54 | 199 MB | 0 | 0 |
| durable | 2 | 0.1 KB | 82.4 | 7.5 | 3 / 14 / 24 | 0 | 236 | 0.57 | 185 MB | 0 | 0 |
| durable | 4 | 0.1 KB | 90 | 8.2 | 4 / 22 / 33 | 0 | 303 | 0.66 | 250 MB | 0 | 0 |
| durable | 1 | 64 KB | 35.6 | 3.2 | 4 / 8 / 13 | 0 | 342 | 0.54 | 591 MB | 0 | 0 |
| durable | 2 | 64 KB | 38.8 | 3.5 | 5 / 48 / 73 | 0 | 769 | 0.63 | 611 MB | 0 | 0 |
| durable | 4 | 64 KB | 45.7 | 4.2 | 6 / 61 / 93 | 0 | 817 | 0.86 | 537 MB | 0 | 0 |
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.
| Execution | Engines | Output per step | Steps/s | Runs/s | Step ms p50 / p95 / p99 | Queue wait p95 ms | Run p95 ms | Engine CPU (cores) | Engine memory | Failed | Repeated |
|---|---|---|---|---|---|---|---|---|---|---|---|
| durable | 1 | 0.1 KB | 123.9 | 11.3 | 2 / 3 / 4 | 3 | 94 | 0.53 | 322 MB | 0 | 0 |
| durable | 2 | 0.1 KB | 131.7 | 12 | 2 / 17 / 77 | 4 | 293 | 0.6 | 250 MB | 0 | 0 |
| durable | 4 | 0.1 KB | 152.8 | 13.9 | 2 / 61 / 84 | 5 | 519 | 0.8 | 247 MB | 0 | 0 |
| durable | 1 | 64 KB | 47 | 4.3 | 3 / 5 / 10 | 14 | 263 | 0.53 | 535 MB | 0 | 0 |
| durable | 2 | 64 KB | 51 | 4.6 | 3 / 67 / 96 | 18 | 793 | 0.61 | 559 MB | 0 | 0 |
| durable | 4 | 64 KB | 56.3 | 5.1 | 4 / 53 / 93 | 21 | 641 | 0.79 | 583 MB | 0 | 0 |
| memory | 1 | 0.1 KB | 455.4 | 41.4 | 0 / 1 / 1 | 2 | 17 | 0.8 | 332 MB | 0 | 0 |
| memory | 2 | 0.1 KB | 476 | 43.3 | 0 / 1 / 1 | 2 | 19 | 0.9 | 221 MB | 0 | 0 |
| memory | 4 | 0.1 KB | 480.8 | 43.7 | 0 / 1 / 1 | 2 | 19 | 0.9 | 232 MB | 0 | 0 |
| memory | 1 | 64 KB | 111.5 | 10.1 | 1 / 2 / 10 | 2 | 74 | 0.75 | 639 MB | 0 | 0 |
| memory | 2 | 64 KB | 112.9 | 10.3 | 1 / 2 / 4 | 2 | 72 | 0.8 | 583 MB | 0 | 0 |
| memory | 4 | 64 KB | 112 | 10.2 | 1 / 2 / 3 | 2 | 74 | 0.8 | 593 MB | 0 | 0 |
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.
| Execution | Engines | Output per step | Steps/s | Runs/s | Step ms p50 / p95 / p99 | Queue wait p95 ms | Run p95 ms | Engine CPU (cores) | Engine memory | Failed | Repeated |
|---|---|---|---|---|---|---|---|---|---|---|---|
| durable | 1 | 0.1 KB | 116.3 | 10.6 | 2 / 3 / 4 | 3 | 97 | 0.52 | 205 MB | 0 | 0 |
| durable | 2 | 0.1 KB | 229.3 | 20.8 | 5 / 18 / 24 | 5 | 217 | 1.05 | 250 MB | 0 | 0 |
| durable | 4 | 0.1 KB | 352.2 | 32 | 11 / 38 / 56 | 6 | 350 | 1.73 | 231 MB | 0 | 0 |
| memory | 1 | 0.1 KB | 544.3 | 49.5 | 0 / 1 / 1 | 1 | 14 | 0.9 | 309 MB | 0 | 0 |
| memory | 2 | 0.1 KB | 983.3 | 89.4 | 0 / 1 / 1 | 1 | 19 | 1.79 | 259 MB | 0 | 0 |
| memory | 4 | 0.1 KB | 1662.9 | 151.2 | 0 / 1 / 2 | 1 | 23 | 3.68 | 186 MB | 0 | 0 |
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.
| Execution | Engines | Output per step | Steps/s | Runs/s | Step ms p50 / p95 / p99 | Queue wait p95 ms | Run p95 ms | Engine CPU (cores) | Engine memory | Failed | Repeated |
|---|---|---|---|---|---|---|---|---|---|---|---|
| durable | 1 | 0.1 KB | 118.3 | 10.8 | 2 / 3 / 4 | 3 | 103 | 0.56 | 266 MB | 0 | 0 |
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.
| Execution | Engines | Output per step | Steps/s | Runs/s | Step ms p50 / p95 / p99 | Queue wait p95 ms | Run p95 ms | Engine CPU (cores) | Engine memory | Failed | Repeated |
|---|---|---|---|---|---|---|---|---|---|---|---|
| durable | 1 | 0.1 KB | 97 | 8.8 | 2 / 5 / 7 | 4 | 130 | 0.39 | 313 MB | 0 | 0 |
| durable | 1 | 64 KB | 35 | 3.2 | 4 / 8 / 19 | 26 | 362 | 0.42 | 435 MB | 0 | 0 |
| memory | 1 | 0.1 KB | 336.2 | 30.6 | 0 / 1 / 3 | 2 | 27 | 0.64 | 276 MB | 0 | 0 |
| memory | 1 | 64 KB | 75.2 | 6.8 | 2 / 5 / 22 | 4 | 165 | 0.51 | 422 MB | 0 | 0 |
SQLite, one engine
SQLite; SQLite; Node v24.21.0; 300 runs of 10 steps plus the trigger, 16 steps at once per engine.
| Execution | Engines | Output per step | Steps/s | Runs/s | Step ms p50 / p95 / p99 | Queue wait p95 ms | Run p95 ms | Engine CPU (cores) | Engine memory | Failed | Repeated |
|---|---|---|---|---|---|---|---|---|---|---|---|
| durable | 1 | 0.1 KB | 521.2 | 47.4 | 0 / 1 / 1 | 1 | 23 | 0.94 | 264 MB | 0 | 0 |
| durable | 1 | 64 KB | 88.4 | 8 | 1 / 3 / 14 | 17 | 137 | 0.99 | 468 MB | 0 | 0 |
| memory | 1 | 0.1 KB | 680.8 | 61.9 | 0 / 1 / 1 | 1 | 15 | 0.99 | 278 MB | 0 | 0 |
| memory | 1 | 64 KB | 130.8 | 11.9 | 1 / 2 / 10 | 2 | 71 | 1.01 | 485 MB | 0 | 0 |
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.
| Execution | Engines | Output per step | Steps/s | Runs/s | Step ms p50 / p95 / p99 | Queue wait p95 ms | Run p95 ms | Engine CPU (cores) | Engine memory | Failed | Repeated |
|---|---|---|---|---|---|---|---|---|---|---|---|
| durable | 1 | 0.1 KB | 364.7 | 33.2 | 1 / 2 / 4 | 2 | 38 | 0.73 | 223 MB | 0 | 0 |
| durable | 1 | 64 KB | 64 | 5.8 | 2 / 8 / 25 | 24 | 240 | 0.62 | 311 MB | 0 | 0 |
| memory | 1 | 0.1 KB | 751.4 | 68.3 | 0 / 1 / 2 | 1 | 17 | 0.77 | 237 MB | 0 | 0 |
| memory | 1 | 64 KB | 93.5 | 8.5 | 2 / 4 / 18 | 4 | 165 | 0.53 | 312 MB | 0 | 0 |
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
| Word | What it is | For SutraFlow |
|---|---|---|
| Image | A 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. |
| Container | A 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. |
| Volume | A 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 variables | Settings given to a container when it starts. | SUTRA_MODE, SUTRA_DB, SUTRA_MASTER_KEY, SUTRA_ADMIN_TOKEN, SUTRA_ENGINE_ID |
| Registry | A store for images that servers pull from. | GitHub (GHCR) for the official image; your own (Docker Hub, Azure, AWS, Google, Harbor, GitLab) for copies. |
| Compose | A 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) |
| Kubernetes | Runs containers over several machines: restarts them when they fail, spreads them, adds more under load. | deploy/kubernetes |
| Pod, Deployment | A 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, Ingress | A 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, ConfigMap | Settings 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 image | Not in the image (it stays per environment) |
|---|---|
The SutraFlow program (studio, engine, gateway, Admin Console, the sutra command), Node.js 24, the guides, the samples | Your 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 changes | New image? | What to do instead |
|---|---|---|
| A new Sutra, or a new version of one | No | Deploy a release (Adding an application) |
| A new project (application) | No | Deploy its release; apply its config file |
| A connection, property or secret | No | sutra config apply, or the Admin Console |
| Number of engines | No | Start more containers from the same image |
| A new SutraFlow version | Yes: its tag | Pull or build sutraflow:<new version>, then upgrade (below) |
| Your company's CA certificates, fonts, an extra tool | Optional | Mount them as files, or build your own image FROM sutraflow:2.1.8 |
Making the image
Pick one. They give the same image.
| Way | Commands | When |
|---|---|---|
| Pull the official one | docker pull ghcr.io/spinny007/sutraflow:2.1.8 | The server can reach GitHub. Signed; deploy/docker/README.md has the cosign verify command. |
| Build from a release package | Unpack 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 folder | docker 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 internet | sutraflow image save sutraflow-2.1.8.tar, copy the file, then on the server docker load -i sutraflow-2.1.8.tar | Closed networks. |
| Put it in your registry | docker tag sutraflow:2.1.8 registry.example.com/sutraflow:2.1.8 then docker push registry.example.com/sutraflow:2.1.8 | Kubernetes 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
- Make the image (above) and check it is there:
docker images sutraflow. - 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 - Open
http://localhost:4800. The first visit creates the administrator, as with the web installer. - Design and run a Sutra as usual. Its REST services answer on
http://localhost:8080. - Stop it with
docker stop sutra-studio(it drains: running steps finish first) and start it again withdocker start sutra-studio. The data is in thesutra-studiovolume, sodocker rmand a newdocker runwith 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.
- Remove an old image (only if there is one). Stopped containers made from it go first (
docker rm <name>); their volumes stay.docker imagesthendocker rmi sutraflow:2.1.8
- Pull the image. It is public: no sign-in.
docker pull ghcr.io/spinny007/sutraflow:2.1.8
- Make a folder with
compose.yml(fromdeploy/dockerin the release package) and an emptydeploy-dropfolder:New-Item -ItemType Directory -Force C:\sutra-production\deploy-dropCopy-Item <package>\deploy\docker\compose.yml C:\sutra-production\ - Write
.envbeside 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.
$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 24andopenssl rand -base64 32. Add the rest fromenv.example: the image, the version, the environment name and the ports.
The master key, before the first start:
- Make it once per environment (development, test and production each have their own) and put it in
.envbeforedocker compose up: the engine encrypts every secret with it from the first one on. - Check it:
[Convert]::FromBase64String("<key>").Lengthmust answer32. - 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.
| Setting in .env | Default | What it is |
|---|---|---|
SUTRA_STUDIO_PORT | 4800 | The studio: designer, Admin Console, Approval Center |
SUTRA_STUDIO_GATEWAY_PORT | 8080 | The studio's gateway (REST and SOAP services while designing) |
SUTRA_ENGINE_PORT | 4801 | The engine's Admin Console and admin API |
SUTRA_ENGINE_GATEWAY_PORT / SUTRA_ENGINE_GATEWAY_TLS_PORT | 9080 / 9443 | The engine's gateway, HTTP and HTTPS: what callers of your APIs use |
SUTRA_ENVIRONMENT | production | The engine's environment name, shown in the console and the logs |
COMPOSE_PROJECT_NAME | the folder name | Prefix of the containers and volumes (sutraflow-production-engine-1) |
- Start it in that folder:
docker compose up -d
- Check it:
docker compose psshows both healthy, and/readyanswers on each port.
- The studio: create the administrator. Open
http://localhost:4900/. The first visit asks for the administrator: a name and a password (twice).
The designer (the editor) opens at once, signed in. It is only in the studio.
The Admin Console is at http://localhost:4900/admin, with the same sign-in.
- 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
- Sign in to the engine's Admin Console at
http://localhost:4901/adminwith that name and password.
The first sign-in asks for a password only the administrator knows (skipped when the account was made with --keep-password).
- 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
.envcannot.docker compose exec engine sutra user add ci-deployer --system --role deployerdocker compose exec engine sutra token create ci-deployer --name pipeline --expires-days 90
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:
| Page | Studio (4900) | Engine (4901) |
|---|---|---|
| Designer (editor) | http://localhost:4900/ | Not there: / answers 404 |
| Admin Console | http://localhost:4900/admin | http://localhost:4901/admin |
| Approval Center (business people) | /approvals | /approvals |
| Guides | /guide, /admin-guide, /design-guide, /architecture | The same |
| Gateway (callers of your APIs) | HTTP 4980 | HTTP 4990, HTTPS 4943 |
| First administrator | Sign in | |
|---|---|---|
| Studio | Asked for on the first visit (Create the administrator); signed in at once | The same name and password for the designer and its Admin Console |
| Engine | Made 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_PWdocker compose exec engine sutra user unlock admin
People, system accounts and roles in containers
| Kind | Who | Signs in with |
|---|---|---|
| Person | Someone who opens the studio or a console | Name and password |
| System account | A pipeline, a script, another system | An API token (no password) |
| Role | What it may do |
|---|---|
administrator | Everything, including users, roles and server settings |
developer | Design and test Sutras and connections |
deployer | Deploy packages and Sutras, roll back |
operator | Run production: runs, approvals, engines, gateway, alerts, audit |
approver | Decide approvals |
viewer | Read what it is granted, change nothing (a person's default) |
apiCaller | Call 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.
| Task | Command |
|---|---|
| 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 accounts | docker compose exec engine sutra user list |
| A new password | docker compose exec -e NEW_PW="<new password>" engine sutra user password priya --password-from-env NEW_PW |
| Locked after wrong passwords | docker compose exec engine sutra user unlock priya |
| A lost laptop: end every session | docker compose exec engine sutra user sign-out priya |
A leaver (enable brings them back), or delete | docker compose exec engine sutra user disable priya, ... sutra user delete priya |
| A system account for one project's pipeline | docker 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 tokens | docker 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
.sutrafile in the folder named bySUTRA_DEPLOY_FOLDER(C:\sutra-production\deploy-dropabove), thendocker 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.sutradocker compose exec engine sutra deploy /tmp/orders-1.4.0.sutra --approve <plan id>checklists 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)
| Task | Command, in the install folder |
|---|---|
| Status | docker compose ps, docker compose exec engine sutra status |
| Logs | docker compose logs -f engine |
| Stop (running steps finish first, up to 45 s) | docker compose stop |
| Start again | docker compose up -d |
| Move to other ports | Change the ports in .env, then docker compose up -d |
| Upgrade SutraFlow | Back up, change SUTRA_VERSION in .env, docker compose pull, docker compose up -d (below) |
| Remove the containers, keep the data | docker compose down |
| Remove everything including the data | docker 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
| Command | What it does |
|---|---|
docker ps | Running containers, their ports, and healthy once /health answers |
docker logs -f sutra-studio | A 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 status | Runs 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 restart | Stops gracefully (drains), starts, restarts one container |
docker compose ... up -d / stop / down | Starts everything in a Compose file / stops it / stops and removes the containers (volumes stay unless -v) |
docker volume ls | The volumes, where data outside PostgreSQL lives |
kubectl -n sutraflow-prod get pods | Kubernetes: the engine pods and whether they are ready |
kubectl -n sutraflow-prod logs deploy/sutraflow-engine | Kubernetes: an engine's log |
kubectl -n sutraflow-prod exec deploy/sutraflow-engine -- sutra status | Kubernetes: 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:
- Back up the database (
pg_dump -Fc, or your managed service's snapshot) and keep the master key safe. - Make or pull the new image, for example
sutraflow:2.1.8. - Stop every engine and the studio:
docker compose stop, or in Kuberneteskubectl -n sutraflow-prod scale deploy/sutraflow-engine --replicas=0(and the studio, if any). - Change the tag:
SUTRA_VERSIONin.env, ornewTagin the overlay'skustomization.yaml. - Start:
docker compose up -d, orkubectl 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. - Check:
sutra statusshows 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.
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 from | How |
|---|---|
| The official registry | ghcr.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 registry | Copy the official image, or build on it: FROM ghcr.io/spinny007/sutraflow:2.1.8 |
| A site without internet | sutraflow 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
| What | Who makes it | How it travels | How often |
|---|---|---|---|
| The SutraFlow program | The SutraFlow release | A release package (installer zip or tar.gz) for servers without Docker; the image for containers | When you upgrade SutraFlow |
| The application: a project's Sutras | Designers, in the studio | A release: orders-1.4.0.zip, versioned, built in the studio or from Git | Every version of the application |
| The environment's settings: connections, properties, secrets, gateway, roles | DevOps and administrators | A config file for what every environment has, and an environment file per environment for what differs (hosts, users, secrets), kept in Git | Written once per project; changed when the environment changes |
The database and the master key do not travel: each environment has its own.
The environments
| Stage | Without Docker | With Docker |
|---|---|---|
| Development: designers build and try Sutras | A 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 release | A VPS installed silently (sutraflow install --config install.json) with PostgreSQL; a studio for looking around, or engines only | compose.cluster.yml on one VPS, or Kubernetes overlays/test: one engine and the optional studio |
| Production | Two 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
- Design and try in the development studio: Sutras, their test data, the project's connections pointing at development systems.
- 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. - 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.yamlandconfig/env/prod.yaml, with that environment's hosts and users, and secrets as${env:NAME}(read from the pipeline's secret store) orfile:/run/secrets/name. Add--server-settingsto the export the first time you set up a whole server (gateway options, roles, system accounts, alerts). See Configuration as files. - Test / UAT:
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.sutra config apply config/orders.yaml --env config/env/uat.yaml: creates the missing connections, properties and secrets.sutra check orders-1.4.0.zip: the plan (new, unchanged, replaces, undeployed) and its plan id.sutra deploy orders-1.4.0.zip: asks foryesif something is replaced; in a pipeline--approve <plan id>after the approval gate.- Testers use the APIs, approvals and dashboards on UAT.
- Production: the same four commands with
--env config/env/prod.yamland the sameorders-1.4.0.zip. Never rebuild a release for production: what was tested is what goes live. - 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
| Way | How | Good for |
|---|---|---|
| Admin Console | Releases: 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 pipeline | The 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
sutracommands above. - The first administrator of an engine-only server:
sutra user add admin --role administrator --password-from-env ADMIN_PWon 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 runs | Target runs | Notes |
|---|---|---|
In the SutraFlow image (the files in deploy/ci) | VMs, Docker or Kubernetes | The easiest: sutra is the same version as the server |
| On a runner with Node.js 24 and the release package | VMs, Docker or Kubernetes | Use bin/sutraflow cli from the unpacked package of the server's version |
| Inside Kubernetes | Kubernetes | The 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 |
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
- Tell
sutrawhere the cluster is (once per terminal):SUTRA_SERVER=http://<admin address>,SUTRA_ADMIN_TOKEN=<token>(PowerShell:$env:SUTRA_SERVER = "..."). - 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). - Create them:
sutra config apply billing.yaml --env env/prod.yaml --checklist checklist.md. All or nothing; existing items are kept and listed inchecklist.md. - 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. - Deploy:
sutra deploy billing-1.0.0.zip(typeyeswhen asked), or--approve <plan id>in a pipeline. - 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
| Cluster | Admin address for the steps |
|---|---|
| Docker Compose on one machine | http://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 laptop | kubectl -n sutraflow-prod port-forward svc/sutraflow-engine 4800:4800 in one terminal; then http://localhost:4800 in another |
| Kubernetes, from a pipeline | The Job in deploy/kubernetes/jobs/config-and-deploy.yaml: it runs inside the namespace, with the release address and the approved plan id |
| VMs | Any 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
| Task | How |
|---|---|
| A new version | The same steps with the new zip; the plan lists what it replaces and needs a person's yes |
| Go back to the previous version | Admin Console, Releases: the project's package history, Roll back; or sutra history --project Billing then sutra rollback --project Billing |
| Pause it | Admin Console, Applications, Stop on the Sutra; or sutra sutras stop <sutra> --project Billing (its triggers stop; deployed versions stay) |
| Files it reads or writes | If every engine must see them, a shared volume at /data/files (ReadWriteMany in Kubernetes, a shared drive on VMs) |
| Timers and folder or mailbox listeners | Nothing to do: the leader runs them, once for the 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.
| Cluster | The Admin Console |
|---|---|
| One machine (studio and engine) | http://localhost:4800, or the engine's 4801 |
| VMs | An internal load balancer over every engine's admin port (4801), for example https://sutra-admin.internal |
| Docker Compose | http://localhost:4800 (the studio); to open an engine's too, publish its port 4800 in the Compose file |
| Kubernetes | kubectl -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 stops | What happens | What you do |
|---|---|---|
| Any engine | Its running steps are finished by the others; callers reach the others through the load balancer; the Admin Console shows it as not alive | Nothing; start it again when you can. Kubernetes restarts it by itself. |
| The leader | Its 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 studio | Designers cannot design. Deployed Sutras keep running on the engines; their Admin Consoles keep working. | Start it again; on Kubernetes it restarts by itself. |
| The database | Engines keep running what they can, retry, and report not ready | Restore 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 engines | Round trip | Result |
|---|---|---|
| PostgreSQL 18.2 on the same machine | 0.4 ms | Ready 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 ms | Started, 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
| Question | Answer |
|---|---|
| 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.
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
.sutrapackage): 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).
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
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 tuning | What it does |
|---|---|
| Steps at once | Steps 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 limit | Stops runs that take more steps, such as loops that never end. |
| Reply wait | How long REST, SOAP and MCP callers wait for a reply step. |
| Keep finished runs, Keep audit entries | Days before housekeeping deletes them. |
| Keep design runs | Days before housekeeping deletes finished design runs (tests, debugging, drafts); 7 by default, and 0 keeps them as long as finished runs. |
| Trace sampling | Share of runs sent to the OpenTelemetry collector. |
| Sutra tuning | What it does |
|---|---|
| Runs at once | More runs wait as queued and start, oldest first, when one ends. Protects a slow partner system or a database. |
| Priority | Steps of higher priority Sutras are taken from the shared work queue first. |
| Run time limit | Runs still open after this many minutes are cancelled with an error. |
| Retries, First retry after | For steps whose own settings have no retries. |
| Step data in history | all, errors only (step data is kept only for runs that did not finish well), or none (for personal or bulky data). |
| Keep finished runs | Days for this Sutra, instead of the engine setting. |
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.
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,textandalert; chat tools that read a text field show the message; optionally signed withX-Sutra-Signaturefrom 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.
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:readand a plan. Create keys for it; each is shown once. Callers send a key inX-API-Key, or exchange it for an access token atPOST /oauth/tokenon 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 carriesX-RateLimit-LimitandX-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.jsonand to keep the request log.
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.
| Permission | Allows |
|---|---|
| View | See the project, its Sutras, connections, runs and logs. |
| Design | Edit Sutras, schemas and project settings; test and debug runs. |
| Connections | Add and change connections and API security policies. |
| Deploy | Deploy and undeploy Sutras, deploy packages, roll back, edit the deployment config. |
| Operate | Start, stop, cancel and resubmit; clear runtime variable values. |
| Approve | Decide approvals. |
| Call services | System 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. |
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.
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).
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
| Setting | Search | Add and remove |
|---|---|---|
| Not a server knowledge base | Home project only | Home project only |
| Server, Every project | Every project, the whole base | Home project, and projects granted May add and remove in their areas |
| Server, Granted projects only | Each granted project, in its granted areas | Only 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.
| Reads | Settings | Item |
|---|---|---|
| Files in a server folder | Full path, file names (*.pdf), sub-folders, largest file | The path in the folder |
| SFTP or FTP folder | A connection of the home project, folder, file names, sub-folders | The path in the folder |
| SharePoint or OneDrive | A Microsoft OAuth connection, site, library, folder, file names | The path in the library; its address kept for answers |
| Google Drive folder | A Google OAuth connection, folder id, file names; Docs, Sheets and Slides read as text | The file name |
| Web pages | The addresses, one per line | The address |
| Database query | A database connection, the query, the key column, the text ({name}. {description}), the details kept | The key of the row |
| HTTP API (JSON) | An HTTP connection or a full address, where the list is, the key field, the text, the details | The key of the element |
| Sutra of a project | The project whose Sutras write the area | Whatever 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:
| Step | Granted to search | Granted May add and remove |
|---|---|---|
| Search knowledge, Ask knowledge, an agent's knowledge tool | Finds passages in the granted areas only; a source filter outside them fails and lists the granted areas | The same |
| Add to knowledge, Remove knowledge | Fails: may search the knowledge base but not change it | Works when the source is in the area (products/P-101); outside it fails and names the area |