SutraFlow User Guide

Version 2.1.8 · 142 activities in 22 palettes · 25 connection types · 122 functions

Getting started

1. What SutraFlow is

SutraFlow is a visual integration designer and engine. You build a Sutra by dragging activities from palettes onto a canvas and connecting them; you map data from earlier activities into later ones; you test and debug it in the studio; and you deploy it to run on the server: on a schedule, when a file or message arrives, or as a REST or SOAP API protected by a security policy and TLS.

One program contains three parts:

  • The studio at http://127.0.0.1:4800: the Designer, Runs, Resources and read-only Services screens.
  • The engine, which runs Sutras step by step and saves each finished step, so runs survive a restart and long waits cost nothing.
  • The gateway on ports 8080 (HTTP) and 8443 (HTTPS), which serves deployed APIs, separately from the studio.
Words used in this guide

A project holds Sutras, shared resources (connections), schemas and properties. A Sutra is one process diagram. An activity is one box on it; a step is one execution of an activity in a run; a run is one execution of a Sutra. Local variables live for one run, Project properties are shared by a project's Sutras, and Engine properties are server settings made by the administrator.

The Designer: palettes on the left, the process in the middle, the selected activity's tabs on the right.
The Designer: palettes on the left, the process in the middle, the selected activity's tabs on the right.

2. What is new in 2.1.8

This chapter lists what changed for designers in 2.1.8. Upgrade steps for administrators are in the Administration Guide; the release notes list every fix.

New

  • My profile. Select your name at the top of the designer, or My profile in the Admin Console, to see your roles, change your password and manage your own API tokens. See My profile: password and API tokens.
  • Your own API tokens. A token acts as you, with your roles, for an AI assistant or a script. You choose whether it expires after 30, 60 or 90 days, and renew it with one click when it expires.
  • Build Sutras with an AI assistant. GitHub Copilot, Claude, Antigravity and other MCP clients can connect to the studio, read your projects, build and fix Sutras as drafts and test them. They never deploy on their own. See Building Sutras with an AI assistant.
  • More checks in the AI guard step. AI guard can now rate a text for harmful content (block it or only warn), tell its language and translate it, and answer a question it has seen before from a cache.
  • Personal data hidden in logs. A project can hide e-mail addresses, phone and card numbers and similar details in its log lines and run history (Project, Logging).

Changed: check your Sutras after the upgrade

  • Secrets only through Secret properties. A Sutra or a connection reads a stored secret only through a Secret property of its own project or of the engine. Writing a vault name directly, such as {{secret.API_KEY}}, is refused when the Sutra runs. Add a Secret property that points to the secret and use {{gv.NAME}} instead. The Admin Console Overview lists the connections and Sutras that need this change.
  • AI command-line tools need an administrator. AI providers that run the Claude, Gemini or Codex command-line tool, and MCP servers started by a command, work only after an administrator switches them on and allows the command. After the upgrade the switch is off on every server; the commands already used in connections are listed for an administrator to approve or dismiss (Admin Console, Server, Runtime).
  • Server environment variables need an administrator. ${env:NAME} in a project property, deployment config or connection reads only the names an administrator allowed (Admin Console, Server, Runtime, Environment variables for projects). The server's own variables, whose names start with SUTRA_, are never readable, and script steps no longer receive them. The same card lists the names projects use that are not allowed yet.
  • A Secret property points to its own project's secret. A Secret property can use a secret stored for its own project, or a server secret chosen by someone with the Manage secrets permission, but never a secret stored for another project.
  • File steps stay inside their folder. A path that leads out of a File step's folder through a link or a Windows junction is refused, and listing a folder does not follow links. Also save to folder of the Build package step saves inside the server's releases folder (a name such as nightly) or a project files folder.
  • One project at a time. Each change in the studio belongs to one project. A request that names two different projects is refused, a new item cannot reuse the id of an existing one, and saving an item keeps it in its own project.
  • Previews show your projects only. A schema of another project no longer shows its fields in a step's preview, and live run events reach only people who may see that project.

3. Installing SutraFlow

SutraFlow is usually installed and run by an administrator: installing, upgrading, engines, clusters, the database, people and security are in the SutraFlow Administration Guide (Admin guide in the Admin Console, or /admin-guide on the studio's address). On a machine of your own it takes a few minutes:

  1. Download the release for your system (sutraflow-<version>-windows.zip or -linux.tar.gz; the -offline archive has everything inside) and unpack it into an empty folder.
  2. Run bin/sutraflow install (Windows: bin\sutraflow.cmd install). The installer opens in your browser and asks, page by page, for the first administrator, the database (SQLite needs nothing else), the ports and, optionally, more engines: see The web installer.
  3. Open the designer at http://127.0.0.1:4800 (or the port you chose) and sign in.

Day to day: bin/sutraflow start, stop and status; bin/sutraflow open guide opens this guide. Development machines with Laragon or Linux, and the PostgreSQL and MySQL the samples use, are in Development machines.

Guidelines

Back up the data folder, and above all data/master.key: without it the encrypted secrets cannot be read.
Keep the studio on 127.0.0.1: port 4800 is for your team. Everything others call goes through the API gateway: ports 8080 (HTTP) and 8443 (HTTPS), which serve only deployed Sutras (see The API gateway).

4. The studio, screen by screen

The top bar holds the four screens, the version in the middle, Admin Console (deployed projects, engines, gateway, users and audit, in its own page), Approval Center (approvals waiting for people, in a new tab), Guide (this guide in a new tab), Design guide (the Sutra Design Guide), the light/dark switch, your name (which opens My profile) and Sign out.

ScreenWhat it is for
DesignerBuilding, testing, debugging and deploying Sutras. Left: the Project explorer and the Palettes. Middle: the canvas and its toolbar. Right: the selected activity's General, Input, Output and Settings tabs.
RunsEvery run with its status, steps, inputs and outputs, logs; approvals waiting for a person (approvers decide in the Approval Center, /approvals).
ResourcesShared connections and security of the current project, and the secrets vault.
ServicesRead-only addresses and listener health for exposed services. Server-wide controls are in Admin Console → Server.

The Designer toolbar

  • Sutra list: opens another Sutra of the project.
  • + New Sutra: type a Name (left empty, the starter's name is used), then pick a blank Sutra or a starter (REST API, SOAP service, approval with timer).
  • ▶ Test: runs the current draft once with the trigger's test data, without deploying.
  • Debug: runs the draft one activity at a time (see Testing and debugging).
  • ↶ Undo and ↷ Redo (Ctrl+Z, Ctrl+Y or Ctrl+Shift+Z): step back and forward through your changes to the Sutra, up to 100 of them, such as a deleted activity or connection, a move or a changed mapping. While you type in a field, Ctrl+Z undoes the typing in that field instead.
  • Deploy: makes the current draft the live version.
  • Status badges: Saved, Deployed v2 or Draft only, and the last test result.

The Delete key deletes the selected activity or connection (Backspace does not, so editing text never removes an activity). Changes save automatically. Zoom with the wheel or the + and − buttons; the small map at the bottom left shows where you are.

5. My profile: password and API tokens

Your profile shows who you are signed in as and what you may do, and lets you change your password and make your own API tokens. Open it by selecting your name at the top of the designer, or with My profile in the Admin Console menu.

Account

Your name, user name and e-mail address, and your roles: what you may do on all projects and on each project. An administrator changes these in Admin Console → Users.

Change password

  1. Type your current password.
  2. Type the new password twice.
  3. Select Change password. Your other sessions are signed out; this one stays signed in, and your API tokens keep working.

If you sign in with single sign-on, your password belongs to your organisation's sign-in and this section only says so.

My API tokens

An API token lets an AI assistant or a script work as you, without your password. It has your roles, sees only your projects, and the audit log names you for everything it does.

  1. Give the token a name that says where it is used, such as Copilot on my laptop.
  2. Choose when it expires: after 30, 60 or 90 days.
  3. Select Create token and copy the token at once. It is shown only this one time; SutraFlow keeps only a fingerprint of it.
  4. Paste it into the assistant or script as the header Authorization: Bearer <token>. For an AI assistant, see Connecting AI assistants over MCP.

The list shows each token's name, when it was made, when it expires and when it was last used.

  • Renew appears when a token has expired or expires within 7 days. It replaces the token with a new value with the same name and period. The old value stops working, so paste the new one where the token is used.
  • Revoke ends a token at once.

A token cannot make or renew tokens or change your password: for those, sign in to the studio. Your tokens also stop working when you choose Sign out everywhere, when an administrator resets your password or disables your account, and while an administrator has switched personal tokens off. You can have up to 20 tokens.

Guidelines

One token per assistant or script, named after it, so you can revoke one without stopping the others.
Choose the shortest period that suits you.
Never put a token in a Sutra, a file in Git or a chat message.

6. Projects and the explorer

Open the Project tab on the left of the Designer. The project list at the top switches projects; + creates one, starting from:

  • Empty: a name, nothing else.
  • Samples: the sample Sutras you choose. Type in the search box (each word must start a word of the sample, so AI finds the AI samples) and use Select shown; nothing is chosen until you choose.
  • Package file: chosen Sutras of a .sutra package from any SutraFlow server, with the project's connections, schemas and variables. They come in as drafts, so nothing starts and no address clashes with the original; tick Deploy the Sutras that are deployed in the package to deploy them as well. Secret values never travel: the import tells you which secrets to add.
  • Copy a project: chosen Sutras of a project on this server, as drafts in a new project. The original is not changed. Good for a proof of concept or a study copy.
New project from samples: the search "AI" and Select shown chose the five AI samples; nothing is chosen until you choose.
New project from samples: the search "AI" and Select shown chose the five AI samples; nothing is chosen until you choose.

Each project holds:

SectionWhat it holds
SutrasThe Sutras, with their deployed version. Each Sutra also has Sutra variables, read as {vars.name}.
ResourcesThe project's connections and security, each listed under the name you gave it with a symbol for its kind. + opens the list of kinds: HTTP connection, Outbound security, API security policy, AI provider, Email (SMTP and IMAP), Database, Kafka, RabbitMQ, ActiveMQ, Firebase, OAuth connection. The name is its key in the deployment config, so you can rename it safely.
SchemasShared JSON (JSON Schema or a sample document) and XML (XSD) schemas. Activities pick them to describe payloads, bodies, CSV rows and mapping targets.
Service descriptorsWSDL files that Invoke SOAP service can call.
ConfigurationProject variables, the deployment config and the log file settings.
The Project explorer with a shared XSD schema open: its fields are shown as a tree, as activities will see them.
The Project explorer with a shared XSD schema open: its fields are shown as a tree, as activities will see them.

Folders

Sutras, Resources, Schemas and Service descriptors can each sit in folders, and folders in folders, so a large project stays tidy. Each section has its own folders. Folders only arrange the explorer: a name is still unique in the project, and deploying, calling and packages work as before.

  • + Folder under the list makes a folder; type Orders/Inbound for one inside another.
  • Drag a Sutra or a folder onto a folder to move it there, or onto the line Drag here for the top level.
  • The ⋯ button beside an item, or a right-click on it, opens its menu: Rename, Move (type or pick a folder) and Delete. Renaming breaks nothing: steps and connections refer to an item by its id.
  • Beside a folder (or with a right-click) the menu renames or moves the folder with everything in it, makes a folder inside, removes the folder (its contents move up one level; nothing is deleted) or deletes the folder and everything in it.
  • A new Sutra goes in the folder of the Sutra open at the time.
  • Samples go to Samples/<topic>, for example Samples/SQL and Samples/REST and microservices, and the connections made for them to Resources > Samples. Samples added before folders existed were filed there once, when the server was updated. Move them anywhere afterwards.
  • Packages and project copies keep each item's folder.
  • Importing chosen Sutras (a new project from a package or a copy) brings the connections, schemas and service descriptors those Sutras use, directly or through each other (an MCP server and its policy), in their folders, and nothing else.

Deleting

Sutras, connections, schemas and service descriptors can be deleted one by one (the item's menu, or the Delete button of its editor or of the Sutra), or a whole folder with everything in it. Every delete asks first:

  1. The dialog says what goes, and lists the Sutras and connections that still use the item: they stop working until you pick another one.
  2. Type delete in the box. Until you do, the Delete button stays off, so a stray click or Enter deletes nothing.
  3. A deployed Sutra cannot be deleted: undeploy it first, so a delete never stops a running service by accident. A folder with a deployed Sutra in it is refused the same way, and nothing in it is deleted.
  • Deleting a Sutra deletes its saved versions too; its run history is kept.
  • Deleting a connection leaves its secrets in the vault (they may serve other connections).
  • The Configuration section (project variables, deployment config, logging) belongs to the project and cannot be deleted; change its values instead.
  • Deleting needs the same permission as changing the item: Design for Sutras, schemas and service descriptors, Connections for connections. Viewers and approvers cannot delete.
  • In a project connected to Git, a deleted item shows at once in the Git tab as a deleted file: commit it like any other change (or discard it to bring the item back before the commit).

Project log

Configuration > Project log shows what this project's runs wrote to its log file (set it up under Logging), newest at the bottom. Filter by level, by Runs from (deployed Sutras or designer tests) and by words; refresh it every 5 seconds; download what is shown. Every line carries two tags: the server it ran on (production, test, development) and the run, deployed v3 for a deployed Sutra and its version, or editor test / editor debug for the designer's own runs. In the file a line reads 2026-10-19T09:12:03Z INFO {development, editor test} [Orders / 3f2a91c0 / Check stock] ....

Clear log empties the file and its rotated copies; Clear test runs deletes the finished test and debug runs of the project and keeps deployed runs. Developers may do both on development and test servers; on a production server only an administrator may. Both are recorded in the audit log.

Missing project variables

When a step reads a project variable the project does not define ({{gv.X}}, {gv.X}, $gv.X in JSONata or get-project-variable('X')), the activity shows ⚠ on the canvas and a warning at the top of its tabs, and it reads as empty while running. The same warning shows on a connection that reads one, and on every step that uses that connection. Add to project variables adds the missing names; give them values under Configuration > Project variables. Deploy lists the same warnings.

Every palette supports Project properties. General settings such as a folder, address, API path, schedule, queue, mailbox, model, limit or SQL text show {x} where a property can be inserted; mapped Input fields may use {gv.NAME} in formulas. Connection settings, including nested headers, are resolved the same way. In SQL text, Project and Engine properties are written into the statement, while run data written there ({{input.id}}, trigger data, earlier outputs, Local variables) is sent as a bound parameter, never as SQL text; one statement uses both (see Database work in the design guidelines). Procedure names accept only properties.

Checkboxes, properties and strict validation

A fixed checkbox reads On when ticked and Off when unticked. Its {x} picker selects a Project property ({{gv.VALIDATE}}) or read-only Engine property. Property mode shows the reference, not a fixed tick. Prefer a Boolean Project property. Boolean true, number 1 or text true/on/yes/1 means On; false, 0 or false/off/no/0 means Off (case-insensitive). Missing, empty or other values cause a configuration error, never truthy-string conversion. Engine activities and listener/gateway configuration share defaults and conversion.

Parse/Render JSON/XML and typed maps default Validate against schema to Off; schema-backed samples explicitly enable it. On requires a selected, existing contract of the correct kind. Manual typed mapping checks its declared target types independently. A JSON sample used for validation is a strict shape: all demonstrated fields are required and extra fields are refused recursively. Use JSON Schema for optional fields and extra-property policies (required, additionalProperties); its written constraints are authoritative. XSD 1.0 checks namespaces, cardinality, types and facets.

On upgrade, inspect old drafts: 2.0.7 could display a checked default without storing an enabled flag. An omitted validation flag now displays Off consistently; explicit true remains strict. Retest after editing: the Output tab belongs to its earlier run, not the current draft.

Generated process documentation (HTML/Markdown and release packages) lists every activity configuration, defaults, inactive fields, complete mappings and stored execution settings. Properties remain expressions; vault values are not resolved. Known credential keys and Authorization rows are redacted. Never embed credentials in scripts or free text; use the vault and review documentation before sharing it.

Add a connection

  1. Next to Resources, click + and choose the kind, for example HTTP connection.
  2. Give it your own name, such as Orders API. The explorer lists it under that name.
  3. Fill in its settings: address and port, user, and the Secret property that holds the password. Settings marked {x} take a project variable, such as {{gv.ORDERS_URL}}, so each environment can use its own value.
  4. Click Test connection. SutraFlow tries the settings as they are on screen, with variables filled in, and says what happened: the HTTP status, the database it reached, the mailbox count, the AI model that answered.
  5. Click Save.
Resources: + opens the list of kinds. Existing connections are listed under their own names.
Resources: + opens the list of kinds. Existing connections are listed under their own names.
A new HTTP connection named Orders API, after Test connection.
A new HTTP connection named Orders API, after Test connection.

Each palette's chapter shows its connections filled in and tested: HTTP, PostgreSQL and MySQL, MongoDB, and Kafka, RabbitMQ and ActiveMQ. Remote connections there keep their host, database and user in Project properties and pick their password from a Secret property, so nothing secret is typed into the form and each environment gives its own values.

Add a shared schema

  1. Next to Schemas, click +.
  2. Give it a name and choose the type: JSON or XML (XSD).
  3. Paste the content, or load a file. A JSON sample document is enough; SutraFlow works out the fields.
  4. For an XSD with several root elements, choose the default root element.
  5. Save. The Fields tree shows the result: * marks a required field, ** a repeating one.

Building Sutras

7. Building a Sutra

  1. Click + New Sutra, type its name, and choose a starter or start blank.
  2. Drag a process starter (or keep Manual start). Starters carry a green ▶: the common ones are in Triggers, while file, remote-file, email, queue/topic, cloud, chat, ADF, agent and MCP starters stay beside their related activities. A Sutra has one starter.
  3. Drag activities onto the canvas. Search the palettes with the box at the top.
  4. Connect an activity's output (a circle on its right) to the next activity's input (on its left). Activities with several outputs, such as If / else or Router, have one circle per output.
  5. Select each activity and fill in its tabs.
  6. Click Test. Each activity shows its result; select one and open Output to see the values.
  7. When it works, click Deploy.

Branches, errors and ends

  • Every activity except triggers and End has a red error output. Connect it to handle a failure; otherwise the failure ends the run as failed.
  • A branch that is not taken is skipped; a Merge after it still continues.
  • End ends a branch. With Sutra: success or Sutra: error it stops the whole Sutra at once and cancels the other branches.
  • Throw error fails a branch with your message, so an error output before it can handle it.
  • The Error handler activity catches every error whose activity has no error output connected: one place to log, alert and clean up.

Connections: names and conditions

Click a connection to name it and decide when it is taken. The name and condition show on the canvas.

TakenMeaning
AlwaysEvery time the activity finishes on that output. The default.
When a condition is trueA formula on the previous activity's output, which it reads as {input.x}. Browse Condition data to insert the previous activity, earlier activities, trigger data, Local variables or Project/Engine properties; the {x} button is the quick Project/Engine picker. For example, ={input.amount} > {gv.LIMIT} can be named Over project limit. Several "when" connections can be taken together.
OtherwiseTaken when none of the "when" connections from the same output was taken.

Lines have colours where several meet at one step, and the toolbar's Path and Tidy help to read a large Sutra: see What a step can see, and the lines between steps.

A connection that is not taken counts as a skipped branch, so a Merge after it still continues. For many routes, or for routes on the same message used in several places, a Router activity keeps them in one place.

Sample Sutras

Samples that need a connection get one in the project, named Sample ... (Sample MySQL, Sample SFTP, Sample SMTP and so on), already chosen in their activities. Fill in its address, user and password, click Test connection, and the sample runs. Adding more samples later reuses these connections. The SQL samples use Laragon's MySQL defaults (127.0.0.1:3306, user root, no password). Samples that read a sample database have an install Sutra that makes it: when a query fails because a sample_ database or table is not there, the error says which one to run, for example Run 'Sample: Sales orders install' first: it makes sample_sutraflow.

Click + New Sutra, then Choose samples to tick the ones you want, or Add all. Test each one and open its activities' Input and Output tabs to see how it is built. Samples that write files use folders named sample_... in the project's files folder (project properties such as SAMPLE_CSV_FOLDER). Everything the samples store is named sample_, so an administrator can remove the samples with their data from the installer (Samples).

To learn the formula language, start with Sample: Functions: every function on one order, a Map data step per group (text, conversion, encoding, variables, utility, dates, numbers, logic, sequences, lists) and a Log of its results after each. Open a Map data step to read the formulas, its Output tab for the values.

Samples are built from SutraFlow's code each time they are added, so a new installation always gets the samples of its release, and every sample added becomes new Sutras with new ids in that project. A sample added to a project is the project's own copy: change it freely; upgrading SutraFlow leaves it as it is. To see a newer release's version, add the sample again: it goes beside the old one, named with a number (Sample: Functions 2); delete the old one when you no longer need it. Samples are for learning and as starting points: test and harden what you build from them before production (Sutra Design Guide, Packaging).

SampleWhat it showsPalettes
MongoDB document lifecycle (M0-tested baseline)Insert, list collections, find, array-filter/update, aggregate and delete a run-scoped document, with a strict starter contract and activity descriptions. Needs A MongoDB connection with separate credentials or encrypted complete URI, and permitted server network access..MongoDB
Typed JSON and XML mappingShared typed JSON target and a manual XML root, required attribute, namespace and repeating elements; both rendered to text. No external connection required.Data & mapping
JSON/XML schema validation and strict file readsValid and intentionally invalid contracts, typed mapping, Parse/Render, Validate fields, strict JSON/XML file reads, REST/HTTP and SOAP services. Every activity explains its validation outcome. Needs Writable project VALIDATION_FOLDER for file samples; deploy the REST service before the HTTP client. Services are local demonstrations without authentication..Data & mapping, Files, HTTP, Triggers
FunctionsEvery function of the formula language on one order: a Map data step per group (text, conversion, encoding, variables, utility, dates, numbers, logic, sequences, lists), each followed by a Log of its results.Data & mapping, General
For-Each mappingInvoice lines from order lines: Where, Sort by, position(), and a For-Each grouped by country.Data & mapping
Loop on an activityOne activity run per order, and a counter repeated while below 3, like polling a job.Data & mapping, General
Sub-Sutra (Call Sutra and Return)A reusable tax Sutra and an invoice Sutra that calls it and logs its result or its failure.Flow control
Try and catch with logsAn error handled on one activity, and the Error handler catching the rest, with logs at each level.Flow control, General
REST API with validationGET /samples/orders/:id: checks the id, shapes the reply, answers 200 or 400.Triggers, HTTP
CSV import and totalsWrites a CSV file, reads it back as typed rows, keeps the paid rows and totals them per country.Files, Data & mapping
Folder of filesLists the CSV files in a folder with a wildcard and handles each one with For each.Files, Flow control
Database (SQLite)Creates a table and rows in one transaction, then queries it with a bound :parameter. A built-in SQLite file, nothing to install.DB Ops
XML in and outParses an XML order with attributes, maps its repeating lines, and renders an XML invoice; a called Sutra takes XML checked against an XSD at its Manual start, and its caller maps to that contract.Data & mapping
JSONata, JavaScript and HTMLGroups orders with JSONata, scores them in JavaScript, and builds an HTML report.Data & mapping, Custom code
Router, Switch and MergeRoutes on conditions (all matches), joins the branches with Merge, then switches on the status.Flow control
Connection conditionsNamed connections taken when their condition on the output is true, and an otherwise connection.Flow control
Channels between SutrasOne Sutra sends to a channel; a deployed Sutra with a Channel trigger receives each message.General, Triggers
Traceability and notificationsOne order through three Sutras with one correlation id: intake calls a credit check, then announces the order on an internal channel; a notification hub receives it and decides whom to tell. Every log line carries the order number and correlation id, so the order can be followed from the project to each Sutra and run. Needs the notification hub deployed for the channel step to reach it.Flow control, General, Triggers
Counter, Wait and Sutra variablesA local variable set and read back in one run, a daily counter the server keeps across runs, and a pause; every step describes what it is for.General, Flow control
Scripts: PowerShell and Run programA PowerShell disk report that hands JSON to the next step, and a program run with arguments; failures carry the exit code and error output. Needs scripts allowed by an administrator in Admin Console > Server > Runtime.Scripts
Timer: nightly archiveEvery night at 02:00, lists the CSV files in a folder (oldest first) and moves each one to an archive folder.Triggers, Files, Flow control
File trigger: CSV drop folderStarts when a CSV file arrives, sorts its rows, writes a cleaned copy and moves the original to processed/.Triggers, Files, Data & mapping
Parse JSON and CSV textParses JSON with a shared schema and renders it through a schema-backed mapping; parses CSV, sorts the rows, and renders CSV with a semicolon. A No operation marks a step still to design.Data & mapping, Flow control
SQL update and stored procedureUpdates a row with a bound parameter and fails clearly when no row matched; a second Sutra calls a stored procedure. Needs the Database sample run first; for the procedure, a PostgreSQL, MySQL, SQL Server or Oracle connection.DB Ops
Call a SOAP serviceCalls the GetOrder operation of the "Order SOAP service" starter with a raw envelope and maps the reply; a SOAP fault has its own output. Needs the "SOAP service: orders" starter deployed.SOAP / Web services
Email trigger: orders by emailStarts for each new email in a mailbox, pulls the order number and amount out of the text with AI extract, and logs them. Needs an Email (IMAP) connection and an AI provider.Triggers, Email, AI
Firebase: order to appSaves the order in Firestore, updates its live status in the Realtime Database, and sends a push notification to the customer's phone. Needs a Firebase connection.Firebase
Google Drive and SheetsStarts when a Google Doc changes in a folder, exports its text, summarises it, and appends a row to a Google Sheet. Needs a Google OAuth connection, a folder and a spreadsheet; an AI provider.Triggers, Apps, AI
Dropbox, YouTube and any APISearches YouTube, saves the results to Dropbox as JSON, and calls any API of the connected account with Connected API call. Needs Google and Dropbox OAuth connections.Apps
AI: translate, extract, route and replyWith a local Ollama: lists the models, translates a Spanish message to English, extracts its fields, routes it to a team and drafts a reply. Needs Ollama running on this machine with at least one model.AI
Release pipelineA Sutra that releases a project: builds a package, checks it, deploys it to a test copy, waits for approval, deploys to production, and logs each step; any problem goes to one handler. Needs release activities allowed in Admin Console > Server > Runtime; for remote engines, their admin tokens in the vault.Release, Flow control, Email
Local AI with OllamaClassifies, summarises and rates a customer email with a local Ollama model, offline. Needs Ollama running on this machine with at least one model.AI
Email a reportBuilds an HTML report and emails it; a failure is logged. Needs an Email (SMTP) connection.Email, Custom code
Queue in and outTakes orders from Kafka, RabbitMQ or ActiveMQ, reshapes and publishes them, then explicitly confirms only after the outgoing broker accepted them. Needs one configured Kafka, RabbitMQ or ActiveMQ connection.Service Bus
Broker REST APIsThree HTTP-client examples: publish through Kafka REST, publish and fetch through RabbitMQ HTTP, and publish and fetch through ActiveMQ REST. These complement rather than replace native Queue / topic triggers. Needs the broker REST/management endpoint enabled and an HTTP connection plus Basic-auth vault secret.HTTP, Service Bus
Call a public SOAP serviceLoads the WSDL of a free public calculator service and calls its Add and Multiply operations; a fault and a network error each have their own output. Needs internet access.SOAP / Web services
Mock SOAP service and its callerA mock weather SOAP service with a WSDL and canned replies (and a fault for an unknown city), and a Sutra that calls it with a raw envelope, as you would before the real service exists. Needs the mock service deployed.Triggers, SOAP / Web services
JSON microservicesThree small REST services: Customers and Stock answer JSON on their own, Orders calls both over HTTP and returns one combined JSON reply (or 404 / 409 / 502). Needs the three services deployed.Triggers, HTTP, Data & mapping
SQL install script and procedure as a serviceA SQL script creates a MySQL database, two tables, seed rows and a stored procedure; a REST service then calls the procedure and returns its rows as JSON. Needs MySQL (Laragon: 127.0.0.1:3306, user root, no password); the service deployed.DB Ops, Triggers, HTTP
SFTP: upload, list, read, archiveWrites a CSV to an SFTP server, appends to it, lists and reads it back, copies it to an archive folder and deletes the copy; a Remote file trigger picks up new files in inbox/. Needs an SFTP server: set the host, user and password of the "Sample SFTP" connection.SFTP / FTP, Triggers
FTP: upload, list, read, archiveThe same steps over FTP or FTPS: write, list with rows, read lines, move to a dated archive name; a Remote file trigger picks up new files and deletes them after the run. Needs an FTP server: set the host, user and password of the "Sample FTP" connection.SFTP / FTP, Triggers
Sales dashboardA dashboard page on the gateway (/dash/sales): revenue by month, orders by category, total revenue, top products and the latest orders, from SQL queries; refreshed every minute and cached for all viewers; PNG and SVG export on every chart. One chart takes its settings from a suggestion step, as an AI would give them, and shows how a field that is not in the data is refused. No database to install. Needs the dashboard deployed.Dashboards, DB Ops
Sales dashboard on a database, with filtersA dashboard on a real MySQL table of orders (/dash/sales-db): filters for region, categories and dates at the top, KPI cards with the change against the month before and a target, revenue by month split by region, revenue by category (a click on a bar filters the whole page), the share of each region, the best customers and the latest orders. One SQL query takes the filters as bound parameters; the Chart steps group and add up its rows. Needs MySQL (Laragon: 127.0.0.1:3306, user root, no password); the install Sutra run once; the dashboard deployed.Dashboards, DB Ops
Dashboard from JSON (any API)A dashboard from an API answer (/dash/orders-json): the orders list inside the answer, nested fields such as customer.city, dates grouped by month, series split by channel, KPI cards, filters including a search, and a Charts from AI step that plans more charts by itself (built-in rules without an AI provider; with one, the model chooses and every chart is checked). Replace the JSON step with an HTTP request to your own API. Needs the dashboard deployed.Dashboards, Data, AI
Knowledge feed from a databaseProducts kept in a MySQL table (as a shop or a Joomla site keeps them) become a knowledge base: a timer reads the published products, each one becomes a passage with its category, price and link as details, unchanged products are skipped and removed ones taken out; a REST API searches the products by meaning. No AI model needed. Needs MySQL (Laragon: 127.0.0.1:3306, user root, no password); the install script run once; the API deployed.AI, DB Ops, Triggers, REST
Chat for customers and supportA chat agent on a website that already has its own sign-in (Sutra Sample Shop, a PHP website): the website issues a signed token for the signed-in person, the chat widget passes it on, and the agent answers with eight skills: order status, tracking, returns and refunds, invoices, the delivery address, products and stock, a person from the support desk, and help. Customers see only their own orders, the support desk any order. The website can use this SutraFlow or one on another server. No AI model needed. Needs the agent deployed; the website's shared secret in the project Secret property CHAT_SITE_SECRET; PHP 8 for the website.AI, Triggers
AI agent: order desk with tools and memoryA published agent (chat page, OpenAI API, MCP tool, A2A) that checks its input with the AI guard, looks orders and stock up with two AI tool Sutras, remembers each conversation, and asks a person before any refund. Needs Ollama with a model (phi4-mini works); the three Sutras deployed to chat at /chat/order-desk.AI
AI agent: knowledge base (RAG)Fills a knowledge base from web pages and from a SharePoint library (kept up to date by a trigger), and a policy assistant that answers only from it, with sources. Needs Ollama with a model; for SharePoint, a Microsoft OAuth connection.AI, Apps
AI agent: fed by a message queueTakes questions from Kafka, RabbitMQ or ActiveMQ, keeps each conversation in its own AI-memory session, publishes the answer to the requested destination, then explicitly confirms. Needs one configured Kafka, RabbitMQ or ActiveMQ connection; Ollama with a model.AI, Service Bus
AI agent: supervisor and specialistsA supervisor agent published at /chat/help sends each question to the order desk or the policy assistant with Hand off to agent, and answers with what they say. Needs the order desk and knowledge base samples; Ollama with a model.AI
AI agent: tools from another MCP serverLists the tools of an outside MCP server (the file system server started with npx), calls one directly, and gives them to an agent that answers questions about files. Needs Node.js npx on the server; Ollama with a model.AI
AI document assistant: RAG over a folderEvery 15 minutes, reads the PDF, Word, PowerPoint and Markdown files of a folder into a knowledge base (changed files again, deleted ones out), and answers from it three ways: a REST API, an MCP tool for AI assistants, and a chat agent. Sample documents included. Needs Ollama with a model for the API and the agent (the MCP tool needs none).AI, Files, Triggers, REST
Azure Data Factory: run, monitor, rerunRuns a pipeline with parameters and waits for it, reruns from the failed activity, and watches the factory for failed runs, asking a person before a rerun. Needs an Azure service principal with Data Factory Contributor on the factory.Azure, Flow control, AI
Databricks: notebooks, SQL and code blocksRuns a notebook with parameters and reads its exit value; queries a SQL warehouse with a named parameter and runs a Python cell on a cluster. Needs a Databricks workspace with a cluster and a SQL warehouse; a token or service principal.Azure
Python scriptsPython written in the step and a .py file from the project files, with arguments, parameters and the previous output, printing JSON for the next step. Needs Python 3 on the server; scripts allowed in Admin Console > Server > Runtime.Scripts
YouTube: publish from Google Drive, weekly analyticsNew videos in a Drive folder are saved to the server and uploaded to YouTube; every week the channel's analytics go to a Google Sheet. Needs a Google OAuth app with the Drive, YouTube and Sheets scopes.Apps and social
Twitch: going liveWhen the channel goes live, a welcome in the chat; after the stream, the follower count. Needs a Twitch application (dev.twitch.tv).Apps and social
Discord: order status botA bot answers !status <order> in a channel with an embed. Needs a Discord bot token.Apps and social
Telegram: order status bot and alertsA bot answers /status <order> in any chat; an alert Sutra other Sutras call posts to the team chat. Needs a Telegram bot token from @BotFather.Apps and social
MCP skills: Write CSV file, Post to Facebook pageTwo Sutras that AI assistants call as tools, on a sample MCP server. Needs a security policy on the MCP server; a Facebook connection for posting.Triggers, AI, Files, Apps
Sample: For-Each mapping. The repeating target lines is selected: its For-Each takes the order lines, keeps rows where qty &gt; 0 and sorts them by sku.
Sample: For-Each mapping. The repeating target lines is selected: its For-Each takes the order lines, keeps rows where qty > 0 and sorts them by sku.
Sample: Try and catch with logs after a test: Check stock's own error output handled one failure; the Error handler caught Reject and logged it.
Sample: Try and catch with logs after a test: Check stock's own error output handled one failure; the Error handler caught Reject and logged it.

Reusable Sutras

Put logic used in several places in its own Sutra: a Manual start with a payload schema, the steps, and Return with the result. Other Sutras run it with Call Sutra, wait for the result and continue; a failure inside it arrives on Call Sutra's error output. While you test, the draft of the called Sutra runs; deployed Sutras call its deployed version. The called Sutra's Manual start schema is the caller's input contract, and its payload may be JSON or XML: see Inputs of called Sutras.

Loops

Any activity can run more than once (Settings tab → Loop):

  • For each item of a list: once per item of Loop over. Map {iteration.value} (or {item}) and {iteration.index}; the mapper lists them under $iteration. The output is iterations (every result) and count.
  • Repeat while a condition holds: runs, then checks the condition, for example ={iteration.output.status} != 'DONE', with a delay between runs: polling until a job is finished. The output is the last result plus _iterations.

A looping activity shows ↻ after its type on the canvas. Each loop has a maximum number of runs (1000 by default).

Sutras working together

  • Call Sutra: run another Sutra and use its result.
  • Send to channel and Channel trigger: tell other deployed Sutras that something happened, in memory.
  • Counter: a number shared by all runs of the project, such as a sequence or a daily total.
Guidelines

Name activities by what they do (Get order, not HTTP 1): mappings refer to activities by name, and renaming one updates them.
Give every API branch a reply, including the error branches.

8. The activity tabs

TabWhat it holds
GeneralThe activity's name and its fixed settings: folders, URLs, methods, connections, formats. Fields with {x} accept Project and Engine properties ({{gv.OUTBOX}}, {{ev.REGION}}) and = formulas. Map inputs opens the Input tab.
InputThe mapper: values that come from earlier activities (see Mapping data).
OutputThe fields this activity produces, before any run; after a run, the values it received and produced, and under Log its own log lines: what Log wrote, what Set Local Variable set, retries and warnings.
SettingsRetries with a growing delay, a timeout, a breakpoint for debugging, and skip this activity.
The General tab of Write file: the folder accepts variables through {x}; Append and Overwrite are checkboxes.
The General tab of Write file: the folder accepts variables through {x}; Append and Overwrite are checkboxes.
The Output tab after a test: the fields and their values.
The Output tab after a test: the fields and their values.

Settings tab reference

SettingWhat it doesDefault
Retries on failureRuns the activity again after a failure, up to this many times (at most 20), before the error output is used.0
First retry delay (ms)Wait before the first retry; each retry waits twice as long as the one before.1000
Timeout (ms)Fails the activity if it takes longer.120000
Skip this activityPasses the input through without running the activity.off
BreakpointThe debugger pauses before this activity.off
LoopRun once, for each item of a list, or repeat while a condition holds (see Loops).Run once
Loop over / Repeat whileThe list, or the condition checked after each run.—
Delay between runs (ms)Wait between two runs of the loop.0
Maximum runsFails the activity when the loop would run more often (at most 10000).1000

9. Mapping data

Select an activity and open Input. Sutra Data on the left lists $_projectVariables, $_sengineVariables (read only), $_sutraContext (this run: id, name, version, step), $_sutraVariables, current input, and named activity outputs. Sources show the user-assigned activity name followed by its activity type, for example Fetch customer (SQL query). Current input retains the formula path input; named outputs retain nodes.Activity name. Multiple incoming connections are listed as candidates rather than claiming a unique source. Trigger data (trigger) is listed on every step, so dragging one of its fields writes {{trigger.params.region}}. Only the steps before this one on a connected path are listed: steps on another lane and later steps are not (see What a step can see). Activity Input on the right lists what the activity needs; for structured inputs, the tree of the chosen schema.

Before testing, the source tree describes the configured schema. During an explicit Test/Debug session it shows observed fields and values; Received and Output also show that recorded run. Static warnings still check references against configured schemas. A schema edit does not change a starter's sample payload or rewrite an earlier run. Keep sample payloads and schemas consistent and run Test again after changes. A missing-source warning means the reference is absent from the known schema; dynamic run data can still contain that field. Mapping may rename and restructure fields across formats; optional strict target validation checks the transformed result, not equality with the source schema.

The designer does not automatically load previous run values when opening a flow. Runtime previews belong only to the explicitly started Test/Debug session, held in browser memory, not browser storage or the flow definition. Flow edits, schema-catalog reloads and switching flows clear that session's preview values. Clear test data removes completed test values from the designer without deleting server-side run history. Production run outputs are never selected as design samples. Repeating scalar previews show the item count and array values rather than presenting only the first value. The Sample: Renamed fields to XML example maps JSON zone:[2,5] into XML Score elements containing 2 and 5; its payload, source contract and formulas agree.

Stop test is visible in the designer toolbar and enabled while its Test/Debug run is active, including paused/debug and durable waits. It requests cancellation through the engine; preview values are cleared after a terminal state is confirmed. If the request fails, the controls remain so you can retry. Editing a flow clears stale previews but retains its active test cancellation handle. Starting a second test is disabled while one is active. Supported in-flight work is aborted cooperatively; stopping does not roll back SQL commits, published messages or other side effects already completed. Run history remains available under Runs. For an already completed test, use Clear test data.

Review shared-schema changes before saving

Both the project schema editor and Edit shared schema offer Check schema change impact. Edit the proposed definition, then check: the report lists structural additions/removals/type or cardinality changes, directly affected saved activities by name (type), and new mapping diagnostics downstream. It does not save, rewrite mappings, run activities or load production values. Editing the proposed definition clears the previous report.

This is structural guidance, not a compatibility certificate. Saved drafts only are analyzed; unsaved flows, deployed snapshots and transitive XSD include/import dependencies need separate review. Pattern, format, choice and other contract constraints still require runtime tests. A report with no new structural diagnostics does not mean every payload will pass. Retest, review deployed uses and save deliberately.

Generated process documentation shows Activity name (Activity type), named JSON/XSD/WSDL contracts including selected XML roots, and named connection kinds. Missing references are marked explicitly; connection credentials and private keys remain redacted. Documentation exports describe configuration, not captured production payloads.

The mapper: Process Data on the left, the target on the right, the selected target's formula below with the function library.
The mapper: Process Data on the left, the target on the right, the selected target's formula below with the function library.

Choose the right mapping activity

ActivityTarget and resultUse next
Map JSON DataA typed JSON-compatible object, from JSON Schema or manual properties/objects/arrays.Render JSON when JSON text is required.
Map XML DataAn XML-shaped object: one root element, children, attributes, namespaces and repeating elements.Render XML when XML text is required.
Map dataGeneric structured data. Existing Sutras keep their current activity type and behavior.Any activity accepting structured input.

Define typed manual targets

With no shared schema selected, type a path beside + Field, choose its type and Required/Repeating options, then add it. Types are string, integer, number, boolean, date, object, null and any. Select a manual target to change its type, description, required flag and repeating-list minimum/maximum count. The controls specify the type of each list item, not the entire list.

For XML, keep or rename the initial Root object. Add Root/id as an integer element, Root/@_status as a string attribute, or Root/Item[]/sku for repeating items. Attributes cannot repeat or contain objects. XML requires one non-repeating element root. On object elements, Namespace URI declares a default namespace; a qualified name such as ns:User declares that prefix. JSON has no root tag or attribute distinction. Typed mapping checks supported value types at runtime; an invalid result follows the error output.

Work with shared schemas from Input

The Input tab has the same schema selector as General. Create schema accepts a schema definition or generates a proposed JSON Schema/XSD from sample text. Review its fields and types before saving. Sample inference accepts at most 128 KB; XML DTD/entities are rejected and source namespace bindings are not preserved in the generated XSD. Use an authored XSD for namespace-sensitive contracts. Edit shared schema lists affected saved Sutras before you save; schema-owned fields are edited there, not renamed/deleted on one activity.

Remove fields, validate and preview

Select a manual target and choose Delete target field. The confirmation explains that child fields, definitions and formulas go too; source data is unchanged. Undo/Redo restores/reapplies the complete edit. Schema changes can leave stale formulas: review the warning and use Remove stale mappings to remove only those rules, with confirmation and Undo support.

Malformed formulas, missing required mappings, invalid XML roots/names and conflicting list bounds are errors before Deploy. Stale target rules and unknown source fields are warnings. The mapping tree approximates alternatives, wildcards and repeated model groups. With a selected schema and Validate against schema enabled, the completed value is separately validated: AJV checks JSON Schema drafts 07, 2019-09 and 2020-12, including patterns, formats, numeric bounds, additional properties and conditional rules. Isolated libxml2 WebAssembly checks XSD 1.0 namespaces, element order, reusable/repeating groups, choice, optional fields, types, enumeration and facets including xs:pattern. XML patterns follow XSD rules, not JavaScript regular expressions. XSD 1.1 assertions are not supported.

Reuse contracts at other boundaries

Parse JSON, Parse XML, Render JSON and Render XML offer opt-in selected-schema validation (Off by default). On requires a selected, existing contract of the correct kind. Renderers allow a schema in both value and mapping modes. Validate fields can check a JSON Schema or XSD and route to invalid with problems. File readers, including local and FTP/SFTP read/list activities and file triggers, have an explicit Strict schema validation checkbox, unchecked by default and shown only for JSON/XML. Check it and select a JSON Schema for JSON or an XSD for XML to validate read content. Unchecked, a selected schema only describes mapping fields; schema constraints are not enforced. Missing or wrong-kind schemas are errors when strict validation is checked. File writers validate selected JSON/XML contracts before creating/replacing the destination. CSV column typing and streaming are unchanged. File triggers retain their existing readError contract: handle that field explicitly; invalid content is not exposed as data.

Send HTTP request checks a selected body schema before sending and a response schema before passing data onward. Send HTTP response checks before replying. REST/SOAP starters retain Validate requests → reject invalid: failures are HTTP 400 or a SOAP Client fault before a run starts. SOAP retains the operation namespace, so the XSD must declare the actual service namespace and qualified children where appropriate. No schema means no new schema check. Ordinary failures follow the activity error output and configured retries; permanent contract errors normally need corrected data/schema rather than retries.

XSD dependencies must be XSD resources in the same project, named exactly as their relative schemaLocation, for example common.xsd. URLs, absolute paths, parent paths and DTD/entity declarations are rejected. Limits: 4 MB XML per document, 32 schema files / 1 MB schema text, four concurrent validators and 64 queued requests. Split large XML documents into records before validation; this does not change large CSV streaming support. These are tested capabilities, not complete W3C conformance or third-party certification.

XML activity output and mapping previews offer Show XML tree for elements, attributes, text and repeated siblings. Raw output remains available. Tree display is bounded to 1 MB and does not resolve external entities.

Try the validation samples

In New Sutra → Samples, choose JSON/XML schema validation and strict file reads. Ten described examples are added under Samples/Data and mapping, with shared JSON Schema/XSD resources. Existing imported drafts and administrator-edited schemas are not overwritten.

  • JSON schema validation pipeline: Parse JSON, Map JSON Data, Validate fields and Render JSON share a contract with required fields, an id pattern, email format, decimal/integer bounds, booleans, enum lists, unique items and no extra properties.
  • XML schema-backed mapping: Map XML Data builds a Receipt against an XSD and Render XML serializes it. XML schema validation pipeline exercises qualified namespaces, a reusable/repeating choice group, optional Age, a required enum attribute, XSD pattern, decimal bounds, boolean and date. Parse XML normalizes prefixes; Render XML uses the schema namespace, then Validate fields checks the serialized text.
  • JSON/XML schema expected rejection: deliberately invalid payloads take the invalid branch and log problems. A completed run means the rejection was handled correctly, not that invalid data passed. An unexpected valid branch throws an error.
  • Read JSON/XML file with schema validation: the first step writes a fixture, then Read file has Strict schema validation checked and the matching contract selected. Inspect data on the strict read output. Uncheck to keep parsing/mapping without contract enforcement. The files are customer.json and customer.xml under administrator-editable project property VALIDATION_FOLDER (default ${files}/sample_validation); rerunning overwrites those sample files. To exercise rejection, read a malformed-contract file directly rather than rerunning the fixture writer first.
  • Validated REST service, Validated HTTP client and Validated SOAP service: deploy the REST service before running the HTTP client. The REST route is /samples/validation/customer; SOAP is /samples/validation/soap, operation User in urn:sutra:validation. Invalid ingress gets 400/Client fault before a run starts. These local demonstration services have no authentication: choose an API security policy before exposing them publicly.

Preview mapped result evaluates the whole mapping and shows JSON or XML without running the selected activity or its downstream steps. It refreshes after edits. It uses the latest available test scope, labelled with its run id/time and a stale-data reminder; alternatively enter JSON sample input in the preview. Scope is limited to 256 KB and rendered output to 1 MB. Preview type mismatches are warnings about that sample, not proof about every possible runtime value.

Try Typed JSON and XML mapping under New Sutra → Choose samples. Its two described Sutras run without external connections. XML in and out demonstrates shared Order/Invoice XSDs; Parse JSON and CSV text includes a schema-backed Render JSON mapping.

Procedure

  1. For Map data, choose a Target schema in General, or leave it empty and type a target path such as customer/name or lines[]/sku beside + Field in Input. Shared JSON and XML schemas are created under Project → Schemas. For Render JSON/XML, choose Build from: mapping to show these mapping controls. Parse JSON/XML uses its schema to describe the parsed output, not to define a target mapping.
  2. To rename a manually added target (including the initial orderId), double-click its name or click its pencil button. Enter a new field name and choose Save or press Enter; Cancel or Escape leaves it unchanged. Formulas and child mappings are preserved. Duplicate sibling names are rejected. Schema-defined fields must instead be changed in the shared schema.
  3. Drag a field from the left onto a target field on the right. A line shows the link.
  4. Or select a target and write its formula in the box below. Click a function in the library to insert it; the preview under the box shows the result against the last test run.
  5. Drop a list onto a repeating target: a For-Each is created and fields with the same names are mapped. Inside it, {item.x} is the current row and {index} its position.
  6. Click Auto map to map every field that has the same name on both sides.
  7. Click any field, on either side, to highlight where it is mapped; other lines fade.
A selected source field: its mapping line is highlighted and the others fade.
A selected source field: its mapping line is highlighted and the others fade.

For-Each, If and Choose

The bundled mapping samples include shared target schemas under Schemas → Samples/Data and mapping; adding the same samples again reuses those schemas. XML in and out includes Order and Invoice XSDs, and Parse JSON and CSV text demonstrates both parsing JSON and rendering it with a shared mapping target. Render activities in value mode intentionally serialize an existing value directly and do not need a target mapping schema. Existing imported drafts are not overwritten when the software is upgraded; add a fresh sample to see the new contracts.

  • Where keeps only rows where a condition holds, using the row's own column names: upper-case(Country) = 'INDIA'.
  • Group by makes one element per distinct value; inside, {group.key}, {group.items} and {group.count}.
  • Sort by orders the rows, ascending or descending.
  • If includes the target only when its condition is true.
  • Choose takes the first When whose condition is true, otherwise the Otherwise value.

Formulas

A formula starts with = in a plain field, and is implied in mapping targets. References are written in braces: {input.name}, {nodes.Get order.body.id}, {gv.OUTBOX}, {vars.total}.

=concat('Name : ', {input.name})
=upper-case(substring-before({input.email}, '@'))
=format-date('DD-MM-YY', {nodes.Parse XML.Order.date})
=format-dateTime('DD MMM YYYY HH:mm', current-dateTime(), 'Asia/Kolkata')
=string-to-base64(concat({gv.USER}, ':', {gv.PASSWORD}))
=if({input.amount} > 1000, 'bulk', 'retail')
={input.rows}[upper-case(Country) = 'INDIA']        rows where the condition holds
=count({input.rows}[Amount > 1000])
={input.rows}[1].City                                  first row, then a field
=xs:integer({input.qty})
=concat({gv.OUT}, '\', current-timestamp('YYYYMMDD'), '.csv')

Backslashes in quoted text are literal, so Windows paths need no escaping. Write a quote twice to include it: 'O''Brien'. Function names ignore case. Every function is listed in Function reference.

Picking data: paths, repeating elements, filters and pipes

Every value a step can use is in Sutra Data, the tree on the left of the mapper. You reach a value by its path: the names from the top of the tree down, joined with dots.

Where the value isPath
What the previous step sent on the connectioninput.order.id
Any earlier step, by its namenodes.Get order.body.customer
What started the run (the request, the file, the message)trigger.body.id
Local variables of this run (Set Local Variable)vars.1.total (record 1), vars.total (a plain variable)
Project and Engine propertiesgv.OUTBOX, ev.REGION
This run: id, Sutra name, version, steprun.id, sutra.name
A name with spaces or dotsinput['first name']

The same path is written two ways, depending on the field:

  • In a formula (a mapping target, or a setting that starts with =) references are in single braces: {input.order.id}.
  • In a text field (a log message, an email body, a file name) they are templates in double braces: Order {{input.order.id}} is ready.

Repeating elements: one item, several items, all of them

A repeating element (a list: order lines, rows of a file, records from a database) is the list itself when you name it: {input.order.lines}. To take items from it:

You wantIn a formulaIn a text template
The first item{input.order.lines}[1]{{input.order.lines[0]}}
The last item{input.order.lines}[last()]{{input.order.lines[-1]}}
The second item's field{input.order.lines}[2].sku or [position() = 2]{{input.order.lines[1].sku}}
Only items that match{input.order.lines}[status = 'open'](use a formula)
The first item that matches{input.order.lines}[status = 'open'][1].sku
How many matchcount({input.order.lines}[qty > 1])
One field of every itempluck({input.order.lines}, 'sku')
A totalsum(pluck({input.order.lines}, 'price'))

Two counting rules to remember: in a formula positions count from 1, as in XPath ([1] is the first item); in a text template they count from 0 ([0] is the first, [-1] the last). Inside the square brackets of a filter, names are the item's own fields: [status = 'open'] compares each line's status. Filters can be combined, one after another, and conditions joined with and and or.

List functions do the same with a name you choose at run time: filter-by(list, 'status', 'open'), sort(list, 'price', true) (descending), slice(list, 1, 10) (the first ten; it counts from 1 too), group-by(list, 'status') (one entry per value, with key, items and count), count-by, flatten, concat-lists and contains-item. All are in the Function reference.

One target element per item: For-Each

When the target repeats too (invoice lines from order lines), map the list onto the repeating target instead of picking items: drop the source list on the target and a For-Each is made. Inside it:

  • {item.sku} is a field of the current item, and {index} its position, counting from 1.
  • {outer.x} is a field of the enclosing item when For-Each sits inside another For-Each (lines inside orders).
  • Any other path still works: {input.order.id} on every line repeats the order id.
  • Where keeps only the items that match, Sort by orders them and Group by makes one target element per distinct value ({group.key}, {group.items}, {group.count}), as described under For-Each, If and Choose above.

Pipes: change a value on its way

In a text template a value can pass through pipes, written after a | and applied left to right: {{input.name | trim | upper}} trims spaces, then makes it upper case; {{input.note | default:"none"}} gives a value when there is none. Pipes take their arguments after a colon. Every pipe is listed in Template pipes; in a formula, use the functions instead (upper-case(trim({input.name}))).

TaskWrite
The customer of the order this step received{input.order.customer}
The SKUs of open lines, as a listpluck({input.order.lines}[status = 'open'], 'sku')
The most expensive linesort({input.order.lines}, 'price', true)[1]
Lines grouped by status, with how many eachgroup-by({input.order.lines}, 'status')
A file name with today's date=concat('orders-', current-timestamp('YYYYMMDD'), '.csv')
The total of an earlier step's rowssum(pluck({nodes.Read invoices.rows}, 'amount'))
Names that are not data

__proto__, prototype and constructor are never data field names: a path or a target that uses one is refused.

Templates in text fields

Text fields such as an email body or a log message use {{ }} templates with pipes: Order {{input.id | upper}} for {{input.amount | number:2}}. The pipes are listed in Template pipes.

When to use JSONata instead

For heavy reshaping of repeating JSON (filter, group, total and nest in one go) a single JSONata activity is often clearer than many mapper rules.

10. What a step can see, and the lines between steps

A step can use only data it can really receive. One rule decides this everywhere: in the Input tab, the condition picker, template and SQL fields, the design check and the engine.

The rule

A step may use:

  • the trigger's data, as {{trigger…}};
  • Project and Engine properties ({{gv…}}, {{ev…}}) and Local variables ({{vars…}});
  • the outputs of the steps that come before it on a connected path, as {{nodes.Step name…}}.

A lane is a path that leaves a step beside another one. Take a trigger with two lanes: Trigger → Orders → Chart and Trigger → Regions. Chart sees the trigger and Orders, but not Regions: Regions runs on its own lane and may not have finished, or even run, when Chart starts. Where the lanes meet (two lines into one step, such as a Merge), both lanes are before that step and every step after it.

  • A line back to an earlier step (a loop back) does not make the later steps count as before.
  • Inside a For each loop, read the item from {input} or {iteration.value}.
  • The Error handler Error handler sees every step, because it runs after the failure.
  • A condition on a line can use the step it leaves and the steps before that step.

What the designer shows

  • Sutra Data on the Input tab lists only the steps the rule allows, and Trigger data (trigger) on every step, so input.params… on the first step and trigger.params… later are clearly the same data.
  • Pointing at a {{…}} under a text field (SQL, templates) shows where it comes from, for example trigger data → Sales on MySQL (Dashboard page) → params → region, sent as a bound parameter, and says when a step is not on this step's path.
  • The design check reports a reference to a step that is not before this one as a problem, naming the step, the field and the step used: Latest orders: Rows uses the step "Regions", which is not on its path. These references count: {{nodes.…}} in mappings, templates and conditions, JSONata $nodes, and nodes in Code steps.
  • At run time such a reference fails the step with the same message, instead of reading an output that may or may not be there yet.
Sutra Data on a later step: Trigger data (trigger) and only the steps before it on its path.
Sutra Data on a later step: Trigger data (trigger) and only the steps before it on its path.
Under the SQL field: where each reference comes from, and that run data is sent as a bound parameter.
Under the SQL field: where each reference comes from, and that run data is sent as a bound parameter.
Sutras made before 2.1.7

The rule applies to every Sutra from 2.1.7, with no setting to turn it off. Open older Sutras and run the design check: when a step uses a step on another lane, connect that step before it, or move the step after the place where the lanes meet (for example a Merge). The samples follow the rule.

Reading the lines

  • Pointing at a line shows from step (port) → to step and highlights the line and both ends.
  • Selecting a step highlights its lines and the steps at their other ends, and dims the rest.
  • Path (toolbar): with a step selected, lights every step before and after it, by the rule above, so you see exactly the steps whose data it can use and those that use its data.
  • Tidy (toolbar) lays the Sutra out left to right by its order, so fewer lines cross. It changes positions only, and Ctrl+Z undoes it in one step.

Line colours

  • Automatic. Where two or more lines go into one step, each gets its own colour from a palette of 8, checked for contrast in the light and dark themes. The colour belongs to the line's source step, so all lines leaving a step share it, and it stays when steps move. Other lines keep the normal colour.
  • By hand. Select a line and pick a colour in its side panel, or Automatic. The colour is saved in the Sutra and travels with exports, packages and Git.
  • A step's lines at once. Right-click a step, then Colour its lines.
  • Meaning never by colour alone. Error lines stay red and dashed; empty and otherwise lines stay dotted with a short port label. A colour is added on top.
  • The key. A step that receives several lines lists them with their colours on its Input tab: All charts receives 3 lines: Orders (blue), Revenue by month (green), …

Opening a run in the designer (Runs, Open in designer) shows the same colours and highlighting.

Nine lines into All charts, each in its source step's colour. The line from Regions is selected: its side panel says why it is orange, and offers the palette or Automatic.
Nine lines into All charts, each in its source step's colour. The line from Regions is selected: its side panel says why it is orange, and offers the palette or Automatic.
Path on: every step before and after the selected step is lit.
Path on: every step before and after the selected step is lit.
Right-click a step: Colour its lines.
Right-click a step: Colour its lines.
The key on the Input tab of a step that receives several lines.
The key on the Input tab of a step that receives several lines.

11. Inputs of called Sutras: JSON or XML

A Sutra called by others states its input once, on its Manual start. Every caller is checked against it: Call Sutra, a test in the studio and the Run API.

Manual start with JSON or XML

  • Payload schema takes a JSON Schema (or a JSON sample) or an XSD.
  • With an XSD, write the Test payload as XML. The design check warns when it is not.
  • An XML input may arrive as XML text, as { "xml": "<Order>…" }, or as data already in the Parse XML shape ({ "Order": { … } }). Text is checked against the XSD and turned into data the way Parse XML does; DTDs and entities are refused.
  • The step gives the data in the Parse XML shape and the original text under xml, so later steps map {input.Order.amount} as they would from JSON, or pass {input.xml} on unchanged.
  • Strict schema validation works as before: On refuses invalid input from every caller before any step runs.

Call Sutra follows the called Sutra's contract

  1. Pick the Sutra in Call Sutra. When the step has no input schema of its own, Input contract from the called Sutra turns on: the called Sutra's Manual start schema, for the chosen Version (draft or deployed), is the input.
  2. Set Input from to mapping: the Input tab shows the called Sutra's fields as targets, required ones marked. Input schema is hidden while the contract is followed.
  3. When the called Sutra changes its schema, the step shows a note and the design check a warning: … changed its input since this step was saved. Check the mapping, then choose Accept the new input.
  4. Older Call Sutra steps with their own Input schema keep it. The note offers Use its input contract to switch with one click.

The called Sutra checks its input at its Manual start, the same check every caller gets. An invalid input fails the Call Sutra step with the problem fields (Input for Order check refused: …) before any step of the called Sutra runs, with or without Wait for the result; the error output can handle it.

Sample: Call the XML order check. Check order follows the input contract of the called Sutra: its XSD, root Order, and the fields it requires.
Sample: Call the XML order check. Check order follows the input contract of the called Sutra: its XSD, root Order, and the fields it requires.

Sample: XML order check has a Manual start with an XSD, an XML test payload and strict validation; Sample: Call the XML order check calls it through its contract, mapping JSON fields to the XML order.

12. Schemas and WSDLs

Activities that receive or produce structured data let you pick a shared schema: Manual start (payload), REST service (request body), Send HTTP request (body and response), Map data (target), Parse/Render JSON and XML, the file activities (CSV row schema), Invoke SOAP service (arguments and response).

  • With a schema, later activities see the fields in the mapper before any run, with types and repeating markers.
  • Without one, SutraFlow infers the fields from the test data or the first run.
  • Activities keep their standard fields when a schema is chosen: for example Read file still returns the file name, path and size next to the rows, and Write file always returns the written file's details.

An XSD with several global elements is chosen as Schema::Element. A WSDL added under Service descriptors appears in Invoke SOAP service, which lists its services, ports and operations.

13. Variables and the deployment config

KindRead asSet whereLifetime
Local variables{vars.1.name} (a record by ID), {vars.name} (a plain one); Get Local VariablesSet Local Variable in the SutraOne run, never shared with other runs; saved with a durable wait or restart.
Project properties{gv.NAME}, {{gv.NAME}}, get-project-variable('NAME'); Get PropertiesProject → Configuration or the deployment config, by an administratorShared by this project's Sutras; read-only to Sutras.
Engine properties{ev.NAME}, {{ev.NAME}}, get-engine-variable('NAME'); Get PropertiesAdmin Console → Server → RuntimeShared by every project on the server; read-only to Sutras.

Project properties have a type: string, number, boolean or secret. A secret property holds the name of a vault secret, never the value. Get Properties never returns secret Project properties. Only an administrator changes Project or Engine properties; the engines discard their cached copy immediately on this engine and through the cluster deployment signal on the others.

The same properties work throughout every palette. Use the {x} button in General settings, use {gv.NAME} in mapped Input formulas, and use them in connections. Gateway paths and limits, Timer schedules and listener settings are resolved when deployed listeners are rebuilt. SQL statement fields accept them for administrator-controlled identifiers and clauses; values from a request or an earlier step, written in the same SQL, are bound automatically.

Use the right scope

Use Local variables for values calculated during one run, Project properties for environment configuration shared inside one project, and Engine properties only for values shared by every project on a server.

Editing and reading a declared variable: declare test with String initial value 1 on the Sutra. Each run starts with vars.test = "1". In Set Local Variable, General, choose Declared / plain variables, select test and enter a new value. In Get Local Variables choose one variable and test; Output displays a Name/Value table. The Get dropdown selects a mode, not a variable name. For grouped values use record storage and read them as vars.1.Name. General and Input edit the same values. Get results are snapshots at that step; a later Set never changes an earlier Get result.

Cancelled steps: when an unhandled failure ends a run, pending steps are cancelled. Their Output tab explains the run failure; Received may show queued input, which is not a completed output. A variable step cancelled because an AI step failed has not successfully set those values. For example, explicitly select an installed model on an Ollama connection before testing AI-dependent samples.

Local variables as records

Each Set Local Variable step has a Record ID, 1 for a new step. Steps with the same ID add to one record, another ID makes another, so every value of a run sits in one structure:

{
  "1": { "name": "Jane Doe", "email": "jane.doe@example.com", "role": "admin", "isActive": true },
  "2": { "run": "sutrax", "who": "jane.doe@example.com", "myrole": "admin", "isActive": true }
}
  • Read one value in any formula as {vars.1.name} or {{vars.2.who}}.
  • Get Local Variables returns the whole structure (all variables) or one record (one ID), always with runId, the id of the run they belong to.
  • An ID can come from the data, {{input.orderId}}, so a For-Each over orders keeps one record per order instead of overwriting one value.
  • The values belong to the run: two runs at the same moment each have their own records, even with the same IDs.
  • After a test, the Set Local Variable step's Output tab lists what it set under Log (1.name = Jane Doe). Its output is its input, passed on.
  • Steps made before 2.1.3 have no Record ID: they set plain variables, read as {vars.name}, as before. Clearing a step's Record ID does the same.

Sample: Counter, Wait and Sutra variables sets records 1 and 2, reads them back and compares them with a Counter, which the server keeps across runs.

The deployment config file

Operations staff change settings per environment without opening the studio. The deployment config holds overrides for project variables, resource settings (hosts, ports, URLs, queue names) and logging. Export it from the project, edit it, and import it, or place it at data/config/<project>.json.

{
  "variables": { "OUTBOX": "D:\\exports", "API_BASE": "${env:ORDERS_API:-https://test.example.com}" },
  "resources": { "Orders DB": { "host": "${env:DB_HOST}", "port": 5432 } },
  "logging":   { "path": "D:\\logs\\orders.log", "level": "info" }
}

${env:NAME} reads an environment variable of the server; ${env:NAME:-default} gives a default. An administrator first allows the name (Admin Console → Server → Runtime, Environment variables for projects); names starting with SUTRA_ are the server's own and are never readable.

Renaming a project keeps its stable id and also renames its data/files/<project> folder and matching data/config/<project>.json deployment config, including the config's project name.

Logging

Each project writes its own log file: path, level, text or JSON lines, rotation by size, and optionally each step's input and output. Set it under Configuration or in the deployment config.

Hide personal data in logs and run history shows e-mail addresses, phone and card numbers, IBAN, Aadhaar, PAN, SSN and IP addresses as [EMAIL], [PHONE] and so on in the log file and in what run history shows (step input and output, variables, log lines, errors). The steps themselves still pass the real data on; turn it on for projects that handle customers' details.

14. Testing and debugging

Test runs the draft once with the trigger's test data. Each activity shows a status dot; select one and open Output to read what it received and produced. API triggers use their test request, message and file triggers their test message or event.

Debug runs the draft one activity at a time:

  1. Optionally set breakpoints: Settings tab → Breakpoint: pause here when debugging.
  2. Click Debug. The run pauses before the first activity. The canvas outlines it, and its Output tab shows the input it will receive.
  3. Step runs that activity and pauses before the next. Continue runs to the next breakpoint. Pause stops before the next activity. Stop cancels the run.
Debugging: paused before Build order. The toolbar shows Step, Continue, Pause and Stop; the Output tab shows the input it will receive.
Debugging: paused before Build order. The toolbar shows Step, Continue, Pause and Stop; the Output tab shows the input it will receive.

Runs

The Runs screen lists every run: Sutra, version, trigger, stage, status, time. The Stage filter shows all runs, design runs only (tests, debugging, drafts) or runtime runs only (deployed work); the Stage column also names the client that started a run by hand: studio, api or cli. Open one to see each step with its input, output, time and error, and the run log. Approvals lists runs waiting for a person; designers can decide their own test runs there, and approvers decide deployed ones in the Approval Center.

A run: its steps, each with input and output, and the log.
A run: its steps, each with input and output, and the log.
Runs with the Stage filter: a studio test is a design run.
Runs with the Stage filter: a studio test is a design run.

15. Deploying and versions

The Sutra you edit is a draft. Deploy saves it as the next version (v1, v2, ...) and makes it live: its timer, file, email, message or Drive trigger starts listening, and its REST or SOAP service is published on the gateway.

  • Runs already in progress finish on the version they started with.
  • Editing after a deploy changes only the draft until you deploy again.
  • Other systems start a deployed Sutra with the Run API: POST /api/flows/{flowId}/run?wait=30000 with { "input": { ... } }.

Deploy is for development and system test servers. A server with SUTRA_ENVIRONMENT=production refuses it: production receives whole projects as release zips (Releases, below), so what runs there is always a reviewed, versioned package.

Exporting a Sutra application from the command line

A Sutra application is a project: its Sutras, connections, schemas and properties. Designers export it as a package or a release zip with the sutra command (on the studio machine, sutraflow cli runs it already signed in), the same as Project, Configuration, Releases in the designer:

ToCommand
Export the whole project as a release zip (package, deployment config to fill in, README, documentation)sutraflow cli package --project "Orders" --version 1.4.0 --note "Faster lookup" --zip --out orders-1.4.0.zip
Export only some Sutras, with the connections and schemas they usesutraflow cli package --project "Orders" --version 1.4.1 --sutras "Order lookup,Order feed" --zip
Export the package file alonesutraflow cli package --project "Orders" --version 1.4.0 --out orders-1.4.0.sutra
Export from the project's Git repository, with no server (CI)sutra package --from-git https://github.com/acme/orders.git --ref v1.4.0 --version 1.4.0 --out orders-1.4.0.zip
Run every Sutra of the export with its test data in a throw-away serversutra test orders-1.4.0.zip --secrets-from-env
Make its documentationsutra doc orders-1.4.0.zip --format html --out orders-1.4.0.html
From a studio on another machineadd --server https://studio:4800 --token $SUTRA_TOKEN (an API token of a system account)

Deploying the export on test and production servers is an administrator's task: secrets in the server's vault, its deployment config, sutra check, sutra deploy, history and rollback are in the Administration Guide, Receiving releases on a server, and every command with when to use it in The command line by task.

16. Documenting Sutras

Every step has a Description in its General tab, below its name: what the step does and why, in your words. SutraFlow makes the documentation of a Sutra or a whole project from the steps, their descriptions and settings, so the documentation is always the design itself.

A step's General tab: its name, then its Description, used by the canvas and the documentation.
A step's General tab: its name, then its Description, used by the canvas and the documentation.
  • On the canvas, a described step shows ≡ after its name; pointing at it shows the description.
  • The Sutra's General tab (click the canvas background) counts the steps without a description and has Documentation (a page to read, print or share) and Markdown (for a repository or wiki).
  • Releases has the documentation of the whole project, and every release zip carries it as documentation.html and documentation.md.
  • From a shell or a pipeline: sutra doc --project "Orders" --out orders.html, --sutra "Order lookup" for one Sutra, --format md for Markdown, or sutra doc release.zip for a release.
The documentation of a Sutra: what starts it and its steps in run order, each with its description.
The documentation of a Sutra: what starts it and its steps in run order, each with its description.

What the documentation holds

  • The Sutra's description, folder, version and whether it is deployed.
  • How it starts: each trigger with its main settings (REST path, timer schedule, folder, tool name).
  • Steps in the order a run reaches them, each with its activity, description and settings. Connections are named, never their ids; secrets by name only, never their values.
  • Where each step goes next, with the output and conditions, and which steps handle errors.
  • Connections and project variables used; Sutra variables; and the steps still without a description.
Writing good descriptions

Say why, not only what: "Skips unchanged files so no vectors are made again" beats "Add to knowledge".
Name the business rule a step carries out and who owns it.
Describe triggers for the people who call them: address, input, who may call.

17. Git: source control in the designer

The Git tab beside Project and Palettes keeps a project in a Git repository (GitHub, GitLab, Bitbucket, Azure DevOps or any Git server), with commits, branches, history and diffs, in the manner of a code editor's source control view.

The Git tab of a project that is not in a repository yet: Initialize or Clone.
The Git tab of a project that is not in a repository yet: Initialize or Clone.

Where the files live

The designer works on the project in SutraFlow's database as always. A project in Git also has a working copy on the SutraFlow server (<data>/workspaces): before Git looks at it, SutraFlow writes the project there as files, and after a pull, a branch switch or a discard it reads the files back. The repository holds readable files:

FileHolds
sutraflow.jsonThe project: description, variables (secret values never), logging, empty folders.
sutras/<folder>/<name>.sutra.jsonOne Sutra (its draft), in its folder.
connections/<folder>/<name>.connection.jsonOne connection; passwords and keys by secret name only, the values stay in each server's vault.
schemas/<folder>/<name>.json|.xsd|.wsdlA schema or WSDL as given, with its .schema.json beside it.

Team project and personal copies

  • Initialize repository puts a team project in a new repository and makes the first commit; Publish sends it to an empty repository on the server. Everyone with Design on the project commits and pushes it, each with their own Git account. This is the project that is deployed.
  • Clone repository makes your own copy, named "<name> (you)". Only you see it; it can be tested, never deployed; your changes reach others when you push, and theirs reach you when you pull. Several people's copies of one repository never share ids or edits.
  • Restricted mode: a clone opens restricted. Steps that run code or commands from the repository (PowerShell, shell scripts, programs, JavaScript, release steps, MCP commands) do not run until you click Trust the authors. Reading, editing and other steps work as usual.

Your own Git account

My Git accounts holds your personal access tokens for each server. They are encrypted, never shown again, and used only for your pull and push; nobody else, not even an administrator, can see them or push with them. Commits carry the account's author name and email, or your own. Each provider says which token to make (GitHub: a fine-grained token with Contents read and write). Public repositories clone without an account. OAuth sign-in buttons are not available; connect a personal access token.

Working with changes

A project in Git: branch main, two changed Sutras (M changed, A added), the commit message, and the graph.
A project in Git: branch main, two changed Sutras (M changed, A added), the commit message, and the graph.
  1. Changes lists what differs from the last commit, by item: Sutra, connection, schema or project settings, marked M (changed), A (added), D (removed). Click an item for its diff; a Sutra's diff names the steps added, removed and changed above the lines. ↺ undoes one change; Discard all undoes every change.
  2. Write a message and Commit (Ctrl+Enter), or Commit & Push.
  3. ⟳ syncs (pull, then push); ↓ pulls; ↑ pushes. ↑2 ↓1 beside the branch counts commits to push and to pull. A pull needs no uncommitted changes.
  4. ⑂ branch lists branches here and on the server and creates new ones; switching loads that branch into the project.
  5. Graph shows the history with branch labels; click a commit for the items it changed and their diffs.

Conflicts

When a pull finds that both sides changed the same item, the project is left as it was and the conflicting items are listed. Choose Mine or Theirs for each; when none are left the merge is finished and loaded. Abort the merge goes back to before the pull.

The Git program

SutraFlow uses the git command when it is installed (all features, SSH addresses), and its built-in Git otherwise (HTTPS only; a pull whose changes overlap needs the git command). SUTRA_GIT=system or builtin chooses. Tokens reach Git only through settings of the one command, never on its command line.

Guidelines

Deploy to production from packages built by your pipeline from the repository, not from a personal copy (Releases).
Keep secret values out of Git: connections name their secrets, and each server's vault holds the values.
Give each repository's tokens the narrowest rights: Contents read and write on that repository only.

18. How a Sutra runs

What happens to a Sutra once it starts explains most design choices: why a step should be safe to repeat, why large data should not travel from step to step, and why waiting costs nothing. How the engine does it inside (its workers, queue, database transactions, cluster leader and recovery) is described step by step on the architecture page.

One run, step by step

  1. Start. Something starts the Sutra: a call to its REST or SOAP service, a timer, a new file, a queue message, an email, a chat message or AI tool call, another Sutra (Call Sutra), or you pressing Test. A run begins, with a copy of the Sutra as it is now: deploying a new version never changes a run already going.
  2. Each step waits its turn. The first step after the starter is queued and taken by the next free worker of any engine, the Sutra's priority first, then the oldest. A step whose connection has a limit may wait for a place first (see Connection limits); waiting never uses a retry.
  3. The step runs. It sees {input} (what the step before it sent), {nodes.Step name} (the output of any step before it on its path; a step on another lane is refused, see What a step can see), {trigger}, {vars}, {gv} and {ev}, and runs within its time limit: 2 minutes for most activities, 10 for AI steps, longer for data platform steps, or what its Settings tab says.
  4. Its result is saved. The step's output is stored with the run, and the next steps are queued, together. From here on nothing is lost if the server stops.
  5. The path is chosen. The step's result goes out on one port (out, true, error, approved ...). Each connection from it is followed when its condition holds; a merge waits for every branch that can still arrive.
  6. Waits cost nothing. A step that waits (an approval, Ask a person, Call Sutra with wait, a timer, an AI agent waiting for a tool) holds no worker and no memory, for a minute or a month, and goes on when its answer comes.
  7. Callers get their reply. For REST, SOAP and AI tool callers the first reply step (Send HTTP response, SOAP reply, Reply to AI) answers at once; the run may go on after it. A caller gets 504 if no reply comes within the reply wait (60 seconds by default).
  8. The run ends when no step is left: done, or failed if a step failed with nowhere to go. An End step can finish it at once, as success or as an error.

When a step fails

  1. Retries (the step's Settings, else the Sutra's tuning): the step runs again after a pause that doubles each time (1 s, 2 s, 4 s ...). Other branches carry on meanwhile.
  2. Then the step's error output, when connected: it carries {input.error.message}, the step name and the input that failed; the run continues on that path.
  3. Else the Sutra's Error handler, when it has one: the other branches stop and the handler's path decides how the run ends.
  4. Else the run fails, with the step and the message. A failed run can be resubmitted (Runs, Admin Console, sutra runs resubmit): it runs again from the failed step with the same input, keeping everything before it.

Limits that protect the server

LimitDefaultSet in
Steps at once, per engineby machine size (4 to 32)Admin Console > Engines > Tuning; SUTRA_WORKERS
Steps per run10,000 (a loop that never ends is stopped)Engine tuning; SUTRA_MAX_STEPS
Step time limit2 minutes (AI 10 minutes)The step's Settings tab
Run time limit, runs at once, priority, retriesnoneSutra tuning (Admin Console > Applications)
Work on one connection at onceno limitThe connection's Maximum concurrent activities
Reply wait for callers60 secondsEngine tuning; SUTRA_REPLY_TIMEOUT_MS
Call Sutra depth10 levelsFixed
Loop on a step1,000 items (at most 10,000)The step's Settings tab
Run logthe last 500 lines in the run (the project log keeps everything)Fixed

Several engines

The studio is an engine with the designer; headless engines run Sutras only. All engines on one database share the work: add engines to run more steps at once. Timers and listeners run on one engine at a time, the leader, so nothing starts twice; if it stops, another takes over. An engine that stops in the middle of a step has that step run again by another engine. Setting up a cluster is described in Setting up a cluster, step by step.

What follows for design

  • At least once. A step whose engine dies mid-step runs again on another. Steps that change things (insert an order, send money, post a message) should be safe to repeat: use the run id or a business key as an idempotency key, or check before writing.
  • Waiting is free. Approvals, people and long timers cost nothing while they wait; no need to avoid them.
  • Outputs are kept for the run. Every step's output stays available to later steps for the rest of the run, and takes database space and time to read. Pass large data as a file or a table name, or stream it, instead of carrying it from step to step.
  • Names are the keys. {nodes.Step name} holds the latest output of that step; in parallel branches (For each) read the item from {input}, or call a Sutra per item.

19. Designing Sutras: patterns and good practice

How to shape Sutras so they are correct, fast, cheap to run and easy to look after. It builds on How a Sutra runs. The Sutra Design Guide sets the full design standards: naming, functions and transformations, REST and SOAP design, integration patterns, messaging, error handling, microservices and a review checklist.

Choose the pattern

You needPatternBuild with
An answer within seconds (an API, a lookup)Request and reply: a short path to the reply step, nothing slow before itREST service or SOAP service, work, Send HTTP response
Accept now, work later (an order, a long job)Acknowledge, then work: reply 202 with an id at once, continue after the reply; the caller checks a status API or gets a callbackSend HTTP response early, then the work; or Call Sutra without waiting
React to something happeningEvent driven: one Sutra per kind of eventFile trigger, Queue / topic trigger, Google Drive / Docs trigger, SharePoint / OneDrive trigger, Email trigger, ADF run finished trigger
Work on a schedule, or many recordsBatch: a timer, read a page of records, process, mark done, repeatTimer, SQL query with paging, For each or a called Sutra per record
The same logic in several SutrasSub-Sutra: one Sutra called by othersCall Sutra and Return
Decouple a fast producer from a slow consumerQueue: publish, and let a subscriber Sutra work at its own pacePublish message and Queue / topic trigger, or channels
A person decidesApproval (below)Human approval, Ask a person
Language, documents, judgementAI step, RAG or agent (below and AI concepts)The AI palette
Heavy data workOrchestrate, do not carry: let the database or the data platform do the work, the Sutra starts and checks itSQL script, Run ADF pipeline, Run Databricks job or notebook, Databricks SQL

Keep each Sutra small and named well

  • One business purpose per Sutra; ten to thirty steps is a comfortable size. Split larger ones into sub-Sutras.
  • Name steps by what they do (Find the customer, not SQL query 2): mappings, logs and the generated documentation use the names. Describe every step (General tab).
  • Keep values that differ per environment in project variables and connections, never in steps; secrets only in the vault.
  • Put Sutras in folders by business area; keep shared connections and schemas in the project, not copied.

Authentication and authorization at run time

Every running Sutra has two identity questions: who is calling it, and who it is when it calls other systems. Decide both when you design it, not when it goes live.

Who may call (inbound): every trigger on the gateway gets an API security policy (Resources). Choose by caller:

CallerPolicy authentication
Another system of yours, few callersAPI key (keys in the vault), or Basic
Partners, apps, many callers with limitsGateway apps: an app per caller with scopes and a plan; key or OAuth client-credentials token (/oauth/token)
Your company's single sign-on (Entra ID, Okta, Keycloak, Auth0)JWT: the identity provider issues tokens; the policy checks signature (JWKS), issuer, audience and scopes
Machines in a closed network, banks, B2BMutual TLS (client certificates), with an IP allow list
SOAP partnersWS-Security UsernameToken (with a time window and replay protection), or mutual TLS
AI assistants (MCP) and agent chatsA policy on the MCP server resource and on each agent channel entry (chat, OpenAI-compatible, A2A)

Add HTTPS-only, a rate limit and, for browsers, CORS origins. The designer and Deploy warn about a service without a policy.

Who the caller is, inside the Sutra: the trigger's output carries {trigger.auth.method}, {trigger.auth.subject} (the key's name, user, app or token subject) and, for JWT, {trigger.auth.claims}; and {trigger.client.ip}. Use them for authorization: a customer token may read only its own orders (where customer_id = :sub), a scope decides who may refund. Authentication says who; your Sutra decides what that caller may do.

Who the Sutra is (outbound): each call to another system signs in with a connection, never with values typed into steps:

CallingSign in with
REST and SOAP servicesAn HTTP connection with a security profile: Basic, bearer token, API key, OAuth2 client credentials (tokens fetched and refreshed for you), WS-Security (UsernameToken, SAML, X.509), client certificate
Google, Microsoft 365, YouTube, Twitch, Dropbox, FacebookAn OAuth connection: an account connected once (Connect account, sutra connect, or a refresh token secret)
Azure Data Factory, DatabricksA service principal or managed identity (or a Databricks token)
Databases, SFTP, mail, queuesA user of their own for SutraFlow; SFTP with a key and the host fingerprint checked
  • Least rights: an account per purpose and environment, with only the rights the Sutras use (read-only where reading is enough).
  • Secrets only in the vault, named in connections; each environment has its own values. Rotate them by changing the secret: no Sutra changes.
  • Do not pass the caller's credentials on: call other systems as the Sutra's own identity, and send the caller's subject as data when the other system needs to know who asked.
  • People in the run: approvals and Ask a person are answered by signed-in users with the right role; the answer records who decided. Pipelines and scripts use system accounts with API tokens, never a person's password.

Errors and reliability

  • Every step that talks to another system gets retries (Settings: 3 retries, 1 s first wait is a good start) and its error output connected where you can do something useful: a fallback, a message to the caller, a log with the input.
  • Use an Error handler for what is common to every failure: log it, alert, reply 500 to an API caller.
  • Make changing steps safe to repeat: an insert ... on conflict do nothing with a business key, an upsert, or a check first. Send the run id as an idempotency key to APIs that accept one.
  • Set time limits that fit: a short one on calls that should be quick, so a stuck system fails fast; a circuit breaker on HTTP connections stops calling a system that keeps failing.
  • Validate input at the door: a body schema on REST services, If steps with clear 400 replies.

Logging: what, when, where

LevelUse forExample
errorSomething failed that a person must look atPayment for A-1001 refused by the bank: card expired
warnUnexpected but handled; worth noticing if it repeatsStock service slow (4.2 s); used the cached price
infoBusiness milestones, one or two per runOrder A-1001 accepted: 3 lines, 2,450 INR
debugDetails for finding a problem; switched on only while neededPrice rule matched: wholesale, 15%
  • Log business keys (order number, customer id) so a line can be found from a support call; the run id is added for you.
  • Never log secrets, passwords, card numbers or whole personal records; secret values are masked, other personal data is your care.
  • Where it goes: the run's log (Runs), the project log file (Project > Logging: file, level, size, rotation; JSON for log collectors) and, from the server, metrics and traces.
  • Step data in history (Sutra tuning): all while you build, errors only in production for busy Sutras, none for Sutras that handle sensitive data.
  • Let alert rules watch for you (failed runs, slow runs, approvals waiting, gateway errors) instead of reading logs.

Database work

  • Always parameters (:name or ?), never values pasted into SQL: safe and faster (the database reuses the plan).
  • Properties and run data in one statement. A query usually needs both: Project and Engine properties for what differs per server (schema, table or database name), and run data (request input, trigger data, an earlier step's output, Local variables) for the values. Write both straight into the SQL:
    SELECT id, customer, amount
    FROM {{gv.SALES_SCHEMA}}.orders
    WHERE id = '{{input.orderId}}' AND status = {{input.status}}
      AND customer LIKE '%{{input.name}}%'
    Properties ({{gv.X}}, {{ev.X}}) are written into the statement, so the same Sutra runs on development, test and production. Every other reference is sent to the database as a bound parameter, never as SQL text: {{input.status}} becomes one parameter with its type kept, and a quoted text such as '{{input.orderId}}' or '%{{input.name}}%' becomes one text parameter, filled in. Even x' OR '1'='1 is then only a value. This works in SQL query, SQL update, SQL script, SQL transaction and Databricks SQL.
  • The Parameters field with :name in the SQL works as before and can be mixed with the above. Run data cannot be bound inside a "quoted" or `quoted` name, a comment or a $$ body; the step says so. On PostgreSQL, cast a parameter used in arithmetic: {{input.amount}}::numeric - 1.
  • When run data must change the statement itself (a sort column, a table chosen by the request), parameters cannot do it. Check the value against a fixed list first (an If / else or a mapping lookup) and build the text from the checked value; that check is the developer's responsibility.
  • Select only the columns you need, with a where on indexed columns; set Maximum rows.
  • Many rows: page them (order by id limit 500 after the last id), or let one SQL statement do the work (insert ... select, update ... where) instead of a step per row.
  • Several changes that belong together: one SQL transaction (all or nothing), or a stored procedure (Call procedure).
  • Connections are pooled per connection resource; keep pool sizes within what the database allows when several engines run.
  • Schema changes and setup scripts: SQL script in a release Sutra, not by hand.

Parallel work

  • Steps run in parallel when the Sutra branches: two connections from one output start both steps at once, on free workers of any engine. A Merge waits for all of them.
  • For each sends every item down its item branch as its own task, so items run in parallel too (up to the free workers), and done follows with the whole list. For work per item with several steps, call a sub-Sutra per item: each item then has its own run, its own {trigger}, retries and history.
  • A step's Loop setting runs the items one after the other, in order: for calls that must not overlap, or with a pause between them (rate-limited APIs).
  • To limit how much runs at once: Runs at once per Sutra (extra runs queue), Steps at once per engine, plans for gateway callers. AI conversations are kept in order per session by themselves.
  • To do more at once: raise Steps at once where steps mostly wait on other systems, or add engines on PostgreSQL.

Approval processes

  1. Prepare everything the approver needs first (amount, customer, history, a link), and put it in the question and the step's Details for the approvers: the approver decides in the Approval Center, on a computer or a phone, without opening other systems.
  2. Human approval for yes or no (outputs approved, rejected); Ask a person when the answer is text (outputs answered, declined). Name an assignee (a person or a role) so it lands with the right people.
  3. Decide by rules first: an If before the approval sends small amounts straight through, so people see only what needs them.
  4. Several levels: approvals in a row (manager, then finance above a limit), each with its own assignee.
  5. Escalation: an alert rule Approvals waiting notifies when one waits too long; a run time limit on the Sutra ends approvals nobody answers.
  6. After the decision: record it (who, when, comment are in the output) in your system, and tell the requester.

A waiting approval holds no resources, survives restarts and deploys, and is answered on any engine.

AI agents

  • Use the smallest AI that does the job: a single AI step to classify or extract; Ask knowledge to answer from documents; an agent only when the path to the answer is not known in advance.
  • Rules stay in ordinary steps: refunds, limits, approvals are decided by If and Approval, never by the model.
  • Few tools with clear names and descriptions; tools that change data are marked so, and checked inside the tool Sutra.
  • AI guard before the agent on public entry points; limits on steps, tokens and time; needs a person connected to Ask a person.
  • Keep Save steps on so every answer can be explained; review a sample of conversations regularly.

Large data

Every step's output is kept for the rest of the run and read by the steps after it. Steps of 1 MB measured 7.7 a second on one engine: it works, but data that does not need to be in a step's output should not be. So:

  • Carry references, not content: a file path, a row id, a blob address. Files: List / read directory without reading, then a sub-Sutra per file; save downloads to server files (Google Drive Save to: server file), not into outputs.
  • Stream large files with the steps that do (file copy and move, SFTP, Drive save, YouTube upload) rather than reading them into a step's output.
  • Page big queries and lists: 500 to 5,000 rows a page, one page per run or per sub-Sutra call.
  • Push the work down: SQL in the database, Spark in Databricks, copy activities in Data Factory; the Sutra orchestrates and checks.
  • Keep step outputs under a few megabytes; history keeps at most about 1 MB per step (larger outputs are cut to a preview there). Set Step data in history to errors only or none for Sutras that move a lot of data.
  • Large messages are stored once: a part of a run's input over 256 KB (a broker message body and its text, a file's content) is kept once in the engine database, and the run's data carries a reference to it; each step still gets the whole value, and callers get whole answers. A run with a 4 MB message writes about 4 MB instead of about 20 MB, and took 93 ms instead of 536 ms in a test. Traceability shows such a part as Stored once with a Download link; it is removed with the run by retention. Values made inside a run (a step building a large output) are still stored with that step; for very large data, pass files and stream them. 256 KB is not a size limit, only where storing once starts: a 1 MB or 20 MB input is accepted up to the service's Max body size (REST: 1024 KB unless changed). Change it with SUTRA_PAYLOAD_STORE_KB in sutraflow.env (0 never stores them apart) and the memory for parts read back with SUTRA_PAYLOAD_CACHE_MB (64); every engine of a cluster should use the same values.
  • Use mappings to keep only the fields the next steps need.

Making a process faster

  1. Measure first: Runs shows each step's time; Admin Console > Applications shows runs and failures per Sutra; Traffic shows gateway time per service; /metrics and traces give the details.
  2. Run independent calls in parallel branches with a Merge instead of one after the other.
  3. Reply to callers as early as possible; do the rest after the reply.
  4. Fewer, bigger operations: one SQL statement for many rows, bulk APIs, batches of messages.
  5. Avoid needless steps: a mapping can often replace several small transform steps.
  6. Cache what rarely changes (reference data in a project variable, a counter, or a small table read once).
  7. Keep step outputs small (large data, above).

Tuning a deployed app

SymptomLook atChange
Work waits in the queueOverview: work waiting; Engines: steps runningMore Steps at once (steps mostly waiting on other systems), more engines (busy CPU), priorities for urgent Sutras
A system you call is overloadedIts errors and time in RunsRuns at once for the Sutra; a loop with a pause; a circuit breaker on the connection
API callers get 504Traffic: time per serviceReply earlier; make the work asynchronous; raise Reply wait only as a last resort
The database growsDatabase page row countsRetention of runs, audit and the request log; Step data errors only; smaller outputs
Runs hangRuns with status waiting or runningStep time limits, a run time limit, alerts on slow runs and waiting approvals

Changes, versions and CI/CD

  • Keep the project in Git (the Git tab): a branch per change, a review before merging to main, a version tag for each release (v1.4.0).
  • Give every trigger realistic test data (test request, payload, test event): sutra test in the pipeline runs every Sutra with it, so a broken Sutra stops the release.
  • Build the release zip once, from the tag, in the pipeline; promote the same zip to UAT and production with each environment's deployment config; never deploy to production from the designer (production refuses it).
  • Change APIs so callers do not break: add fields rather than rename them; for a change that breaks callers, publish a new path (/v2/orders) beside the old one and retire the old one later.
  • Schema and database changes travel as SQL script steps in a release Sutra, written to run twice safely (create table if not exists).
  • Know the way back: sutra rollback or Releases > Roll back; a run in progress finishes on the version it started with.

The full pipeline, with GitHub Actions, GitLab, Azure DevOps and Jenkins examples, is in CI/CD pipelines.

In short

Small Sutras with one purpose, steps named and described.
Retries and an error path on every call to another system; changes safe to repeat.
References instead of large data; the database and data platforms do the heavy work.
Rules decide, people approve, AI assists.
Every entry point has a policy; every connection its own least-rights identity.
Release from Git through the pipeline; the same zip everywhere.
Measure before tuning; alert rules watch so people do not have to.

20. Strict boundaries and connection concurrency

This chapter covers two settings that protect the systems around a Sutra: checking data against a schema at the edges, and limiting how many steps use one connection at the same time.

Strict schema checks

Many steps can have a schema. With their Strict setting off (the default for older Sutras), the schema only describes the data, for mapping and documentation. With it on, the data is checked, and data that does not match stops the step with a list of what is wrong. A check never changes the data to make it fit: it does not convert types or remove extra fields.

  • AI tool: Strict tool input validation checks the arguments an assistant sends before the Sutra runs; Strict successful result validation checks the answer before it is sent back. An answer marked Is an error is not checked against the result schema. AI guard's JSON shape check blocks data that does not match its schema, and blocks everything when the schema is missing.
  • SOAP: Invoke SOAP service can check the request it sends and the reply it receives, each with its own setting. A SOAP fault is always treated as a fault, never as a reply. SOAP reply can check the reply the service sends.
  • Map: Strict target validation checks the result of the mapping against the target schema. The source and target field names may differ.

The fields that can be checked are listed in docs/schema-boundaries.md.

Connection limits

A database or an API can usually take only so many requests at once. Set Maximum concurrent activities on its connection (0 means no limit) and SutraFlow never runs more steps on it at the same time, across all engines that share the engine database.

  • Steps over the limit wait their turn. They do not hold a worker, and the wait does not use up their retries. Steps on other connections carry on.
  • A step that uses several limited connections starts only when it can have a place on all of them.
  • The limit counts steps, not runs or requests per second, and does not limit the gateway or the Admin Console. Calls made behind the scenes count too: a knowledge base's database and AI provider, listener polls and scheduled refreshes (see Connection limits).
  • A step that waits (for a person, a time or a reply) gives its place back while it waits and takes one again when it continues.
  • Places are given back when a step ends, fails or is cancelled, and the places of an engine that stopped are given back when the other engines notice it is gone.
  • Each connection has its own limit: two connections pointing at the same server each have their own count.
  • Sutras that run in memory share the same limit through the engine database. If that database cannot be reached, such a step fails rather than running without a limit.
  • Lowering a limit does not stop steps that are already running.

The limit can come from a project or engine property and can be changed in the deployment config. In a cluster, upgrade every engine before you rely on it. Because a step can be stopped after the other system has already received its request, make calls that change data safe to repeat (for example with an order number the other system checks).

Palettes and connections

21. Calling services: REST, SOAP and WS-Security

Outbound calls take two shared resources:

  • HTTP connection: base URL, timeout, default headers, certificate checking, extra trusted CAs, client certificate and key for mutual TLS, proxy.
  • Outbound security: how SutraFlow proves who it is.

Circuit breaker

When a service is down, waiting for every call to time out slows every run. On the HTTP connection, set Open the circuit after to a number of failures in a row (errors or 5xx replies). The circuit then opens: calls through that connection fail at once with "Circuit open" for the time you set, then one trial call decides whether it closes again. SOAP faults do not count; they mean the service is up. Combine it with retries and an error output that, for example, queues the work for later.

MethodForWhat is sent
BasicREST, SOAPAuthorization: Basic
BearerREST, SOAPAuthorization: Bearer
API keyREST, SOAPA header or query parameter.
OAuth 2.0 client credentialsREST, SOAPA token from the token URL, cached until it expires.
Custom headersREST, SOAPAny headers; values may use a Secret property, such as {{gv.API_TOKEN}}.
WS-Security UsernameTokenSOAPPassword digest (nonce and created) or text, optional timestamp.
WS-Security SAML tokenSOAPA SAML 1.1 or 2.0 assertion from the vault or from an earlier step (for example a token service call).
WS-Security X.509SOAPA binary security token and an XML signature over Body and Timestamp.
HMACHTTPThe body (with a timestamp, or the method, path and timestamp) signed with a shared secret, in the receiver's header names and format.

Every WS-Security profile can also encrypt the Body for the receiving service: paste its certificate under Encrypt the body for. A signed message is signed first, then encrypted, as receivers expect. AES-256-GCM is the default; choose CBC only for services that do not support GCM.

See Send HTTP request and Invoke SOAP service.

An HTTP connection after Test connection: base URL, timeout, server certificate check, optional CA, client certificate, proxy and circuit breaker. The test reports the HTTP status.
An HTTP connection after Test connection: base URL, timeout, server certificate check, optional CA, client certificate, proxy and circuit breaker. The test reports the HTTP status.

22. Databases, email, Firebase and apps

  • DB Ops works with PostgreSQL, MySQL/MariaDB, SQL Server, Oracle and SQLite. Parameters are written :name and are always bound, never pasted into the SQL. SQL script runs install scripts (tables, procedures, seed rows); a REST service with Call procedure then turns a stored procedure into a microservice, as Sample: Procedure as a microservice shows.
  • Email: SMTP to send, IMAP to start a run per incoming message.
  • Firebase: Firestore, Realtime Database and push notifications, with a service-account key held in the vault. To get the key: Firebase console, the gear beside Project Overview, Project settings, Service accounts, Generate new private key; a JSON file downloads, once. Paste the whole file into a Secret property and pick it as the connection's Service account key (JSON); Test connection says which project and account it signed in as. When Firebase answers Key creation is not allowed on this service account, the project belongs to a Google Workspace organization whose policy Disable service account key creation is enforced (the default for newer organizations): an Organization Policy Administrator turns it off for this project only (Google Cloud console, IAM and Admin, Organization Policies, the policy, Override parent's policy, enforcement off); extra roles on the service account do not help. The key gives full access to the project, past its security rules: keep it only in the vault and use one per environment. The Realtime Database URL is needed only for Realtime Database steps.
  • Apps (Google Sheets, Drive and Docs, Dropbox, YouTube, Facebook Pages) use an OAuth connection: create it in Resources, then click Connect account and sign in once. Tokens are stored in the vault and refreshed automatically. Connected API call reaches any other API of the same account.

Database connections

One resource kind, Database (DB Ops), serves every database: choose it under Resources, pick the database type, fill in the server and click Test connection. On this machine plain values are enough; for a server elsewhere, put host, database and user in Project properties and pick the password from a Secret property, so each environment gives its own.

PostgreSQL on this machine: 127.0.0.1, port 5432, database and user typed in.
PostgreSQL on this machine: 127.0.0.1, port 5432, database and user typed in.
PostgreSQL in the cloud: host, port, database and user from Project properties, the password from a Secret property, TLS on.
PostgreSQL in the cloud: host, port, database and user from Project properties, the password from a Secret property, TLS on.
MySQL on this machine: 127.0.0.1, port 3306.
MySQL on this machine: 127.0.0.1, port 3306.
MySQL on a hosting server: everything from Project and Secret properties. The server's name is hidden in this picture.
MySQL on a hosting server: everything from Project and Secret properties. The server's name is hidden in this picture.

23. MongoDB on Atlas M0

The MongoDB palette reads and writes documents in a MongoDB database: List MongoDB collections, Insert MongoDB documents, Find MongoDB documents, Update MongoDB documents, Delete MongoDB documents and Aggregate MongoDB documents. It has been tested on MongoDB Atlas, including the free M0 tier. It covers documents only: change streams, transactions, bulk writes and GridFS files are not part of it.

Configure the connection

  1. Keep the password in a Secret property. Under Configuration → Project variables, add a property of type Secret, select Enter new value, type the value and select Save. The value is encrypted at once and shown masked from then on; nobody can read it back, not even with the eye button.
  2. Choose how to sign in.
    • URI secret: the whole address with the user name and password, such as mongodb+srv://user:password@cluster0.example.mongodb.net, kept in one Secret property such as MONGODB_URI.
    • User name and password: the host, the user name and a Secret property for the password. Leave Advanced server URI empty, and keep SRV on for Atlas. The authentication database is usually admin; the database your data is in is set separately.
    • X.509: a client certificate and its private key (with a Secret property for its passphrase, if it has one) and, if needed, the CA that signed the server certificate. The certificate must already be mapped to a database user in MongoDB.
    The password and URI lists show only Secret properties of the project and of the engine. + Secret project variable makes a new one without leaving the connection. The connection saves the reference, such as {{gv.MONGODB_URI}}, never the password itself.
  3. Save, then Test connection. The test signs in and pings the server; it changes no data. Keep TLS verification on. In Atlas, the database user and the network access list (your server's address) must already be set up.
MongoDB Atlas after Test connection: URI secret mode, the whole mongodb+srv:// address held in one Secret property, TLS on, database amaron. The test changes no data.
MongoDB Atlas after Test connection: URI secret mode, the whole mongodb+srv:// address held in one Secret property, TLS on, database amaron. The test changes no data.

When the test cannot find the server

A mongodb+srv:// address needs DNS look-ups that some networks block. If the test fails before signing in, either copy the standard mongodb:// address (the list of hosts) from Atlas and use that, or ask an administrator to set SUTRA_DNS_SERVERS (for example 1.1.1.1, or your organisation's DNS servers) in the environment file and restart SutraFlow. That setting changes only the look-ups SutraFlow makes, not the server's own DNS. Never switch TLS off to work around it.

The activities

  • Collection: each activity names its collection in General, or takes it from the data in Input (Collection from input). A collection name that is given but not valid stops the step; it never falls back to another collection. List MongoDB collections lists the collections the user may see.
  • Insert adds one document or a list of up to 1,000.
  • Find finds many documents, finds one, counts or lists distinct values, with a filter, the fields to return, a sort order, skip and limit. A result is limited to 10,000 documents or 8 MB; when a query would return more, the step fails instead of returning part of it. Page through larger results with skip and limit.
  • Update changes one or many documents, replaces one, or finds one and changes it (returning it as it was before or after). Upsert adds the document when none matches. Array filters are supported for updates, not for replacements.
  • Delete removes one or many documents.
  • Aggregate runs a pipeline (see below). It only reads by default.

An update or delete of many documents with an empty filter would change the whole collection, so it runs only when you tick the setting that allows it.

Numbers and dates come back in MongoDB's Extended JSON, so no detail is lost: a number can arrive as {"$numberInt":"25"} and an id as {"$oid":"..."}. Map them to plain values in a Map data step when the next system needs them plain.

Aggregate: pipelines

Aggregate MongoDB documents filters, reshapes, groups and totals documents inside the database, like SELECT ... GROUP BY in SQL. It reads the collection chosen in the step; the data from the step before only supplies values for the pipeline.

A pipeline is a JSON list of stages that run in order: $match filters, $project picks or computes fields, $group combines documents, $sort orders them and $limit caps the number of rows. An empty list [] returns the whole collection, up to the result limit. This one counts and totals processed orders by status:

[{"$match":{"status":"processed"}},
 {"$group":{"_id":"$status","orderCount":{"$sum":1},"totalAmount":{"$sum":"$amount"}}},
 {"$sort":{"_id":1}},
 {"$limit":100}]

To use values from the run, build the pipeline with a formula: list(...) makes the list and object(key, value, ...) makes each stage. The sample finds the document of the current run:

=list(object('$match', object('_id', {run.id})))

A status from the trigger would be =list(object('$match', object('status', {nodes.Order input.status}))). Building values with a formula keeps their types; do not paste values into JSON text. Note the two kinds of reference: '$amount' is a field of the documents in MongoDB, while {input.amount} is a value of the run.

The step returns {documents: [...], count: N}, where count is the number of rows returned. After a $group the rows have the shape of the group, not of the collection, so give the step a schema for that shape if you want to map its fields. An empty result is not an error.

For the Atlas M0 tier, a pipeline may have up to 50 stages and may not write to disk or to another collection ($out, $merge). On other MongoDB servers you can allow up to 1,000 stages, disk use and output stages in the step's settings, if the database user may do so. No JavaScript runs on the database server. See MongoDB's aggregation pipeline guide.

What you can map from these steps

The Input tab shows the fields a step returns when it knows them: from a schema you chose for the step, or from the test run you selected. Find and Aggregate show documents and count, Count shows count, Distinct shows values and count, and Find one and update shows document and hasDocument. Without a schema or a test run, the fields inside the documents are not known yet: run a test, or choose a schema. A formula that uses run values shows no preview until you select a test run.

Checking documents against a schema

With Strict validation on, the step checks its documents against a JSON schema of the project: Insert checks each document before writing, Find and Aggregate check each document they return, Update checks the change and Delete checks the filter. The check stops the step before anything is written, but a step that already wrote some documents and then failed does not undo them. An update such as $set is only the change, not the whole stored document, so checking it does not prove the stored document matches. Validation rules you set in MongoDB itself always apply as well.

Run the sample

Add the sample MongoDB Atlas M0 document lifecycle and fill in its MONGODB_URI Secret project variable. Each run inserts one document marked with its run id, finds it, counts it, updates it, totals it with a pipeline, and finally deletes it. The last step removes the document on purpose, so the collection is empty after a successful run. To see the document in Atlas, copy the Sutra, remove its Delete step, run it, and delete that document yourself afterwards. Clearing test data in the studio does not undo what the run wrote to the database. The sample holds no passwords or data.

Strict schemas on triggers and called Sutras

Strict schema validation on a Manual start is off by default: the schema then only describes the data. When it is on, the test payload or the input is checked before a run starts. REST, SOAP and WebSocket triggers set to reject invalid check test and debug input the same way. Call Sutra can check what it sends and, when it waits, what comes back.

See Atlas's free tier limits and the Node.js driver documentation.

24. Memory tables: fast reference data

A memory table keeps small reference data in the memory of each engine, so a step or a mapping finds a value without a database round trip: currency rates, product and country codes, routing rules, limits per customer, reusable values that many Sutras read again and again. It is made like a connection (Resources → New → Memory table) and used with the Get Memory Record, Set Memory, Delete Memory Records, Query Memory Records and Refresh Memory Table steps, or with =memory-lookup('Table', key, 'field') in any mapping or setting.

Small data only

Memory tables are for values looked up often, not for big tables or files: each has a limit of rows and megabytes (10,000 rows and 16 MB by default, at most 100,000 and 256 MB), and a load query that returns more is refused. Big data stays in the database; big files are streamed in batches.

Where the rows come from

  • A load query on an Oracle, SQL Server, MySQL, PostgreSQL or SQLite connection loads the table at first use and on demand, at an interval, or from a cron expression with an IANA time zone. A WHERE clause loads only the part that is looked up often (active products, this year's rates).
  • A lookup query (optional) fetches a row that is not in memory, such as SELECT ... WHERE code = :key, and keeps it: the rest of a table is read only when asked for.
  • Sutras add and change cached rows with Set Memory; this never updates the external source database. An administrator can change a cached value by hand in the Admin Console.
  • Rows can expire after a time (Rows expire after), and when the table is full the least recently used rows go first.

Failsafe

Copy in the database (default)Memory only
A change (put, delete, by hand)Saved in memory and in the SutraFlow databaseIn memory of this engine only
Other engines of a clusterSee the change within a secondHave their own rows
An engine restartsHas every row at once, from the copy (the source is not asked)Loads from the source again; rows put by Sutras are gone
Cost of a changeOne small database writeNone

How it works

  • Each engine keeps a table as a key-value map in its own Node.js process (a JavaScript Map that also keeps the order of use, for dropping the least recently used rows). There is no extra server to run.
  • The failsafe copy is two tables of the SutraFlow database (SQLite or PostgreSQL): mem_rows holds each row with the version of the change that wrote it, mem_meta the latest version per table. An engine compares versions at most once a second (SUTRA_MEMORY_SYNC_MS) and reads only the rows changed since.
  • Reads (Get Memory Record, memory-lookup) cost no database work while the table is in sync.
  • A refresh builds and validates a replacement first, then swaps it atomically. A failed query, missing key or quota failure leaves the last good table available.
  • For a failsafe table, only the cluster leader runs a scheduled refresh; after failover the new leader continues. A memory-only table refreshes independently on every engine.
  • Connection details and Project and Engine properties are cached for the Settings refresh time and cleared when administrators change them.

The Admin Console

Admin Console, Memory tables: each table with its rows, memory and hit rate; an open table with its settings and rows, a page at a time
Admin Console, Memory tables: each table with its rows, memory and hit rate; an open table with its settings and rows, a page at a time

Operate → Memory tables lists every table with its project, rows and memory against its limits, hit rate, when it was loaded and its failsafe, filtered by project, name or failsafe. An administrator configures the source connection and queries, interval or cron refresh, time zone and table limits there; sets cluster and per-project record/MB quotas; and opens a table to inspect records, their approximate size and expiry.

  • Reload is a hot reload: this engine loads the table again now, and every other engine within a second. Sutras keep running.
  • Edit, Add row and Remove change a single value by hand, such as a rate, without a deploy.
  • Clear empties the table; a lookup query fills it again as rows are asked for.
  • The same from a command line: sutra memory list, rows, reload, clear, set and remove.

When an engine stops unexpectedly

With Keep: copy in the database (the default) every change is written to the database copy before the step goes on, so a crashed or restarted engine loads the table again from the copy, without asking the source, and has every change made before the crash. When the copy cannot be written (the engine database is out of reach), the change is taken back from memory too and the step fails; its retry makes the change again, so memory never holds what the copy does not. Keep: memory only tables start again from their source (or empty, when Sutras fill them) after a restart: use them only for data that can be loaded again.

Project release packages carry a Memory-table deployment descriptor: key fields, source database name and driver, referenced source objects, load and lookup queries, refresh/time zone, limits and failsafe mode. Package preflight rejects a missing database dependency, unsupported driver, empty load query, invalid cron expression or invalid limits before deployment.

Good uses

Values read on almost every run and changed rarely: rates, codes, mappings between systems, limits, feature switches. Keep it durable in your own database too when it matters (the memory table is a fast copy), and prefer a load query with a WHERE clause plus a lookup query over loading a whole table.

25. Files

File activities read and write text, CSV rows, lines, JSON, XML and binary (base64) in UTF-8, UTF-16, ISO-8859-1, Windows-1252 and other encodings.

  • With a row schema, CSV and lines become typed, repeating rows, ready for a For-Each in the mapper.
  • List / read directory takes wildcards: C:\in\*.csv, or =concat({gv.DIR}, '\*.csv').
  • Write file appends or overwrites, and always returns the file's name, path, size and what it did.
  • File trigger reacts to added, modified and removed files; move processed files away with Move / copy / delete file.

Big files: Stream in batches

A file read whole is held in memory, as text and again as rows, so Read file refuses files over its Maximum size (50 MB by default). CSV and line files of any size can be streamed instead: tick Stream in batches on Read file or List / read directory.

  • The file is read piece by piece. Every Rows per batch rows (1,000 by default) go out on the batch port as {input.rows}, with {input.batch} (1, 2, 3 ...), {input.count} and {input.file}. The steps connected to batch start at once, while reading goes on.
  • When the whole file is read, out gives the file details with {input.count} (rows) and {input.batches}: connect the steps that should run once, at the end, there.
  • Only a few batches are in memory or in the work queue at a time: reading pauses while more wait than the engine runs at once, or while the batches handed on (waiting or running) hold more than 8 MB of input (SUTRA_STREAM_BUFFER_MB), and one batch always goes on (back pressure). Memory and disk use stay the same for a 10 MB file and a 10 GB one. Measured in 2.1.4: a 48 MB document streamed in 54 parts of 2,000 lines into a pgvector knowledge base with 32 workers peaked at about 140 MB of live heap instead of 300 MB, in the same time, and the engine was back at its starting memory after the run.
  • The time limit of a streaming step counts from its last batch, so a long file is not cut off while it keeps sending batches.
  • The run keeps a summary of each batch in {nodes.Read orders} (number, count, file), not its rows: map the rows from {input.rows} in the step on the batch port.
  • Each batch is a step of its own, and counts towards Steps per run (10,000 by default): for 10 million rows, use batches of 5,000 or more, or raise the limit.
  • Set Step data in history to none for such Sutras: each batch step then keeps no input or output once it is done, and the database stays small. With all or errors only, every batch is kept until the run ends, so the database grows by about twice the file for a while. Measured: a 1 GB CSV file (18.6 million rows) on a 384 MB heap took about 2.5 minutes, the engine peaked at 270 MB, and the database ended at 4 MB with none, against 1.8 GB when every batch was kept until the end.
  • When the read step fails halfway and is retried, it starts the file again: make the batch steps safe to repeat (an upsert rather than an insert).
  • Stream big files in durable Sutras. In a Sutra that runs in memory, batches waiting for a worker are held in memory too.

SFTP and FTP servers

The SFTP / FTP palette works with files on another server: Remote file trigger, List remote files, Read remote file, Write remote file and Move / copy / delete remote file. Each step names the protocol and an SFTP server or FTP server connection.

  • Keep the server settings in that shared connection; do not repeat host names or credentials in activities. Every remote-file activity and trigger selects the connection in the designer and resolves it again on the engine at runtime.
  • Host, port, user, base folder, limits and even the name of the password or key secret can use Project variables such as {{gv.FTP_HOST}}. Deployment configuration has the last word, so an administrator can give test and production different values before deployment without editing the Sutra. Secret values themselves stay in each server's vault.
  • SFTP signs in with a password or a private key from the vault. Paste the server's host key fingerprint (Test connection shows it, as SHA256:...) so a different server is refused.
  • FTP uses explicit TLS (FTPS) by default; implicit TLS and plain FTP are there for old servers.
  • The base folder fences the steps in: a path such as ../../etc is refused.

Time limits for slow or far-away servers

A server in another region, or a busy one, can take a while to answer. Each SFTP or FTP connection has its own limits:

SettingDefaultWhat it limits
Connect time limit30 sReaching the server and signing in.
Response time limit60 sEach operation: a listing, a read, a write, a rename. A large file is one operation, so allow for its transfer time.
Connection attempts3Tries after a network failure. A wrong password or host key is not tried again.
Wait between attempts5 sThe pause before the next try.
Keep-alive every15 sSFTP only: keeps a slow session open through firewalls. 0 turns it off.

The step itself has a time limit too, in its Settings tab. SFTP and FTP steps and every AI activity allow 10 minutes by default (other activities 2 minutes); raise it for very large files or slow models. When a limit is passed, the error says which one, for example Reading inbox/big.csv took longer than 60 s (Response time limit of the connection).

26. Messaging: concepts and broker choices

The Service Bus palette works the JMS way: Publish message sends, the Queue / topic trigger Queue / topic trigger starts a run per message, and Confirm message acknowledges at a point you choose. It is a process starter even though it stays in the Service Bus palette, where its green ▶ identifies it.

  • Put queue and topic names in project variables ({{gv.ORDER_QUEUE}}) so each environment can use its own.
  • JMS headers: delivery mode (persistent or not), priority, time to live, message id, correlation id, reply-to and type; plus your own properties.
  • Only the elected leader subscribes. Other engines may execute the run's steps, but they do not open a second consumer. A replacement leader reopens the subscription after the lease changes.

Connections and broker runtimes

BrokerSutraFlow connectionBroker runtimeImportant setup
KafkaKafka protocol (KafkaJS), commonly TLS on the provider's service port.The broker normally runs on a JVM. SutraFlow's Node client does not need Java.For a private CA, put its PEM in Trusted CA certificates. SASL plain or SCRAM takes the password from a Secret property. Mutual TLS takes the client certificate and a Secret property holding its private key. Brokers, client id and certificates can come from Project or Engine properties, one value per environment.
RabbitMQAMQP 0-9-1, normally amqp://host:5672 or amqps://....RabbitMQ runs on Erlang/BEAM, not Java.Use a dedicated user and virtual host. Queue requeue does not add x-death, so SutraFlow counts in-place redeliveries and enforces the trigger ceiling itself.
ActiveMQ Classic / ArtemisAMQP 1.0, commonly port 5672 (this is separate from OpenWire/JMS).The broker runs on a JVM. SutraFlow's Node client does not need Java.Java applications may keep using OpenWire/JMS (Classic commonly 61616) while SutraFlow uses AMQP. On ActiveMQ Classic set the AMQP connector's transport.transformer=jms when the same messages cross between AMQP and OpenWire, so Java consumers receive normal JMS Text/Bytes/Map bodies rather than a native encoded AMQP section. Treat Container ID as a prefix; SutraFlow adds stable publisher/listener suffixes.
ActiveMQ Classic example

Keep OpenWire and AMQP on different ports, for example tcp://0.0.0.0:61616 and amqp://0.0.0.0:5673?transport.transformer=jms. Production listeners should use TLS variants and broker accounts rather than the sample administrator credentials.

What about broker REST APIs?

Use the native broker connections above for a Queue / topic trigger. They provide the broker's consumer groups, delivery credit or prefetch, acknowledgement, redelivery and partition-order guarantees. REST endpoints are useful when an HTTP-only system needs an occasional publish, query or administrative call:

  • Aiven Kafka REST can produce and consume through its Karapace REST proxy. Sample: Kafka REST publish shows production; Sample: Kafka REST subscribe shows the complete create consumer → subscribe → poll → commit offsets → close lifecycle. A new REST consumer configured with latest may skip a record published before its first poll establishes an offset; the sample uses earliest for deterministic demonstration. It is not selected as the connection of a Queue / topic trigger.
  • RabbitMQ HTTP API can publish and fetch. Sample: RabbitMQ HTTP publish and fetch declares a durable sample queue, publishes, fetches with ack_requeue_false, and removes the queue. RabbitMQ recommends AMQP for messaging because HTTP is less efficient and omits protocol features such as publisher confirms. RabbitMQ 4.x rejects deprecated transient non-exclusive queues by default, which is why the sample declares a durable queue and cleans it up explicitly. The HTTP API is RabbitMQ's management plugin, which is off in a fresh installation (the broker then listens only on 5672 and the HTTP calls are refused): enable it once with rabbitmq-plugins enable rabbitmq_management (Windows: sbin\rabbitmq-plugins.bat) and restart the broker; it answers on port 15672.
  • ActiveMQ Classic REST: Classic 6.3 disables the deprecated, unmaintained MessageServlet by default because it has security issues. Do not enable it for this sample. Sample: ActiveMQ REST publish and fetch uses the supported Jolokia management endpoint to create a queue, send, browse, remove the exact message, and clean up. That is management automation, not JMS consumption. Use AMQP 1.0 for SutraFlow triggers and OpenWire/JMS for Java clients so acknowledgement, selectors, durable subscriptions and redelivery stay broker-native. See the current ActiveMQ REST warning and Jolokia documentation.

Never put a username or password in a URL. Create an HTTP Connection, keep the password in the vault, enable TLS certificate verification, and map the endpoint path and body in Send HTTP request. See the provider's current REST documentation because paths and media types differ between products.

27. Broker connections, TLS and installation

A connection to Kafka, RabbitMQ or ActiveMQ is a project Resource. This chapter sets one up, for a broker on your own machine or a secured one in production. The next chapter covers sending, receiving and acknowledging messages.

Create and test the connection

  1. Open Resources, choose +, and pick Kafka, RabbitMQ or ActiveMQ / AMQP 1.0. Name it after the broker and environment, such as Orders Kafka (test).
  2. Fill in the fields in the tables below. Values that differ between environments, such as broker addresses, can be a Project property ({{gv.NAME}}) or an Engine property ({{ev.NAME}}). A certificate field takes either the PEM text or such a property.
  3. Passwords, private keys and key passphrases are always picked from Secret properties. The connection saves the property, never the value.
  4. Select Test connection. A successful test means the address was found and SutraFlow connected, agreed TLS and signed in. Sending and receiving are shown by the sample Sutras.
Kafka in the cloud: brokers from a Project property, TLS on with the provider's CA certificate file, SCRAM-SHA-256 login with the password from a Secret property. The test lists the topics it can see.
Kafka in the cloud: brokers from a Project property, TLS on with the provider's CA certificate file, SCRAM-SHA-256 login with the password from a Secret property. The test lists the topics it can see.
RabbitMQ (AMQP 0-9-1) on this machine: amqp://127.0.0.1:5672, virtual host /. Use amqps:// and the TLS fields for a remote broker.
RabbitMQ (AMQP 0-9-1) on this machine: amqp://127.0.0.1:5672, virtual host /. Use amqps:// and the TLS fields for a remote broker.
ActiveMQ through AMQP 1.0 on this machine: host, port 5673 here, user and password. Topic address prefix topic:// suits ActiveMQ Classic; Artemis leaves it empty.
ActiveMQ through AMQP 1.0 on this machine: host, port 5673 here, user and password. Topic address prefix topic:// suits ActiveMQ Classic; Artemis leaves it empty.
Kafka fieldWhat to enter
BrokersOne or more host:port addresses to start from. Cloud services usually give TLS ports.
Client IDA readable name for this installation, such as sutraflow-production, shown in the broker's logs.
TLS / Trusted CA certificatesTurn TLS on for cloud or encrypted brokers. Leave the CA empty when the broker's certificate is publicly trusted; for a provider's own CA (Aiven, for example) paste it. The certificate is always checked.
Client certificate / private keyFor mutual TLS: the client certificate, and a Secret property holding its private key (and one for its passphrase, if the key has one). Give both or neither.
SASLnone, plain, scram-sha-256 or scram-sha-512, as the provider says, with the user name and a Secret property for the password. Use SASL with TLS.
RabbitMQ fieldWhat to enter
URLamqp://host:5672/, or amqps://host:5671/ with TLS. No password in the URL.
Username / PasswordA RabbitMQ user for SutraFlow and a Secret property for its password. The built-in guest user usually works only on the broker's own machine.
Virtual hostThe virtual host that holds the queues and exchanges, often /. The user needs configure, write and read rights on the names it uses.
CA / client certificateWith amqps: the broker's CA if it is not publicly trusted; for mutual TLS also the client certificate and Secret properties for its key and passphrase.
ActiveMQ / AMQP 1.0 fieldWhat to enter
Host / Port / TLSThe broker's AMQP 1.0 port, not its OpenWire port (61616, used by Java applications). In the local example: localhost, port 5673, TLS off.
Username / PasswordA broker user and a Secret property for its password.
Container ID prefixA name for this installation, such as sutraflow-prod. SutraFlow adds a unique ending for each sender and listener, so two connections never push each other off.
Queue / Topic prefixActiveMQ Classic: empty (or queue://) for queues and topic:// for topics. Artemis: usually both empty, with topic addresses set up as multicast on the broker.
CA / client certificateWith TLS: the broker's CA if it is not publicly trusted; for mutual TLS also the client certificate and Secret properties for its key and passphrase.

Install and secure the broker

The broker is installed and looked after by its administrator; SutraFlow only connects to it. Follow the vendor's current documentation:

  • RabbitMQ (needs Erlang): the installation guide, the Windows service guide and the TLS guide. Open an AMQP 0-9-1 port (5672, or 5671 with TLS), create a virtual host and a user with only the rights SutraFlow needs, and a dead-letter exchange and queue where you want failed messages kept.
  • ActiveMQ Classic (needs Java): the getting-started guide. Keep two connectors: OpenWire (tcp://...:61616) for Java applications and AMQP (amqp://...:5672, or a free port such as 5673) for SutraFlow. For TLS see AMQP over SSL and the key store guide. When Java applications and SutraFlow exchange messages, add transport.transformer=jms to the AMQP connector.
  • Kafka (needs Java, or runs in the official container): the quickstart and security documentation, or your cloud provider's guide. Set up the listeners and the addresses they advertise, the topics, the access lists, and client certificates or SASL over TLS.

Certificates

  • Your own CA, for development or inside a company: OpenSSL can make a CA and sign a certificate for the broker and one for each client. The broker certificate must name the address clients use (Subject Alternative Name); client certificates need the client authentication usage. See the OpenSSL manuals, and never reuse test keys in production.
  • A public certificate, such as Let's Encrypt, for a broker with a public name: clients then need no CA pasted in. The broker administrator renews it. It proves the broker's name only; it cannot be a client certificate, and it cannot be issued for localhost or private names. SutraFlow's own Let's Encrypt page is for SutraFlow's gateway, not for a broker.
  • Mutual TLS: the broker trusts the CA that signed the client certificates and asks for one. In the connection give the CA and the client certificate; the private key and its passphrase come from Secret properties. Test connection must fail on a wrong name, an expired or untrusted certificate, a key that does not match, or a client the broker refuses.

Sample connections

The queue samples add connections for brokers on your own machine (Kafka, RabbitMQ, ActiveMQ) and secured ones (Kafka with TLS and SASL, Kafka, RabbitMQ and ActiveMQ with mutual TLS). Pick a matching connection on the trigger and on the sending step. The secured ones refer only to properties: fill those in for your environment before testing.

Four samples use a broker's HTTP interface instead: Sample: Kafka REST publish, Sample: Kafka REST subscribe, Sample: RabbitMQ HTTP publish and fetch and Sample: ActiveMQ REST publish and fetch. Their addresses, users, CA and passwords all come from properties, so nothing specific to one environment is in the Sutra.

28. Message activities, acknowledgement and recovery

This chapter sets up the three Service Bus activities and explains when a message is acknowledged, tried again, rejected or recognised as a copy.

Message formats

Publish message and Queue / topic trigger handle JSON, XML, text, map and bytes. XML is sent as text exactly as built (namespaces and attributes kept), with the type application/xml: build it with Render XML, and check a received document with Parse XML and an XSD. The received text is also in bodyText. A body that does not match its format (broken JSON or XML, a map that is not an object, bytes that are not base64) is never passed on as text: the run gets bodyError and fails at the trigger. XML with a DOCTYPE is refused. With client or explicit acknowledgement, such a message then follows the trigger's failure and retry settings; with auto it is already gone. An error path that handles the failure completes the run, so think about where Confirm goes.

One trigger per Sutra

A Sutra has exactly one trigger, with as many outputs as it offers (SOAP operations, file events). For a second source, make a second Sutra and put the shared work in a Sutra both call with Call Sutra. Error handlers are not triggers. Sample: XML queue in and out passes XML on unchanged and then confirms the message.

Brokers with a REST interface

A broker's REST address can have a different certificate issuer from its native port. Set the CA for each address on its own: if the REST address has a publicly trusted certificate, leave the CA of its HTTP connection empty, even when the native connection needs a private CA. Keep certificate checks on.

Observe a deployed message process

Open Admin Console → Applications and search for the project. Each deployed message Sutra appears with its Queue / topic trigger, started state, recent run count and last-run time. Choose Runs, then a run, to inspect each step and the broker message metadata. A green run shows successful workflow execution; in explicit mode also check that Confirm message completed at the intended business boundary.

Admin Console, Applications: RabbitMQ and ActiveMQ queue triggers deployed, each with a completed run started by a broker message.
Admin Console, Applications: RabbitMQ and ActiveMQ queue triggers deployed, each with a completed run started by a broker message.
A real ActiveMQ run in the Admin Console: the JMS-style message arrives through AMQP 1.0, the order is processed, and Confirm after processing completes. The broker message id and body remain visible in step outputs.
A real ActiveMQ run in the Admin Console: the JMS-style message arrives through AMQP 1.0, the order is processed, and Confirm after processing completes. The broker message id and body remain visible in step outputs.

Configure the three Service Bus activities

ActivityImportant optionsResult
Publish messageSelect the broker connection and queue/topic; choose JSON, XML, text, map or base64 bytes; map the body. XML must be serialized text, not an object. Delivery mode, priority, TTL, message id, correlation id, reply-to, JMS type and custom properties are portable JMS-style metadata. RabbitMQ can name an exchange. Kafka additionally uses a key (same key preserves partition order) and acknowledgements all, leader or none.Waits for broker acceptance and returns message id, destination, broker, connection and send time; Kafka also returns partition and offset.
Queue / topic triggerChoose queue or topic and the same connection. Kafka needs a consumer group and can read from the beginning for a new group. RabbitMQ may create a durable queue. ActiveMQ can use a JMS selector. Select JSON/XML/text/map/bytes, acknowledgement mode, duplicate protection, missing-id action, failure action, retry ceiling and concurrency.Starts one run per delivery with body, headers, properties and destination; non-binary wire text is also available as bodyText. Kafka supplies key, partition and offset.
Confirm messageUse only after a Queue / topic trigger set to explicit. confirm removes/commits; requeue asks for another delivery; reject does not return it to the source.Shows in the design where the message is safe to remove. Put it on every successful path.
Working samples

Add Sample: Queue in and out for a consume-transform-publish-confirm design, or Sample: Agent fed by a queue for a session-isolated AI worker. Each sample carries Kafka, RabbitMQ and ActiveMQ alternatives; choose one broker consistently on both message activities and fill its sample connection.

Choose when to acknowledge

ModeUse it whenDo not use it whenWhat SutraFlow does
Client — after success
(recommended default)
Every successful path may finish before the broker message is removed. Good for normal validation, transformation, database work and short integrations.You must confirm after one particular irreversible step, or the run may wait a long time for a person or child process.Acknowledges only when the whole run is done. A failed or cancelled run follows When the Sutra fails.
Explicit — Confirm messageThe safe acknowledgement boundary is visible in the design: for example, after an order is committed or a reply is published. Put Confirm message after that operation on every success path.You cannot identify one safe boundary, or a later step must be part of the same guarantee. Do not place it before the required outside effect: a later failure cannot bring an acknowledged message back.confirm acknowledges; requeue asks for another delivery; reject (dead-letter) rejects it. If the run ends without reaching Confirm message, SutraFlow treats that as failure and releases or rejects it according to the trigger settings.
Auto — on receiptOnly for disposable events where losing a message is acceptable, such as best-effort telemetry already stored elsewhere.Orders, payments, file movement, customer requests, approvals, or anything that must survive an engine crash.The broker considers the message handled before the Sutra runs. A crash or failure therefore cannot redeliver it.

Failure, redelivery and duplicate protection

  1. Before a run starts for a message, SutraFlow records the message's identity in the engine database, with the run. Kafka always provides topic/partition/offset. RabbitMQ and AMQP 1.0 (ActiveMQ, Artemis) use the message id. When publishers send no message id (common with RabbitMQ), set Duplicate key to a value that is unique per message, such as {{body.orderId}} or {{headers.correlationId}}; without an id or a key, the broker can redeliver but SutraFlow cannot recognise the copy. Messages without an id chooses what happens to such a message: process (the default: it runs, without duplicate protection) or reject (dead-letter), which sends it to the broker's dead-letter queue so publishers can be corrected. JMS brokers such as ActiveMQ always give a message id; in AMQP and RabbitMQ it is optional.
  2. To take only some messages from a destination, use a Message selector on ActiveMQ / AMQP 1.0 (a JMS selector such as type = 'order' AND priority > 4, applied by the broker before delivery). RabbitMQ and Kafka have no selectors: on RabbitMQ choose topic and a binding pattern such as orders.eu.*; on Kafka use a topic per kind of message, or an If / else after the trigger.
  3. If a run fails, choose requeue to try it again, or reject (dead-letter) to stop returning it to the source. Reject after this many deliveries changes repeated requeues into a rejection at the configured count; zero means never reject because of the count. For RabbitMQ and ActiveMQ, configure the broker's dead-letter exchange/address as well—SutraFlow rejects the delivery but does not create that destination. Kafka has no reject/dead-letter operation: reject or reaching the ceiling commits the source offset. If the event must be retained, publish it to a retry or dead-letter Kafka topic before Confirm.
  4. If an acknowledgement is lost, or another engine receives the same message, SutraFlow finds that record. A completed run is acknowledged without a second run. A failed or cancelled run releases the reservation and may run again. While the first run is still active or waiting (an approval can take days), the copy never starts a second run:
    • RabbitMQ and ActiveMQ / AMQP 1.0: the copy is held unacknowledged and settled when that run ends: acknowledged when it finished, returned to the queue for a new run when it failed or was cancelled. Nothing is redelivered meanwhile, so the broker's delivery count does not climb (ActiveMQ's redelivery limit and RabbitMQ quorum queues' delivery limit would otherwise dead-letter it), and each held copy gets one more delivery slot (prefetch or credit), so other messages keep flowing. The trigger's status says a copy is held. If the engine stops or leadership moves, held copies go back to the broker and the new leader holds them again.
    • Kafka: messages of a partition are handled in order, so the partition pauses and checks again every 5 seconds until the run ends; other partitions go on.
  5. This stops a second run of the Sutra for the same message, but it cannot undo a call to another system made just before a crash. Send the message id to payment, order and other APIs that change data, as their idempotency key, and make database rows unique where you can.

Differences between brokers

  • ActiveMQ: when Java (OpenWire) applications and SutraFlow share messages, the AMQP connector needs transport.transformer=jms, or message bodies do not match.
  • RabbitMQ: a plain requeue does not add the x-death header, so SutraFlow counts the attempts while its listener holds the message. Set a dead-letter exchange on the broker as well, for messages that must never be lost.
  • Kafka: trying again means reading the same offset again, not returning a message to a queue. The attempt count lives in the current listener; for a limit that survives a restart of every engine, send failed messages to a retry or dead-letter topic.

How each broker was tested is in the architecture page, under Messaging certification and benchmark record.

A good default

Use client acknowledgement, duplicate protection on, requeue on failure, a limit on deliveries and a dead-letter queue on the broker. Use explicit only when there is one clear point after which the message is safe. Use auto only when losing a message does not matter. For a long approval, save the request (in a database or memory table) and confirm the message then, instead of holding one message for hours.

29. WebSockets: live connections

A WebSocket is a connection that stays open, so either side can send at any time: a page that shows an order's status as it changes, a dashboard, a device. SutraFlow serves WebSockets on the gateway, and connects to other WebSocket servers.

A WebSocket service, step by step

  1. Add a WebSocket service trigger. Set its path (/ws/orders) and an API security policy.
  2. Connect its message output to the steps that handle a message, and end with WebSocket send (this connection) to answer.
  3. Optionally connect open (a client connected: send a welcome, or keep its connectionId in a memory table) and close.
  4. Deploy. Clients connect to ws://host:8080/ws/orders or wss://host:8443/ws/orders.
const ws = new WebSocket('wss://api.example.com:8443/ws/orders?access_token=' + token);
ws.onmessage = e => console.log(JSON.parse(e.data));
ws.onopen = () => ws.send(JSON.stringify({ type: 'watch', orderId: 'A-1001' }));

Security

  • The policy is checked once, when the client connects: API keys, JWT, token introspection, gateway apps, Basic, mutual TLS, IP lists and rate limits work as for REST.
  • Browsers cannot set headers on a WebSocket: they pass a token as ?access_token=, or the API key under the policy's key header name, such as ?X-API-Key=.
  • With CORS origins on the policy, only pages from those origins may connect.
  • Each message is checked for size (Max message size), nesting and the policy's threat limits, and against the message schema when Validate messages is on. A bad message gets an error message back and starts no run.

Pushing and broadcasting

WebSocket send can write to any connection by its id (from an earlier message, a memory table, or a database), or to every connection of a service. In a cluster a connection stays on the engine that accepted it; a step on another engine leaves the message in the database and that engine delivers it within a fraction of a second. The Designer's Services page lists the WebSocket services with their ws:// and wss:// addresses.

Order and load

By default a connection's messages are handled one at a time, so answers come back in order. Turn One message at a time per connection off for independent messages that may run side by side. A client that sends faster than its runs finish is closed after 1,000 waiting messages rather than filling memory; a client that stops answering pings is dropped after 30 seconds.

Connecting to other WebSocket servers

  1. Create a WebSocket connection in Resources: the address (wss://...), headers such as Authorization = Bearer {{gv.STREAM_TOKEN}} (a Secret project property), and how it reconnects.
  2. For a stream, add a WebSocket client with the subscribe message the server expects. Each message it receives starts a run; when the connection drops it reconnects and subscribes again. In a cluster the leader holds the connection.
  3. To ask once and wait for the answer, use WebSocket client send, with Answer has field when the server sends other messages on the same connection.

30. Dashboards

A dashboard is a page of charts on the gateway, made by a Sutra: its data comes from your queries and APIs, its charts are drawn in the browser by Apache ECharts, which SutraFlow serves itself (no CDN, works offline).

Build one

  1. Start the Sutra with Dashboard page: a name (the page is /dash/<name>), a title, who may see it (a security policy), how often it refreshes, and whether the results are the same for everyone or kept per caller.
  2. Query the data: SQL query, Find MongoDB documents, Send HTTP request, a memory table, anything that gives rows. Branches run in parallel.
  3. A Chart step per chart: rows, chart type (bar, horizontal bar, line, area, pie, donut, scatter, a number, a KPI card, a gauge, a table), the category field and the value fields, grouping, sorting, a limit, a unit and colours.
  4. A Merge when there are branches, then Dashboard reply with the charts in the order the page shows them.
  5. Deploy, and open http://<gateway>/dash/<name>. The Dashboard page step links to its page once deployed, says not deployed before that, and asks to deploy again when the draft's name differs from the deployed page.
The Dashboard page step of a Sutra not yet deployed: it says so under the page name, and links to the page once deployed.
The Dashboard page step of a Sutra not yet deployed: it says so under the page name, and links to the page once deployed.

Filters (slicers)

The Dashboard page's Filters put controls at the top of the page, one per row: the field, then list, multi list, date range, number range or search; fixed choices after a colon (list: North, South). Without fixed choices, a list offers the Filter choices of Dashboard reply (such as the rows of SELECT DISTINCT region FROM orders), else the values the charts show. The chosen values are in the page address (a link opens the same view), the page asks for new data at once, and a click on a bar, a slice or a table row sets the filter of that chart's category field; a second click clears it.

  • On a database: use {{trigger.params.<field>}} in the SQL; it is a bound parameter, never pasted into the SQL. Every filter is there, empty when nothing is chosen: WHERE ({{trigger.params.region}} = '' OR region = {{trigger.params.region}}). A multi list holds the values joined by commas (MySQL FIND_IN_SET(category, {{trigger.params.category}}) > 0, PostgreSQL category = ANY(string_to_array({{trigger.params.category}}, ','))); a range is <field>_from and <field>_to. Return dates as text (DATE_FORMAT, to_char) so months do not shift with time zones, and connect the query's empty port to the charts too.
  • On JSON (an API, a file, a memory table): Chart steps apply {{trigger.filters}} to their rows themselves.

Raw rows, KPI cards and AI

A Chart step groups raw rows by itself: Group and add up (sum, average, count, distinct count, min, max), Dates by (day, week, month, quarter, year) and Split into series by a field; nested fields are written customer.city, and List inside finds the list in an API answer. A KPI card shows the total, or the latest period with the change against the one before (or a value from another query), a small trend line and how far it is from a target. Charts from AI plans a set of charts for rows it has never seen: an AI model chooses from the field names (and a few rows, when allowed), or built-in rules without a model; every chart is checked and the numbers come from the rows.

Refresh and cache

The page asks for data every Refresh every seconds. The answer is kept on the server for that time and shared: a hundred viewers within a minute cause one run, and viewers arriving while a run is in progress wait for it rather than starting another. With Results are the same for: each caller, each signed-in caller has results of their own (a dashboard that shows each customer their own orders). The page's query parameters reach the Sutra as {trigger.params} and are part of the cache key.

Who may see it

The page itself holds no data; the data request (/dash/<name>/data) goes through the dashboard's security policy like any API: API key, gateway app, a website's login (JWT) or single sign-on. To put a dashboard on another web page, add <script src="http://<gateway>/dash/<name>/embed.js" data-height="720px"></script>; a page with its own login sets window.SutraDashboard = { token: () => accessToken } first, as for the chat button. With no policy, anyone who reaches the gateway sees it.

AI-suggested charts

An AI prompt can be asked to choose the chart for some rows (type, title, category, values, colours) and answer as JSON; put that JSON in the Chart step's Settings from a step. Only known settings, chart types and palettes, and fields that are in the rows are used; anything else is refused, logged as a warning, and the step's own settings are used. The data always comes from the rows, never from the model.

Export

Every chart has PNG and SVG buttons; numbers and tables are text on the page. Sample: Sales dashboard (New Sutra, Samples) has five charts from SQL queries and an AI-style suggestion that is partly refused; Sample: Sales dashboard on a database reads a MySQL orders table with filters for region, categories and dates, KPI cards and click-to-filter; Sample: Dashboard from JSON groups an API answer by itself, filters it, and adds charts planned by Charts from AI.

31. Azure Data Factory and Databricks

The Azure Data Factory & Databricks palette runs and watches data work on those platforms from a Sutra: start a pipeline, notebook or job when something happens (a file arrived, an order batch closed, a person approved), wait for it, and act on the outcome.

Connections and sign-in

Sign in withWhenSet up
Service principal (client secret)Servers anywhere: the usual choice for productionEntra ID > App registrations > New; a client secret; give the app the Data Factory Contributor role on the factory (Access control), or add it to the Databricks workspace as a service principal. Keep the secret in a Secret property and pick it on the connection.
Managed identitySutraFlow running on an Azure VM, App Service or containerTurn the identity on for that resource and give it the same role. No secret at all.
Azure CLI (az login)Development machinesRun az login as the account SutraFlow runs under.
Personal access token (Databricks)Trying things outUser Settings > Developer > Access tokens; keep it as a secret.
Databricks OAuth (service principal)Databricks on AWS or Google Cloud, or without Entra IDA service principal in the account console with an OAuth secret.

Test connection signs in and reads the factory and its pipelines, or the workspace user, the default cluster and the default SQL warehouse, so a wrong secret, role or address shows before any run. Azure China and US Government clouds are a setting.

Steps

  • Run ADF pipeline runs a pipeline with parameters and waits: out on success, failed with the failing activities. It can rerun an earlier run from the failed activity.
  • ADF pipeline run gets, waits for or cancels a run, lists activity runs, recent runs and pipelines, and starts or stops factory triggers.
  • ADF run finished trigger starts a Sutra when any pipeline run ends: alerts, approvals before a rerun, follow-on work.
  • Run Databricks job or notebook runs a job or a notebook (cluster, serverless or a new job cluster) and returns the notebook's exit value.
  • Databricks code block runs one Python, SQL, Scala or R block on a cluster, starting it when stopped.
  • Databricks SQL runs SQL on a SQL warehouse with named parameters.

Long work is polled with the step's own wait limit; when the limit runs out the run is cancelled (if ticked) and the step says where to look. The designer and Deploy warn when a connection, pipeline name, notebook path or SQL is missing.

Templates

New Sutra → Samples → Azure Data Factory: run, monitor, rerun and Databricks: notebooks, SQL and code blocks add four Sutras in Samples/Azure and Databricks, with placeholder connections to fill in.

Good practice

Give each environment its own service principal with only the roles it needs; production uses a managed identity where it can.
Keep pipeline and notebook logic in the platform; let the Sutra decide when to run and what to do with the outcome.
Connect the failed output: a quiet failure is the costly one.

32. YouTube, Twitch and social media

The Apps and social palette works with YouTube (YouTube), Twitch (Twitch, Twitch live trigger), Discord (Discord, Discord trigger), Telegram (Telegram, Telegram trigger), Facebook Pages (Facebook Page), Google Drive and Sheets, Dropbox, and any other service with OAuth through Connected API call.

Accounts: OAuth, not passwords

These services do not accept a user name and password from other programs; an account is connected once with OAuth, and SutraFlow keeps its tokens encrypted and refreshes them. For each service:

  1. Register an app with the service: Google Cloud console (APIs: YouTube Data API v3, YouTube Analytics API, Drive, Sheets; an OAuth client of type Web application), or dev.twitch.tv > Your Console > Applications.
  2. Give the app the redirect address shown on the connection (http(s)://your-server:port/api/oauth/callback).
  3. Add an OAuth connection: the service, the client id, the client secret (from a Secret property), and the scopes.
  4. Sign in: Connect account in the studio. Test connection then names the account, YouTube channel or Twitch user.

Discord and Telegram

These use keys, not OAuth. Discord: a webhook address (Channel settings > Integrations > Webhooks) posts to one channel with nothing to install; a bot (discord.com/developers > Applications > Bot) sends to any channel it is invited to and, with Message Content Intent on, lets Discord trigger answer commands such as !status A-1001. Telegram: @BotFather's /newbot gives a token; Telegram trigger receives messages by long polling, so the server needs no public address. Keep the webhook address and bot tokens as secrets: on production, set them in that server's vault.

Videos from Google Drive to YouTube

YouTube uploads a file on the server. For videos kept in Google Drive, put Google Drive / Docs first with download and Save to: server file (streamed, so large videos are fine), then YouTube upload video with {{input.path}}. The sample Publish Drive videos to YouTube does it for every new video in a Drive folder and removes the server copy afterwards. Upload as private, check, then publish with update video or Publish at.

Templates

YouTube: publish from Google Drive, weekly analytics, Twitch: going live, Discord: order status bot and Telegram: order status bot and alerts in New Sutra → Samples (folder Samples/Social media).

33. OAuth connections step by step: Google, Microsoft, Dropbox, Facebook, Twitch

How OAuth works in SutraFlow

OAuth lets SutraFlow act for an account without ever knowing its password. The account owner signs in at the provider (Google, Microsoft and the others) and agrees to what SutraFlow may do (the scopes); the provider then gives SutraFlow two tokens:

  • an access token: the key a step shows with every call; it works for about an hour;
  • a refresh token: used by SutraFlow to get a new access token when the old one runs out, without asking the person again. It lasts until the access is withdrawn (or, for some providers and settings, a set time: see the notes below).
  1. You press Connect account. SutraFlow opens the provider's sign-in page with your client ID, the scopes and its redirect address, plus a signed code (state) that expires in 10 minutes.
  2. The account owner signs in and allows the access. The provider sends the browser back to SutraFlow's redirect address with a one-time code.
  3. SutraFlow checks the state, then exchanges the code for the tokens with your client secret, read from the vault at that moment.
  4. The tokens are stored encrypted in SutraFlow's database. Every engine of a cluster reads them there, so one sign-in serves them all; another server (test, production) signs in on its own.
  5. Each step that calls the service uses the access token. Shortly before it expires SutraFlow refreshes it by itself; you see nothing of this.

So the client ID and secret identify SutraFlow (your app at the provider), the sign-in picks the account, and the scopes say what may be done with it. Disconnect (or withdraw the access at the provider) and the tokens stop working.

OAuth also appears in SutraFlow asWhat it is for
Outbound security profile OAuth client credentialsCalling an API as a machine (no person signs in): a client ID and secret get a token directly. See Calling services.
Gateway appsThe other way round: SutraFlow gives tokens (POST /oauth/token) to the apps that call your services. See The API gateway.
JWT and token introspection in API security policiesChecking tokens your identity provider gave to callers of your services. See Exposing APIs.
Single sign-onPeople signing in to the designer, the Admin Console and the Approval Center with your identity provider (OpenID Connect, built on OAuth). See Secrets and studio security.

Setting up a connection

Google Drive, Sheets, Docs and YouTube, SharePoint and OneDrive, Dropbox, Facebook Pages and Twitch are all set up the same way, in three places:

  1. At the provider (once): register an app. It gives a client ID and a client secret, and you tell it SutraFlow's redirect address.
  2. In the designer: an OAuth connection holds the client ID, the secret's name and the scopes; Connect account signs in once, and the tokens are kept encrypted.
  3. On each server you deploy to (Admin Console, command line): the secret is put in that server's vault and the account signed in there, because tokens never travel with a release.
The redirect address

It is where the provider sends the browser back after sign-in: your studio's address followed by /api/oauth/callback, for example http://127.0.0.1:4800/api/oauth/callback on your own computer or https://sutra.example.com/api/oauth/callback behind a proxy. The OAuth connection shows the exact address under Account; copy it from there. Providers want https:// for anything but 127.0.0.1 and localhost.

In the designer: the part that is the same for every provider

  1. Keep the client secret in a Secret property. Configuration → Project variables: add a property of type Secret, for example GOOGLE_CLIENT_SECRET, and enter the value. It is encrypted, and nobody can read it back.
  2. Create the connection. Resources → + → OAuth connection. Choose the Service (google, microsoft, dropbox, facebook, twitch, or custom), paste the Client ID, pick the secret under Client secret, and set the Scopes (the provider sections below say which). Save.
  3. Register the redirect address. The connection now shows Register this redirect URI with the address to copy into the provider's app (each provider section says where).
  4. Sign in. Click Connect account. A window opens at the provider: sign in with the account the Sutras should use and allow the access asked for. The window closes and the connection says Connected, and Tokens refresh automatically when the provider gave a refresh token.
  5. Check. Test connection reads the account (the Drive user, the YouTube channel, the Microsoft user, the Dropbox account).
  6. Use it. Pick the connection in Google Drive / Docs, Google Sheets, YouTube, SharePoint / OneDrive, Dropbox, Facebook Page, Twitch or Connected API call (Connected API call), and in their triggers.
One app per environment

Make one app (one client ID) for development and another for production, ideally in separate projects or registrations, each with its own redirect address. A test account in development and a service account or shared mailbox in production keep people's own files out of your Sutras.

Google: Drive, Sheets, Docs, YouTube

  1. Open console.cloud.google.com and sign in. Top left, next to the Google Cloud logo, choose a project or New project (for example SutraFlow production).
  2. Turn on the APIs: menu → APIs & Services → Library. Search and Enable each one the Sutras use: Google Drive API, Google Sheets API, Google Docs API, YouTube Data API v3, YouTube Analytics API.
  3. The consent screen: APIs & Services → OAuth consent screen (newer consoles: Google Auth Platform). Choose the user type: Internal if you have Google Workspace and only your organisation's accounts sign in (no review, tokens do not expire); otherwise External. Fill in the app name and support email.
  4. With External, add the accounts that will sign in under Audience → Test users while the app is in Testing.
  5. Create the client: APIs & Services → Credentials → Create credentials → OAuth client ID. Application type: Web application. Name it. Under Authorized redirect URIs (not Authorized JavaScript origins, which takes no path) click Add URI and paste the connection's redirect address. Create.
  6. Copy the Client ID and the Client secret (or Download JSON). The secret goes into the vault; the ID into the connection.
  7. Scopes in the connection, space separated, only what the Sutras need:
    ScopeGives
    https://www.googleapis.com/auth/driveEvery file and folder the account can open (Drive steps and trigger)
    https://www.googleapis.com/auth/drive.readonlyReading only
    https://www.googleapis.com/auth/drive.fileOnly files SutraFlow made or uploaded; not folders and files made in Drive by people
    https://www.googleapis.com/auth/spreadsheetsGoogle Sheets
    https://www.googleapis.com/auth/documentsGoogle Docs
    https://www.googleapis.com/auth/youtube.upload, .../youtube.readonly, .../yt-analytics.readonlyYouTube upload, reading, analytics
  8. Back in the designer: Connect account, sign in, Test connection.
Testing apps lose their sign-in after 7 days

While an External app's publishing status is Testing, Google ends its refresh tokens after seven days, and the connection must sign in again. For anything that runs unattended, use an Internal app, or press Publish app on the consent screen. Apps that ask for the full drive scope and are used by more than 100 people outside your organisation need Google's verification; for your own accounts the warning page at sign-in (Advanced, Go to the app) is enough.

Folder and file IDs. Open the folder in drive.google.com: the address ends with its ID, https://drive.google.com/drive/folders/1bWYnLxM6Ea_YecThA1FUQyQXN1cWMWTq. A file: https://drive.google.com/file/d/FILE_ID/view; a Doc or Sheet: https://docs.google.com/document/d/ID/edit or /spreadsheets/d/ID/edit. Folders on a shared drive work the same way; root is the top of My Drive. Google Drive / Docs with List shows the ID of every file in a folder. Keep folder IDs in project variables ({{gv.DRIVE_INBOX}}) so each environment can have its own.

Big files and slow links. Download with Save to: server file and upload with Upload from: server file: both stream, whatever the size. Wait for each call (5 minutes by default) and the step's time limit (30 minutes) can be raised for slow connections.

Microsoft: SharePoint and OneDrive

  1. Open portal.azure.com → Microsoft Entra ID → App registrations → New registration.
  2. Name it. Supported account types: this organizational directory only for your company's SharePoint and OneDrive (most cases); any organizational directory and personal Microsoft accounts for personal OneDrive too.
  3. Redirect URI: platform Web, the connection's redirect address. Register.
  4. On the app's Overview, copy the Application (client) ID and the Directory (tenant) ID.
  5. Certificates & secrets → New client secret: a description and an expiry (at most 24 months; note the date, the connection stops working when it passes). Copy the Value (not the Secret ID); it is shown only once. Put it in the vault.
  6. API permissions → Add a permission → Microsoft Graph → Delegated permissions: Files.Read.All, Sites.Read.All, offline_access, User.Read (and Files.ReadWrite.All to write). Then Grant admin consent if your organisation requires it.
  7. In the designer: Service microsoft, Tenant = the Directory (tenant) ID or your domain (contoso.onmicrosoft.com) for a single-organisation app, common otherwise; Client ID; the secret; Scopes Files.Read.All Sites.Read.All offline_access User.Read. Connect account.

Sites and folders. SharePoint / OneDrive takes a SharePoint site address (https://contoso.sharepoint.com/sites/Finance), a document library (leave it empty for the default one, Documents) and a folder path inside it (Invoices/2026); or, with Where: OneDrive, paths in the signed-in account's OneDrive. Paths, not IDs.

Dropbox

  1. Open dropbox.com/developers/apps → Create app → Scoped access; App folder (only a folder of its own, safest) or Full Dropbox; a name.
  2. Permissions tab: tick files.metadata.read, files.content.read and, to write, files.content.write; Submit.
  3. Settings tab: under OAuth 2 → Redirect URIs add the connection's redirect address. Copy the App key (the client ID) and the App secret.
  4. In the designer: Service dropbox, the App key as Client ID, the secret, Scopes files.metadata.read files.content.read files.content.write. Connect account.

Dropbox works with paths (/Invoices/2026); with an App folder app, / is that app's folder.

Facebook Pages

  1. Open developers.facebook.com/apps → Create app; choose the business use case and connect your business portfolio.
  2. Add Facebook Login for Business; under its Settings, Valid OAuth Redirect URIs: the connection's redirect address.
  3. App settings → Basic: copy the App ID and App secret.
  4. Scopes: pages_show_list pages_read_engagement pages_manage_posts. In Development mode they work for people with a role on the app; others need App Review.
  5. In the designer: Service facebook; Connect account with a Page administrator. Facebook gives no refresh token: the sign-in lasts about 60 days, then Reconnect account.

The Page ID is on the Page under About → Page transparency, or in Meta Business Suite → Settings → Business assets. Use it in Facebook Page.

Twitch

  1. Open dev.twitch.tv/console → Register Your Application: a name, OAuth Redirect URLs = the connection's redirect address, a category, client type Confidential.
  2. Manage: copy the Client ID; New Secret and put it in the vault.
  3. In the designer: Service twitch, scopes such as user:read:email channel:manage:broadcast clips:edit. Connect account with the channel's account.

Other services (custom)

Service custom works with any provider that offers the OAuth 2.0 authorization code flow: give its Authorization URL, Token URL and API base URL from its documentation, register the redirect address there, and use Connected API call for its API. A provider that issues refresh tokens keeps the connection signed in; one that does not needs Reconnect account when the token ends.

On production servers (Admin Console and deployment)

A release carries the connection (service, client ID, scopes) and the name of its secret, never the secret's value or the account's tokens. On each server:

  1. Register the server's redirect address in the provider's app (https://prod.example.com/api/oauth/callback), or use a separate production app.
  2. Put the client secret in the server's vault, from your pipeline's secret store: sutra secret set GOOGLE_CLIENT_SECRET --from-env GOOGLE_CLIENT_SECRET --server https://prod:4800 --token $TOKEN. The release check (Admin Console → Releases) shows every secret a release needs and whether the server has it.
  3. A different client ID per environment: write {{gv.GOOGLE_CLIENT_ID}} in the connection's Client ID and set the variable in each environment's deployment config, or override the connection's setting there (${env:GOOGLE_CLIENT_ID} reads it from the server's environment).
  4. Sign in on that server, one of three ways:
    • sutra connect "Google Drive" --project Media --server https://prod:4800 --token $TOKEN prints the sign-in address; open it, sign in, and the command reports when the server is connected (headless engines too).
    • Or open the server's studio, if it has one, and use Connect account on the connection.
    • Or, when nobody may sign in on production, give the connection a Refresh token (secret): a refresh token of the account, kept in the server's vault and set by the pipeline. For Google, get one with the OAuth Playground (developers.google.com/oauthplayground): gear → Use your own OAuth credentials (add https://developers.google.com/oauthplayground to the client's redirect URIs), choose the scopes, Authorize APIs, Exchange authorization code for tokens, copy the refresh token.
  5. Check: Test connection on the server, then deploy or start the Sutras. Tokens are encrypted with that server's master key and refresh by themselves.

When it does not work

MessageCause and remedy
redirect_uri_mismatchThe provider's app does not list the exact address the connection shows (http or https, port, path). Add it under the redirect URIs (Google: not under JavaScript origins), wait a few minutes, connect again.
access_denied, app not verified, not a test userThe account is not a test user of a Google app in Testing, or a Facebook app in Development mode has no role for it. Add it, or publish the app.
invalid_grant, No refresh tokenThe sign-in ended: a Google app in Testing (7 days), a revoked access, a changed password, Facebook's 60 days. Reconnect account; publish the Google app or make it Internal.
AADSTS50194 (Microsoft)A single-organisation app signs in at common: set the connection's Tenant to the Directory (tenant) ID.
AADSTS7000215 (Microsoft)The secret is the Secret ID or expired: copy the secret's Value, or make a new one.
403 insufficient permissions or scopeThe scopes in the connection or the app's permissions do not cover the operation. Add them, then Reconnect account (new scopes need a new sign-in).
404 on a folder or file that existsThe account cannot see it (not shared with it), or the scope is Google's drive.file, which sees only files SutraFlow made.
Time-outs on big filesStream to and from server files, raise Wait for each call and the step's time limit.

34. Custom code, HTML and AI

AI providers

An AI provider connection chooses the engine. Several can exist side by side, for example a fast one for routing and a strong one for summaries.

Setting an API key: the key always lives in a Secret property. In the connection, select Create Secret project property under the key field, give it a name (such as GEMINI_API_KEY) and the key, then Create and select. The key is encrypted and the connection uses {{gv.GEMINI_API_KEY}}. To use an existing property, pick it from the list; to change its value, edit it under Project variables. An administrator can instead add a Secret engine property (Admin Console → Server → Engine properties) for every project; select Refresh properties and choose ev.NAME. Local servers need a key only if they are set up to ask for one.

Choose a model. Select Fetch models to list the models the server or account offers, and pick one. There is no default model. Automatic (first available model) takes whichever model the server lists first each time a step runs, which can change, so use it only for trials. If the chosen model is not available, the step fails; it never switches to another model.

EngineConfiguration
Claude API, Gemini API, OpenAI API, Hugging FaceThe API key comes from a Secret property (gv. for the project, ev. for the engine). Fetch models lists the models your account may use.
Ollama, LM Studio, Hugging Face TGI, OpenAI-compatible serverThe address of the server, on this machine or another (Ollama: http://127.0.0.1:11434 by default). A key only if the server asks for one. Pick a model the server has. Nothing leaves your network unless the address does.
Claude CLI, Gemini CLI, OpenAI Codex CLIInstall and sign in to the command-line tool under the server account. Type the name of a model the tool supports. The tool signs in by itself, so there is no key field and no model list. An administrator must first switch on AI command-line tools and list the command (Admin Console > Server > Runtime); a tool signed in with an environment variable (such as an API key) needs that variable listed there too.

Resolve provider/model shows which provider, model and time limit a step will use, without calling the model. Test connection sends a short question. Each AI step writes the model it used to its log. Fetching models never downloads a model into Ollama.

Time limit: an AI call may take 120 seconds by default. Change it on the connection, or for one step in its Settings. For an agent, the limit covers all its turns together. Stopping a run stops the call. Models for vectors (embeddings) are chosen the same way as chat models.

Adding models to Ollama, online or offline

  • Pull a model by name, such as qwen3, when the Ollama machine has internet.
  • Import from a path on this server when it does not. Copy the files over (USB drive, share), then give their path: a .gguf file; a Modelfile (FROM file.gguf, with TEMPLATE, SYSTEM and PARAMETER); a Safetensors model folder; or an Ollama models folder copied from another machine (it holds manifests and blobs), with the model to take from it. SutraFlow sends the files to Ollama through its API and registers them under the name you choose.

One setting per environment

The deployment config overrides any connection setting, the engine included. Test with a local Ollama and run production on another engine without changing a Sutra:

"resources": { "AI provider": { "engine": "Claude API", "model": "claude-sonnet-5-5", "apiKeySecret": "{{gv.ANTHROPIC_API_KEY}}" } }
Command-line tools

The prompt is sent to the tool on standard input, never on the command line, and the tool runs in an empty folder as the SutraFlow server user. Keep the tool's own permissions for running commands and editing files switched off: a message from outside could otherwise ask it to act on the server.

Guidelines

Route AI decisions that matter (money, customers) through an Approval step until you trust them.

35. Python scripts

Python script runs Python 3 on the SutraFlow server: code written in the step, or a .py file. It is in the Scripts palette, so an administrator first opens Admin Console → Server → Runtime and allows scripts in the Scripts card. The same card shows which Python is used and lets you choose another (sutra python does the same from a shell).

Install Python

  • Windows: python.org, and tick Add python.exe to PATH; SutraFlow also finds the py launcher.
  • Linux: sudo apt install python3 python3-venv (Debian, Ubuntu) or sudo dnf install python3.
  • Containers: add Python to the image, or set SUTRA_PYTHON to its path.
  • Packages: one virtual environment per project is tidy: python -m venv D:/venvs/sales, then D:/venvs/sales/Scripts/python -m pip install pandas, and give that folder as the step's Virtual environment folder.

What a script gets and gives

import json, os, sys
params = json.load(open(os.environ["SUTRA_PARAMS_FILE"]))     # the step's Parameters
previous = json.load(open(os.environ["SUTRA_INPUT_FILE"]))    # the previous step's output
args = sys.argv[1:]                                           # the step's Arguments
print(json.dumps({"total": 42}))                              # the last line, as JSON, becomes result

Parameters are also environment variables of the same names. Text is UTF-8 both ways. A non-zero exit code or an uncaught exception fails the step with the last lines of the traceback; untick Fail when the exit code is not 0 to branch on exitCode yourself.

Fewer surprises in production

Before anything runs, the designer and Deploy warn when Python is missing on this server, the code has a syntax error (with the line), the script file or virtual environment is missing, or a package in Packages it imports is not installed (with the pip command). Deploying to a server checks that server.

Templates

Python scripts in New Sutra → Samples adds an inline script with parameters and a script file (sales_report.py, in the project's files folder, found through the project variable SCRIPTS_FOLDER).

36. Connection limits: how much may use a connection at once

Every connection (database, AI provider, MongoDB, FTP/SFTP server, mailbox, API, broker, knowledge base) has Maximum concurrent activities: how much work may use it at the same time, counted across every engine of the cluster in the shared engine database. Empty or 0 means no limit. Use it to protect a system that can only take so much: a legacy database, a small AI server, a SaaS API that allows five calls at once, an FTP server with a session limit.

One limit among several: which one to use

SettingWhereWhat it limitsUse it for
Maximum concurrent activitiesOn the connection (Resources)Work using this connection at once, across all engines: steps, listener polls, scheduled refreshesProtecting the system behind the connection
Pool size (for example Pool max, Max pool size)On the connectionOpen network connections per engine to that systemSizing sockets; it does not stop more steps from waiting for a socket
Rate limits and plansAdmin Console, GatewayCalls per second or per day into your published APIsProtecting SutraFlow and your services from callers
Runs at onceSutra tuningOpen runs of one deployed SutraKeeping one process from taking the whole engine
Messages in parallelQueue / topic triggerMessages taken from the broker at once (prefetch, credit, partitions)Back-pressure on a queue
Steps at onceEngine tuningSteps an engine runs at once, of any kindSizing an engine to its machine

A limit counts work at the same time, not requests: a step holds one place while it runs, and the calls it makes one after another (queries, AI requests, vectors) use that place. Calls a step makes at the same time (an AI agent calling several tools at once, a search fanning out) are counted where the client makes them: each extra call at the same time takes a place of its own, or, when none is free, waits for the step's own place, so the step's calls take turns and a limit of 1 cannot deadlock. A query inside a transaction is part of the transaction and is not counted again. Counted this way: database queries, procedures and transactions, AI provider requests and vectors; other connections (MongoDB, HTTP, files) are counted per step. It is not a rate: a limit of 5 allows any number of calls per minute, five at a time.

What counts against a limit

WorkCounted?How
A durable step that selects the connectionYesOne place for the step's attempt, taken before it starts and given back when it ends, fails, waits or is cancelled. A step that needs several limited connections takes all of them at once or none, so two steps can never block each other halfway.
A step that selects a connection which uses others (behind the scenes)Yes, on every connection involvedA knowledge base counts with its vector database and its AI provider for vectors; an AI memory with its database and its summary provider; a memory table with its database. So an AI agent or a Search knowledge step is held back when the database behind the knowledge base is full, although the step never names that database. The Admin Console says used through the knowledge base.
AI agent toolsEach on its ownA tool Sutra is a run of its own: its steps count on their own connections. While the agent waits for the tool, the agent step is a durable wait and holds no place, so an agent and its tools never deadlock, even with a limit of 1.
Listener polls: folders on SFTP/FTP, mailboxes, Google Drive, OneDrive/SharePoint, Discord, Twitch, Data Factory runsYes, per pollA short lease for the time of one poll, renewed while it runs. With no room the poll is skipped and the trigger's status says why; the next poll tries again. Nothing is lost: the files and messages stay where they are.
Scheduled memory-table refreshYesA lease on the table and its database. It waits up to a minute for room, then skips this occurrence and shows why under Admin Console, Memory tables.
Subscriptions: Kafka, RabbitMQ, ActiveMQ / AMQP 1.0, WebSocket client, TelegramNoThey keep a connection open and wait for messages; holding a place for that would block their own Sutra (with a limit of 1, a subscriber could never publish or confirm). The runs they start count, step by step. Use Messages in parallel for back-pressure.
Calls into the gateway, the Admin Console, Test connection, the designer's previewsNoThese are people and callers, governed by sign-in, rate limits and plans.
In-memory SutrasYesTheir data stays in memory, but each step on a limited connection takes a small lease in the shared engine database, so in-memory and durable Sutras share one cluster-wide limit. With no room the step waits with a growing pause, like a durable one; a lost lease stops it. If the engine database cannot be reached, the step fails with that reason: it never runs unlimited.

Waiting is generous

  • A step that finds no room goes back to the queue. It uses no retry attempt, holds no worker, and its timeout starts only when it really runs: an AI step allowed 10 minutes gets its full 10 minutes after waiting an hour. It waits as long as needed.
  • Waiting steps are checked again with a growing pause, from the engine's poll interval up to 5 seconds, so a hundred waiting steps do not keep the engines busy. When a place frees, the next waiting step takes it within that pause.
  • Long work holds its place for its whole length: one AI step of 8 minutes on a provider limited to 2 keeps one of the two places for 8 minutes. Size the limit for the length of the work, not only its number.
  • Durable waits give the place back: an approval, a timer, Call Sutra with Wait for the result, an agent waiting for a tool. The step takes a place again when it continues.
  • With the engine database across the internet (650 to 750 ms per operation), taking a place costs about four round trips and giving it back two, so each limited step starts 1.5 to 2 seconds after the one before it. Keep the engine database near the engines for busy limited connections; the limit itself stays correct at any distance.

Listeners and background work: what to expect

  • A poll competes with steps. With a limit of 1 and a busy step, polls are skipped until the step ends: files and mail are picked up later, not lost. If pick-up delay matters, leave room for the poll (a limit one higher than the steps you expect).
  • A poll that reads big files holds its place while it reads.
  • Messages from a subscription start runs at once; their steps then wait for the connection like any other. Set Messages in parallel no higher than the limit, so the broker keeps the rest instead of many runs waiting inside SutraFlow.
  • Listeners run on the cluster leader only; a lease is renewed every half minute and runs out two minutes after an engine stops, so a crashed engine never holds a place for long. A lease that is lost stops its poll; a request already sent cannot be called back, so outside systems should accept a repeated request (idempotency).

Choosing a value

ConnectionStart withWhy
DatabaseWhat the database can serve at once for SutraFlow; check engines × pool size against its connection limitMore steps than the database can run only make every step slower
Local AI server (Ollama, LM Studio)1 or 2 per GPUA model answers one request at a time quickly; more at once makes all of them slow and can run out of memory
Cloud AI providerBelow the account's concurrent-request quotaOver the quota the provider answers 429 and the steps retry
SaaS APIThe vendor's documented concurrency (often 2 to 10)Combine with the vendor's rate rules; a limit is not a rate
FTP / SFTP serverIts sessions per user, minus one for the pollServers refuse logins over their limit
MongoDB Atlas M0Low (for example 5)Free clusters limit connections and operations per second
A system that must see one request at a time1Strictly one after another, across all engines

A different value per server

The limit takes a Project property: type {{gv.CRM_LIMIT}} in Maximum concurrent activities and give the property its value under Configuration, Project variables, or per server in the deployment config. Development can run with 1 and production with 20 without changing the Sutra. An invalid value (not a whole number from 0 to 100000) fails the step that needs the connection with a message naming the connection, and shows as an error in the Admin Console; it is never ignored.

Watching it: Admin Console, Connection limits

Admin Console, Operate, Connection limits (View permission) lists every connection with a limit across all engines: its limit (and the property it comes from), how much is in use by steps and by listener or background work, how many steps wait and for how long. Open one for a graph of its use over the last hour to 7 days (in use, waiting, and the limit as a dashed line; the leader takes a sample every half minute and keeps 7 days), what holds it now (step and run, or the listener) and every waiting step with its reason, for example Waiting for Orders DB (used through Manuals): 2 of 2 in use.

Guidelines

Set limits on the systems you must protect, not on everything. Leave room for listener polls when pick-up time matters. Keep outside calls idempotent: a limit decides when work starts, it cannot recall a request already sent. Watch the Connection limits page after a change: steady waiting means the limit is too low or the work too long; nothing ever waiting means the limit is not doing anything.

AI

37. AI concepts: models, RAG, tools, MCP and agents

This chapter explains the ideas behind the AI palettes in plain words, and which SutraFlow part does each. The next chapters build with them.

Models and providers

  • Model: the program that writes text (a large language model). It reads a prompt and writes an answer. Large models (Claude, GPT, Gemini) are strong and paid per use; small local models (phi4-mini, qwen, llama in Ollama) are free, private and good at short, guided tasks.
  • AI provider (Resources): where the model runs and how to reach it: Claude, OpenAI, Gemini, Ollama, LM Studio, any OpenAI-compatible server, or a command-line assistant. Every AI step names one, so changing the model is one setting.
  • Tokens: models read and write in pieces of words, about four characters each. Prices, limits and speed are counted in tokens. The context window is how many tokens one call can hold: instructions, history, passages and the question together.
  • Instructions (the system prompt): the standing rules for a step, such as who it speaks for, how long answers are, what it must never do. Effort trades speed for care.

Single AI steps

Most AI work is one call: AI prompt (any prompt), AI classify (pick a label), AI router (choose a branch), AI extract (fields from text into JSON), AI summarize, AI translate, AI sentiment, and Ollama for a local model. They fit anywhere in a Sutra, and their output maps like any other step's.

Embeddings, vectors and similarity

An embedding turns a text into a list of numbers, a vector, so that texts with similar meaning get similar numbers. "How long can I return an item?" and "Returns are accepted within 30 days" share few words but have close vectors. Vectors come from an embedding model (Ollama nomic-embed-text, OpenAI text-embedding-3-small, Gemini) or, offline and free, from SutraFlow's built-in word vectors, which match shared words rather than meaning. AI embed gives you vectors directly.

Knowledge bases and RAG

Retrieval-augmented generation (RAG) lets a model answer from your documents instead of from memory: find the passages that matter, put them in the prompt, and have the model answer only from them, naming its sources. It is how an assistant knows today's price list, your leave policy or a contract it was never trained on, and it keeps answers checkable.

  1. Feed: read each document (Read document text takes the text out of PDF, Word, PowerPoint, Excel, OpenDocument and HTML), split it into passages (chunks of a few hundred tokens that overlap a little, so no sentence is cut off from its context), make a vector of each, and store them with the source (file name or address) and details (metadata such as department or date). Add to knowledge does all of it.
  2. Store: the passages and vectors live in a vector store: built-in or a folder (nothing to install, fine for tens of thousands of passages), PostgreSQL with pgvector, Qdrant, Chroma or Pinecone (millions of passages, shared by several servers).
  3. Retrieve: the question gets a vector too, and the closest passages are found. SutraFlow scores by meaning (70%) and shared words (30%), so names and codes such as TEA-01 still match. Search knowledge.
  4. Generate: the model answers from the passages, citing them as [source#passage]; with no fitting passage it says it does not know. Ask knowledge does retrieve and generate in one step.

The Knowledge base resource holds the store, where vectors come from, and the passage size; feeds, searches and agents name it.

Tools

A model alone only writes text. A tool lets it act or look things up: check an order, read stock, create a ticket. In SutraFlow every tool is a Sutra that starts with AI tool: you describe it (name, what it does, its inputs), build the work with any palette, and end with Reply to AI. The model never touches your systems; it only asks for the tool, and the Sutra does the work with its own connections and checks. Tick Changes data on tools that change something.

MCP: the Model Context Protocol

MCP is the open standard AI assistants use to find and call tools. It has two sides, and SutraFlow is both:

  • MCP server: SutraFlow publishes your AI tool Sutras on the gateway at /mcp (or an address of an MCP server resource with its own policy). Claude Desktop, Claude Code, ChatGPT, Copilot, Cursor and others connect and call them. A published agent appears there too, as ask_<name>. The studio has an MCP server of its own, for assistants that build Sutras; Connecting AI assistants over MCP compares the two.
  • MCP client: an MCP client resource connects SutraFlow to someone else's MCP server (by address, or a command such as npx @modelcontextprotocol/server-filesystem). Call MCP tool calls its tools directly; an agent with the client set may use them; Allowed tools limits which.

A tool's test arguments let you run it in the designer without any assistant: Test runs the Sutra as if a caller had sent them, and shows studio test as the caller.

Agents

An agent (AI agent) is a model in a loop: it reads the goal, thinks, picks a tool, reads the result, and repeats until it can answer, within limits of steps, tokens and time you set. It can use your AI tool Sutras, a knowledge base (the tool search_knowledge, and passages fetched before it starts), and outside MCP tools. Each step is saved in the run, so you can see why it answered as it did.

  • Memory: runs stand alone, so a conversation is kept in an AI memory store under its session id; older turns are summarised when the history grows (Load memory, Save memory, Clear memory).
  • Guardrails: AI guard checks a message before the model sees it: hides personal data, stops hidden instructions (prompt injection), blocks topics, limits length. It can also:
    • Moderation: scores hate, harassment, self-harm, sexual, violence and illegal activity from 0 to 1 (with rules, and with the model in Also ask a model when one is set). A score at or above a category's threshold blocks; categories under Warn only let the text through with a warning in warnings and the run log.
    • Language: tells the language of the text (language, such as en or hi). With Translate to, text in another language is translated with the guard's model, and translatedFrom says what it was.
    • Answer cache: a guard on look up the question before the agent and one on store the answer after it. A question asked before leaves by the cached port with answer, so the model is not asked again. Answers are kept per Sutra and, by default, per person: an answer is only given back to the person who asked, and callers who are not identified get no cache. Use everyone only for answers that hold no personal data.
  • Human in the loop: an agent may stop with a question (needs a person); Ask a person puts it in Approvals and the run waits for the answer.
  • Several agents: a supervisor routes each question (AI classify or AI router) and Hand off to agent passes it, with the same session, to a specialist agent.
  • Channels: Agent channel publishes an agent as a chat page and widget, an OpenAI-compatible model, an MCP tool and an A2A agent; Agent reply answers on whichever the question came by. Long work answers with a job id at once.

Which to use

You wantUse
Classify, extract or summarise text inside a processA single AI step
Answers from your documents, with sourcesA knowledge base with Ask knowledge
Claude or another assistant to use your systemsAI tool Sutras published over MCP
A conversation that looks things up and actsAn agent with tools, memory and a channel
Fixed business rules (refunds, approvals, limits)Ordinary steps (If, Switch, Ask a person) before or after the AI, never left to the model
Good practice

Keep decisions that matter in ordinary steps; let the model read, write and choose among safe options.
Ask for JSON when a later step needs fields; AI extract checks it.
Log what the model was given and what it answered (Save steps), so answers can be explained.
Start with a small local model; move to a larger one only where answers fall short.

38. AI agents and knowledge bases (RAG)

An AI agent works towards a goal in steps: it thinks, picks a tool, uses it, reads the result, and repeats until it can answer. Its tools are your own Sutras: any Sutra that starts with an AI tool trigger is a tool for the agents of its project. A knowledge base and an outside MCP server add more tools.

Build an agent

  1. Make the tools: Sutras that start with AI tool, describe what they do, and end with Reply to AI. The description is what the agent chooses by.
  2. Under Resources, add an AI memory store (built-in is enough to start) and, for documents, a Knowledge base.
  3. Make the agent Sutra: Agent channel (or any trigger), AI guard, AI agent, and Agent reply on every branch. Connect needs a person to Ask a person.
  4. Test it with the trigger's test message; the Output tab shows each step the agent took.
  5. Deploy the tools and the agent.

Memory and the context window

Every run stands alone, so a conversation lives in the memory store under its session id. Each step sends, in this order: instructions and tools, the running summary, knowledge passages (at most a quarter of the window), the newest turns that still fit, and the message. When the history no longer fits, the oldest turns are folded into the summary. Messages of one session are handled one at a time, in arrival order; other sessions run alongside, and the queue survives restarts.

Where the agent lives

A deployed Sutra with an Agent channel trigger is reachable at once at every entry point you tick:

Entry pointAddressUsed by
Chat page and API/chat/<name>, POST /chat/<name>/api, /chat/<name>/widget.jsPeople; any web page (one script tag adds a chat button)
OpenAI-compatiblePOST /v1/chat/completions with model = nameApps and SDKs that take an OpenAI base address
MCPthe tool ask_<name> on /mcp or your MCP serverClaude, ChatGPT, Copilot, Antigravity, Cursor
A2A/a2a/<name> and its agent cardOther agents

Work that takes longer than Answer within, or waits for a person, answers at once with a job id; the caller fetches the answer later with it (GET /chat/<name>/jobs/<id>, the job argument of the MCP tool, tasks/get in A2A, or the message status <id> in the OpenAI API). The same agent can run on several servers; point them at one PostgreSQL database to share sessions.

Conversations and who is chatting

  • Conversation tokens: every answer carries a token signed by SutraFlow (sessionId in the chat API, X-Session-Id for OpenAI-compatible clients, contextId in A2A, session for the MCP tool). Send it back to continue. It continues the conversation only for the caller who started it, and only for the agent channel's Conversation lasts time (24 hours by default); a missing, altered, someone else's or expired token, or a session id a client made up, starts a new conversation. The Sutra sees the conversation's id as {trigger.sessionId}. The chat page and widget keep the token for you. Clients that made up their own session ids before 2.1.5 must send back the token they are given.
  • Who is chatting: with a JWT policy on the entry point, the caller's verified claims and scopes reach the Sutra: {trigger.caller.subject}, {trigger.caller.claims.name}, {trigger.caller.claims.role}, {trigger.caller.scopes}. Branch on them (customers and support staff) and filter data by the subject.
  • A website's login in the chat button: a page with its own sign-in sets window.SutraChat = { token: () => accessToken } (a value, or a function that may fetch a fresh one) before the widget script. The chat sends it as a bearer token and asks again when it expires. Sample Chat for customers and support comes with a PHP website (samples/sutra-sample-shop) that does this; the Sutra Design Guide's chat blueprint explains the design.
  • Visitors (no policy) get a signed identity in their browser that expires after 30 days (SUTRA_VISITOR_DAYS) and is renewed while they keep coming back.
  • Expired conversations keep their memory until an administrator clears them: Admin Console, Agent conversations, or sutra agents clear-expired.

Knowledge bases (RAG)

A knowledge base keeps documents as passages with vectors, so agents find them by meaning. Store them built-in or in a folder, or in PostgreSQL with pgvector, Qdrant, Chroma or Pinecone. Vectors come from a model (Ollama nomic-embed-text, OpenAI, Gemini) or, offline, from built-in word vectors.

  • From a database or an API: a timer, an SQL query (or Send HTTP request) of the rows people may see, one text per row with its details, Add to knowledge with a source per row (products/<id>) and Same text as before: skip, then Remove knowledge keep only these sources for rows that went away. Sample Knowledge feed from a database does it with a MySQL product table; the Sutra Design Guide's knowledge blueprint has the rules and a Joomla example.
  • Fill it with a feed Sutra: a source (SharePoint / OneDrive trigger, Google Drive / Docs trigger, File trigger, Remote file trigger, a list of web pages) → Read document text → Add to knowledge. A removed file goes to Remove knowledge.
  • Use it with Ask knowledge (answers only from the documents, with sources), Search knowledge, or an agent with the knowledge base set.
  • Who sees what: store details with each source (for example groups = finance) and filter on them when searching.
  • Server knowledge bases: an administrator can share a knowledge base with other projects in the Admin Console (Knowledge admin), for the whole base or areas of it (products, hr), to search or also to change, and keep areas in step with folders, SharePoint, Google Drive, web pages or a database without a feed Sutra. In a granted project it appears in the Knowledge base list with its home project and areas; the engine refuses a step that searches or changes outside them.
Guidelines

Put rules before the agent: route refunds, cancellations and other decisions with an If, not by asking the model to choose.
Give small models few tools and short instructions; they look things up well but may wander.
Protect public entry points with a policy that has a rate limit.

39. Build RAG step by step: from a folder of documents to answers

This chapter builds a complete RAG system: documents in a folder are read into a knowledge base every 15 minutes, and the knowledge answers as a REST API, an MCP tool for AI assistants, and a chat agent. The AI document assistant sample project is this system ready-made (New project → Package file → Or a sample project); build it yourself once to understand each part. Sources other than a local folder (Google Drive, SharePoint, SFTP, web pages, databases) are at the end; only the feed changes.

Step 1: a model (AI provider)

Answers need a language model; vectors can come from a model or from the built-in word vectors. For a private, free setup install Ollama and pull two models:

ollama pull phi4-mini          # answers (about 2.5 GB; qwen3 or llama3.2 work too)
ollama pull nomic-embed-text   # vectors (about 270 MB)

Under Resources add an AI provider: engine Ollama, model phi4-mini, address empty for this machine (http://127.0.0.1:11434). Test connection lists the models. A cloud model (Claude, OpenAI, Gemini) works the same: choose the engine and give its API key as a secret.

Step 2: a vector store

StoreGood forSet up
built-inStarting, up to tens of thousands of passages, one serverNothing: passages live in SutraFlow's database
folderThe same, kept as a file you can back up or copyA folder path
PostgreSQL (pgvector)Hundreds of thousands to millions of passages; several SutraFlow servers sharing one knowledge basePostgreSQL with the pgvector extension (below)
QdrantA dedicated vector database, fast filtersdocker run -p 6333:6333 qdrant/qdrant
ChromaA light vector database in Pythonpip install chromadb, then chroma run --path ./chroma (port 8000)
PineconeA hosted service, nothing to runCreate an index whose dimension matches the vector model (below); give its address and API key

Search index (pgvector)

A knowledge base in PostgreSQL finds passages through an HNSW search index, so searches stay fast as it grows. A new table gets the index at once. A table made before 2.1.0, or one that already holds passages, is indexed when an administrator builds it: Admin Console, Operate, Knowledge search, Check then Build search index (or a Remove knowledge step with build search index). Building takes a few minutes per million passages and documents can still be added meanwhile. Without the index every search compares each passage: in a six-hour test with 457,000 passages, searches went from under 2 seconds to 27. The index needs pgvector 0.8 or later and vectors of at most 2,000 numbers; several knowledge bases can share one table and each still gets its full results.

pgvector on Windows (Laragon): see Development machines for the download and the three files to copy, then in HeidiSQL or psql: CREATE EXTENSION IF NOT EXISTS vector;

pgvector on Linux (Debian or Ubuntu with the PostgreSQL apt repository):

sudo apt install postgresql-16-pgvector      # match your PostgreSQL version
sudo -u postgres psql -d sutraflow -c "CREATE EXTENSION IF NOT EXISTS vector;"

Then add a Database connection to that PostgreSQL in Resources. SutraFlow makes the table and its index itself on the first add.

Vector sizes: each model makes vectors of a fixed length, and a store keeps one length. nomic-embed-text 768, mxbai-embed-large 1024, OpenAI text-embedding-3-small 1536, built-in 512. After changing the vector model run Remove knowledge with rebuild vectors (or start a new collection).

Step 3: the knowledge base

Under Resources add a Knowledge base:

SettingChoose
Vector storeFrom step 2; with pgvector also the database connection and a table name
Vectors fromAI provider with model nomic-embed-text for meaning; built-in to start offline
Passage size200 to 400 tokens. Smaller finds precise facts; larger keeps more context. Policies and manuals: 250; long reports: 400
OverlapAbout 15% of the passage size (40 for 250)

Test connection makes a vector, reaches the store and tells how many passages and sources it holds.

Step 4: the documents folder

Add a project variable DOCS_FOLDER with the folder to read, for example D:/Shared/Policies or /srv/docs. The value ${files}/sample_documents (the sample's) means the project's own files folder (<data>/files/<project>/sample_documents): release zips carry files there, so the same project works on every server. Production overrides the value in its deployment config.

Step 5: the feed, one document

Make a Sutra Add one document to knowledge that handles one file; the folder feed calls it for each. With the file as its trigger, every step can say {{trigger.relativePath}}.

  1. Manual start with test data of one file: {"name": "returns-policy.pdf", "relativePath": "returns-policy.pdf", "extension": "pdf"}.
  2. If / else Document type: =lower-case({trigger.extension}) matches regex ^(pdf|docx|pptx|xlsx|odt|html|txt|md|csv)$. False: log and Return.
  3. Read file folder {{gv.DOCS_FOLDER}}, path {{trigger.relativePath}}, read as base64 (binary).
  4. Read document text content {{input.content}}, content is base64, file name {{trigger.name}}, type auto.
  5. Add to knowledge knowledge base from step 3, source {{trigger.relativePath}}, text {{input.text}}, details type = {{trigger.extension}} and title = {{input.title}}, Same text as before: skip (unchanged files make no new vectors).
  6. Return the result. Connect the error outputs of the read, text and add steps to a warning Log and a Return, so one bad file never stops the feed.

Step 6: the feed, the whole folder on a timer

  1. Timer cron 0 */15 * * * * (every 15 minutes; nightly 0 0 2 * * * for large folders).
  2. List / read directory location {{gv.DOCS_FOLDER}}, pattern *, include sub-folders, read content: do not read. Connect empty to a warning log.
  3. For each list {{input.files}}.
  4. item → Call Sutra Add one document to knowledge, input {{input}}, wait.
  5. done → Remove knowledge action keep only these sources, sources {{input.items}}: files deleted from the folder leave the knowledge base.
  6. A Log with the counts.

Press Test once: the knowledge base fills (watch the run's steps). Test again: every file is skipped as unchanged. Deploy both Sutras to keep it current. For changes within seconds rather than minutes, start the one-document Sutra from a File trigger on the folder instead (added and changed files → add; removed → Remove knowledge).

Step 7: check what it finds

Make a small Sutra with Manual start {"question": "How many days do I have to return an item?"} and Search knowledge. The output lists passages with source and score (0 to 1). Good passages for a clear question score 0.3 and more. If answers miss: ask with the words your documents use, lower the passage size, raise Passages, or switch to model vectors. Filter by details (Only with details, for example type = pdf or department = HR) to search part of the knowledge.

Step 8: answers as a REST API

  1. REST service POST /docs/ask, body {"question": "..."}.
  2. Ask knowledge provider from step 1, question {{input.body.question}}, passages 4, instructions Answer in two or three sentences, only from the passages. Name the document you used.
  3. Send HTTP response 200 {"answer": {{input.answer | json}}, "sources": {{input.sources | json}}}; on not found a 404 that says the documents do not tell; on error a 502.
curl -X POST http://127.0.0.1:8080/docs/ask -H "content-type: application/json" -d "{"question": "Is shipping free?"}"

Step 9: the documents as an MCP tool for Claude and other assistants

  1. AI tool tool name search_documents, a description that says what the documents cover, input question.
  2. Search knowledge question {{input.arguments.question}}, 5 passages.
  3. Reply to AI with {{input.hits}}; on empty, a reply that nothing matches.

Deploy it and connect an assistant. This tool needs no model on SutraFlow: the assistant reads the passages and writes the answer. Claude Code:

claude mcp add --transport http shop-docs http://127.0.0.1:8080/mcp

Claude Desktop (claude_desktop_config.json), through the mcp-remote bridge:

{ "mcpServers": { "shop-docs": { "command": "npx", "args": ["-y", "mcp-remote", "http://127.0.0.1:8080/mcp"] } } }

Outside your own machine use the HTTPS gateway and an MCP server resource with an API security policy, and give the key as a header.

Step 10: a chat agent over the documents

  1. Agent channel agent name docs-assistant, chat, OpenAI-compatible and MCP ticked.
  2. AI agent with the knowledge base set, Passages fetched before the first step 3, an AI memory store, session {{trigger.sessionId}}, tools none (or your AI tools), instructions to search first and name the documents.
  3. Agent reply on done; a polite reply on limit reached and needs a person. Put AI guard first when the chat is public.

Deploy and open /chat/docs-assistant on the gateway, or add <script src="http://127.0.0.1:8080/chat/docs-assistant/widget.js"></script> to any web page.

Other sources for the feed

SourceFeed
Google Drive or Google DocsGoogle Drive / Docs trigger on a folder (added, modified, removed) → Google Drive / Docs export as text/plain for Google Docs, or download for PDF and Office files → Read document text → Add to knowledge with source = the file id or name; removed → Remove knowledge. Needs a Google OAuth connection.
SharePoint or OneDriveSharePoint / OneDrive trigger on a library folder → SharePoint / OneDrive read as document text → Add to knowledge; removed → Remove knowledge. Sample: Knowledge feed from SharePoint. Needs a Microsoft OAuth connection.
SFTP or FTP serverRemote file trigger or a timer with the SFTP / FTP steps (list, read as base64) → Read document text → Add to knowledge.
Web pagesRead document text from a web address (HTML or PDF) → Add to knowledge with the address as source. Sample: Knowledge feed from web pages.
Database rowsTimer → SQL query (for example products changed today) → For each → Add to knowledge with text built from the columns and source = the row key.
Email attachmentsAn email trigger → For each attachment → Read document text → Add to knowledge.

Who may see what

Store details with each source (department = HR, groups = finance,managers) and pass the caller's group in Only with details when searching or asking. Keep documents that some people must never see in a separate knowledge base.

To production

Build a release zip of the project (Releases). Put the documents in the project's files folder or set DOCS_FOLDER to the production share in the deployment config; set the AI provider's address and model, and the knowledge base's store, for production too (pgvector or Qdrant shared by every engine). Deploy the feed, its called Sutra, and the API, tool or agent.

Good practice

Feed and answer in separate Sutras; the feed can fail or run long without touching answers.
Skip unchanged files; making vectors is the slow, costly part.
Answer only from passages and show sources; say when the documents do not tell.
Re-feed after changing passage size, and rebuild vectors after changing the vector model.

40. AI samples and sample projects

Every AI sample is in New Sutra → Samples → AI agents (and the AI folder), with the connections it needs as Sample ... resources to fill in. Every step of the newer samples has a description: open Documentation on a Sutra's General tab for the whole design on one page.

SampleShowsNeeds
AI tool order status, AI tool stock checkTwo AI tool Sutras: describe a tool, look the answer up (JSONata over sample data), Reply to AI. Test runs them with their test arguments.Nothing; an assistant or agent to call them
Order desk agentA full agent: chat, OpenAI-compatible, MCP and A2A entry points; AI guard; refunds routed to a person by an If, never by the model; memory; Ask a person.Ollama with a model; the two tools deployed
Knowledge feed from web pagesFor each address: Read document text from the web, Add to knowledge.Internet access
Knowledge feed from SharePointA SharePoint library kept in step with a knowledge base: added, modified, removed.A Microsoft OAuth connection
Policy assistantAsk knowledge behind a chat channel; a reply when the documents do not say.Ollama; a fed knowledge base
Agent fed by a queueQuestions from RabbitMQ or ActiveMQ, one session at a time, answers to a reply queue, confirmed after sending.A queue connection; Ollama
Supervisor agentAI classify chooses the specialist; Hand off to agent passes the question with the session.The order desk and policy samples
Agent with outside MCP toolsAn MCP client (the file system server by npx), Call MCP tool, and an agent limited to read-only tools.Node.js npx; Ollama
Document feed from a folder and Add one document to knowledgeRAG over a folder every 15 minutes: PDF, Word, PowerPoint, Markdown; unchanged files skipped; deleted files removed. The documents come with the sample.Nothing (built-in vectors)
Document questions APIPOST /samples/docs/ask: Ask knowledge, answer with sources, 404 when not found.Ollama with a model
AI tool search documentsThe documents as the MCP tool search_documents for Claude and other assistants.Nothing on SutraFlow
Document assistantA chat agent with the knowledge base, passages fetched first, memory.Ollama with a model

Sample projects

A sample project is a whole project as a release zip: its Sutras, connections, project variables, documentation and files. Import one with New project → Package file → Or a sample project, or deploy it to any server with sutra deploy. The zips are in the samples folder of SutraFlow (npm run samples makes them again).

AI document assistant (samples/ai-document-assistant.zip): the five document Sutras above, the connections Local Ollama, Sample document knowledge base and Sample AI memory, the project variable DOCS_FOLDER = ${files}/documents, and four documents of a tea shop (a PDF policy, a Word shipping guide, a PowerPoint catalogue, a Markdown FAQ) that go to the project's files folder. After importing:

  1. Open Local Ollama and choose a model (for example phi4-mini).
  2. Open Sample: Document feed from a folder and press Test: the knowledge base fills.
  3. Test Sample: AI tool search documents and Sample: Document questions API; then deploy the feed, its called Sutra and the ones you want to publish.
  4. Put your own documents in the folder (or point DOCS_FOLDER at yours); the next feed reads them.

MCP: AI assistants and SutraFlow

41. Connecting AI assistants over MCP

The Model Context Protocol (MCP) is the common way AI assistants such as GitHub Copilot, Claude, Antigravity and Cursor use outside tools. An assistant connects to an MCP server, reads the list of tools it offers, and calls them while it works on what you asked.

MCP appears in SutraFlow in three separate places. Keep them apart: only the first is something you build with the designer palette.

  1. Your Sutras as tools (MCP skills on the gateway): you build them with the AI palette, a Sutra that starts with AI tool and ends with Reply to AI, and deploy them. Assistants then call them to do business work. AI tools on the gateway.
  2. Tools of other MCP servers, used by your Sutras: an MCP client connection, then Call MCP tool (AI palette) or an AI agent with that client. Here SutraFlow is the caller. AI concepts, under MCP.
  3. The studio MCP server: built into the studio at /mcp/studio. There is nothing to build or deploy and no palette activity for it: an assistant signs in with a token and designs Sutras for you. Building Sutras with an AI assistant.

The two servers that assistants connect to (1 and 3) compare as follows.

Skills on the gatewayThe studio server
What the assistant doesUses the work your Sutras do: look up an order, write a file, post a messageBuilds and fixes Sutras: reads projects, saves drafts, tests them
AddressThe gateway, such as https://gateway:8443/mcp/ordersThe studio, http://<studio>:4800/mcp/studio
Who uses itCustomers, staff and their assistants, as callers of a published serviceDesigners and their assistants
Signed in withThe API security policy of the MCP server: an API key or a tokenYour own API token or a system account's token
ToolsThe Sutras you build with the AI palette (AI tool and Reply to AI) and deployA fixed set built into the studio (list_sutras, create_sutra, test_sutra ...); you add none
Runs whereOn the engines, as deployed Sutras, with run historyIn the studio, through its own API; it builds Sutras but is not one
ChapterAI tools on the gatewayBuilding Sutras with an AI assistant

Add a server to an assistant

Every assistant needs the same two things: the server's address and the header that signs it in. For the studio server the header is Authorization: Bearer <your token> (see My profile). For a gateway MCP server it is the header its API security policy asks for, such as X-API-Key. The examples below use the studio server; for a gateway server change the address and the header.

AssistantWhere to add it
Claude Codeclaude mcp add --transport http sutraflow http://studio:4800/mcp/studio --header "Authorization: Bearer sut_..."
GitHub Copilot in VS CodeA file .vscode/mcp.json with a server of type http, its url and the header under headers; then pick the tools in Copilot Chat's agent mode.
Antigravity, Cursor and other MCP clientsTheir MCP settings: a server reached over HTTP (streamable HTTP), with the address and the header.
ChatGPT and Claude on the webThey reach only servers on a public HTTPS address, and sign in with OAuth or not at all. The studio server does not offer that yet; a gateway MCP server on a public address can, with a policy those apps support.

Keep the token out of files you share: most assistants can read it from an environment variable instead.

What the assistant may do

An assistant can do only what its token may do. With your own token it has your roles; with a system account's token it has that account's roles. Everything it changes is in the audit log, marked as made through MCP.

42. AI tools on the gateway (MCP skills)

A Sutra that starts with an AI tool trigger (AI tool, in the AI palette) is a skill: once deployed, AI assistants such as Claude connect to the gateway over the Model Context Protocol (MCP), see the skills, and call them. Each call runs the Sutra with the arguments the AI chose, and Reply to AI sends the outcome back. Skills can do anything a Sutra does: write a CSV file, post to a Facebook page, look up an order in a database, start an approval.

This chapter is about your own Sutras on the gateway. The studio MCP server, which lets an assistant design Sutras, is a different server with no palette activities: see Building Sutras with an AI assistant. To call another company's MCP server from a Sutra, use Call MCP tool.

Build a skill

  1. Under Resources, add an MCP server: its address on the gateway (for example /mcp/orders), a title, instructions for the AI, and an API security policy. One server holds many skills.
  2. Create a Sutra, drag AI tool from the AI palette as its trigger, choose the server, and describe the tool: name, title, what it does and when to use it, and its inputs.
  3. Build the work with any palette, and end every branch with Reply to AI (AI palette); on error branches tick Is an error.
  4. Test it in the studio with the trigger's test arguments, then Deploy. The Services page lists each skill with its address.

Connect an assistant

Give the assistant the server's address and, when a policy is set, the key or token as a header. With Claude Code:

claude mcp add --transport http orders https://your-server:8443/mcp/orders --header "X-API-Key: your-key"

Other assistants that support MCP over HTTP take the same address and header. Skills without a server are at /mcp.

Sample skills

Add sample Sutras also adds an MCP server named Sample skills (/mcp/samples) with two skills: Skill: Write CSV file and Skill: Post to Facebook page. Choose a security policy on the server, a Facebook connection and page on the second skill, and deploy them.

Guidelines

Protect every MCP server with an API security policy: a skill acts with the server's rights.
Tick Changes data on skills that create, change or delete something, so the assistant asks the user first.
Write descriptions for someone who has never seen the Sutra: the AI chooses skills by them.

43. Building Sutras with an AI assistant

The studio has its own MCP server at /mcp/studio on the admin port (for example http://127.0.0.1:4800/mcp/studio). Through it an AI assistant builds and fixes Sutras with the same rules as a person in the designer: it learns what exists, saves drafts, tests them, reads what went wrong, and repairs them. It never deploys on its own.

This server is part of the studio. You do not build it, deploy it or add tools to it, and it has nothing to do with the AI tool and Reply to AI activities of the AI palette: those make your own Sutras into tools on the gateway (AI tools on the gateway). The assistant uses the studio server to make Sutras of any kind, including such AI tool Sutras.

Connect an assistant

The assistant signs in with a token and works with that token's roles. There are two kinds:

  • Your own token: made in My profile, with an expiry of 30, 60 or 90 days. The assistant does what you may do, on your projects, and the audit log names you. Best for your own assistant.
  • A system account's token: in Admin Console → System accounts, add an account for the assistant, grant it roles (Viewer to read, Developer to build and test, Deployer as well to hand releases over) and create a token for it. Best for shared or unattended assistants.

Give the assistant the address and the token (how, for each assistant). With Claude Code:

claude mcp add --transport http sutraflow http://127.0.0.1:4800/mcp/studio --header "Authorization: Bearer sut_..."

Administrators see each person's tokens in Admin Console → Users (open the person: Personal API tokens, with Revoke) and can switch personal tokens off for the server with Personal tokens: on/off; while off, people cannot create tokens and theirs stop working.

Only a token signs in here, never a browser session, so a web page cannot call it for someone who is signed in to the studio.

What the assistant can do

ToolsDoesNeeds
list_projects, list_sutras, get_sutra, list_activities, list_connections, list_properties, list_schemas, list_samples, get_run, check_sutraLearn what exists: projects, Sutras, every activity with its fields, connections and properties by name, schemas, samples, runs and the design checks.View
create_sutraSaves a new Sutra as a draft and returns the design check. Never deployed.Design
change_sutraTwo calls: the first returns the difference (steps added, removed and changed, field by field, and connections) and a change id, and saves nothing; the second, with confirm set to that id, saves it. If the Sutra changed in between, the change is refused and the difference must be asked for again.Design
test_sutraA design-time test run with a sample input, as Test in the designer; returns each step's input, output and error, and the log.Design
check_release, deploy_releaseBuilds and checks a release and its deployment plan. It deploys only with approve set to the plan id a person with Deploy approved, as sutra deploy --approve.Deploy

Safety

  • The assistant works with its account's rights: another project's Sutras, connections and properties are refused as they are in the designer.
  • No tool returns a secret value. Properties come by name and type; connections by kind and name. A Sutra the assistant writes reads secrets through Secret properties: {{secret.NAME}} is refused.
  • Every tool call is in the audit log (Admin Console → Audit) under the account, as MCP studio and the tool's name, with the client mcp; calls that change something are marked generated. The changes the tools make through the studio API carry the same marks. Its test runs are design-time runs with the client mcp, so they never count as production work.
Guidelines

Use your own token for your own assistant, with the shortest period that suits you; give a shared assistant a system account of its own, with Developer on one project to start.
Read the difference change_sutra shows before it confirms; the assistant should show it to you.
Approve a deployment plan as you would one from a pipeline: read what it replaces or undeploys first.

APIs, security and approvals

44. The API gateway

SutraFlow listens on two kinds of ports, each for its own people. The studio port is for the team that builds and runs SutraFlow. The gateway is the front door for everyone and everything that uses your Sutras: other systems, websites, partners, mobile apps, AI assistants.

PortDefaultServesWho reaches it
Studio (admin)127.0.0.1:4800The designer, the Admin Console (/admin), this guide, and the admin API (/api/...) used by the designer, the console and the sutra commandOnly your team: keep it on 127.0.0.1, or reach it over a VPN or an internal reverse proxy with HTTPS
Gateway HTTP8080 (all addresses)The deployed Sutras: REST and SOAP services, MCP, AI agents, access tokensCallers. Point a load balancer or reverse proxy here, or use HTTPS
Gateway HTTPS8443 (all addresses)The same, with TLS (a self-signed, your own or a Let's Encrypt certificate)Callers over the internet
Headless engineadmin 4801, gateway 9080 / 9443An engine without the designer: its Admin Console and its own gateway, serving the same deployed SutrasAdmin port: operations; gateway: callers

The ports are set in sutraflow.env (STUDIO_PORT, STUDIO_GATEWAY_HTTP, STUDIO_GATEWAY_HTTPS, and ENGINE_... for an engine). The Designer's read-only Services page shows every gateway address; administrators change listener settings in Admin Console → Server → Gateway & TLS. A Laragon installation uses for example studio 4810 and gateway 8090 and 8453, with Apache forwarding http://sutra.test to the studio.

What the gateway serves

Address on the gatewayWhatMade by
Your paths, for example GET /orders/:idREST servicesA deployed Sutra that starts with REST service
Your paths, for example /soap/orders, and ?wsdlSOAP services and their WSDLSOAP service
/mcp, or an MCP server's address such as /mcp/ordersTools for AI assistants (Model Context Protocol)AI tool Sutras and published agents
/chat/<name>, /chat/<name>/api, /chat/<name>/widget.jsAn agent's chat page, its API, and a chat button for any websiteAgent channel
/v1/models, /v1/chat/completionsAgents as OpenAI-compatible modelsAgent channel with OpenAI-compatible ticked
/a2a/<name>Agent-to-agent (A2A) with its agent cardAgent channel with A2A ticked
POST /oauth/tokenAccess tokens for gateway apps (client credentials)Admin Console → Gateway → Apps and keys
/openapi.jsonThe OpenAPI description of the REST services, for Postman, Swagger UI or code generatorsWhen publishing is switched on (Admin Console → Gateway → APIs)
/healthUp or not, for load balancersAlways

The gateway never serves the designer, the Admin Console or the admin API; and a Sutra is on the gateway only while it is deployed. In the designer, Test runs a Sutra without the gateway.

Publish a REST API: step by step

  1. New Sutra; first step REST service: method GET, path /orders/:id. Its test request lets you run it in the designer.
  2. Do the work: a database query, a call to another system, a mapping.
  3. End with Send HTTP response: status 200 and the JSON to return; a second response for errors (404, 400).
  4. Choose an API security policy on the trigger (next section); Deploy.
  5. Call it on the gateway:
curl http://127.0.0.1:8080/orders/A-1001 -H "X-API-Key: your-key"
Invoke-RestMethod http://127.0.0.1:8080/orders/A-1001 -Headers @{ "X-API-Key" = "your-key" }

The Designer's Services page lists the service with its full address; the Admin Console's Applications shows it running, and Gateway → Traffic shows its calls.

Who may call, and how much

Every request passes through, in order: the firewall (addresses allowed or refused for the whole gateway), the service's API security policy (HTTPS only, IP allow list, authentication, a rate limit per caller, CORS for browsers), and for gateway apps their plan. A refused request gets 403, 401 or 429 and never starts the Sutra.

  • Simple: a policy with API keys (vault secrets) or Basic sign-in; see Exposing APIs: security and TLS.
  • For many callers: Admin Console → Gateway. Make a plan (requests per minute, hour, day and a monthly quota), an app per caller (partner, mobile app, team) with its scopes and plan, and give it a key (sfk_..., shown once, stored as a hash). Set the policy to Gateway apps. Callers send the key in X-API-Key, or exchange it for a short-lived token:
curl -X POST http://127.0.0.1:8080/oauth/token -d "grant_type=client_credentials&client_id=APP_ID&client_secret=sfk_..."
curl http://127.0.0.1:8080/orders/A-1001 -H "Authorization: Bearer ACCESS_TOKEN"

Disabling an app, or deleting a key, stops it at once on every engine. Gateway → Traffic shows requests, errors and time taken by service and app; the request log keeps every call (path, app, status, time, run) for the days set there.

HTTPS and the internet

  • Give the gateway a certificate in Admin Console → Server → Gateway & TLS: your own, or Let's Encrypt (the gateway's HTTP port must answer as port 80 for the domain while the certificate is made and renewed).
  • Or put a reverse proxy or load balancer in front (Apache, nginx, IIS, Azure Application Gateway, AWS ALB); send /health as its health check, and /ready on the admin port for engines. List the proxy under Admin Console → Gateway → Firewall → Trusted proxies: from it SutraFlow reads X-Forwarded-For (the caller's real address) and X-Forwarded-Proto (HTTPS ended at the proxy), and ignores those headers from anyone else. Without that, SutraFlow sees the proxy's address for every caller, and a call forwarded over plain HTTP counts as not HTTPS, so policies with Require HTTPS (on by default) refuse it; then forward to the gateway's HTTPS port. The Administration Guide has the Apache, nginx and IIS settings.
  • Open only the gateway port in the firewall, never the studio port.
Good practice

Every public service gets a policy; a service without one is open to anyone who reaches the gateway, and the designer warns about it.
Use an app per caller, so one can be throttled or switched off without touching the others.
Keep the studio port private; the gateway is the only door you open.

45. Exposing APIs: security and TLS

A REST service or SOAP service trigger publishes the Sutra on the gateway. The Designer's read-only Services page lists every exposed service with its addresses and security policy.

Services: every published service with its address and policy, and the state of each listener.
Services: every published service with its address and policy, and the state of each listener.

API security policy

Create a policy in Resources → API security policy and pick it on the trigger. It checks, in order: HTTPS required, IP allow list (addresses or IPv4 ranges), caller authentication, then a rate limit per caller. CORS origins are optional.

AuthenticationHow callers prove who they are
NoneOpen to anyone. For testing only.
BasicUser name and password; each password is a stored secret behind a Secret property.
API keyA key in a header; each key is a stored secret behind a Secret property.
JWT bearerA signed token, checked with a JWKS URL, a public key or a shared secret; issuer, audience and scopes.
Gateway appsKeys and OAuth client-credentials tokens of apps in the Admin Console, with scopes and plans.
OAuth token introspectionAn opaque access token, checked at the identity provider's introspection endpoint (answers kept until the token expires or the cache time); audience and scopes.
HMAC signatureThe request signed with a shared secret, as webhook senders do: the timestamp and body, or the method, path, timestamp and body, or the body only. Old timestamps and replays are refused.
WS-Security UsernameTokenSOAP only; password digest with a time window and replay protection.
WS-Security X.509SOAP only; the request signed with a certificate the policy trusts (the certificate itself, or a CA that issued it). The Body and the Timestamp must be signed.
WS-Security SAMLSOAP only; a SAML 1.1 or 2.0 assertion signed by the identity provider, from the expected issuer, for this audience, in its validity period.
Mutual TLSA client certificate signed by the client CA set in Admin Console → Server → Gateway & TLS; optionally only listed subjects.

Scopes per service and per operation

A token or gateway app carries scopes. The policy can require some for everything it protects; a REST service can require more (Required scopes), and a SOAP service per operation (Scopes per operation: CancelOrder = orders:cancel). A caller without them gets 403 insufficient_scope.

Message validation

Give the trigger a schema and set Validate requests to reject invalid: the body is checked before a run starts, and a bad request gets 400 (REST, with the list of errors) or a Client fault (SOAP).

The caller is checked first: without valid credentials it gets 401, without the right scopes 403, and in both cases nothing about the schema. Only a caller that passes gets 400 with the list of fields that are wrong, and no run starts. Sending the same body again gives the same answer. In the other direction, an Send HTTP request with a body schema checks its own body before sending it.

  • JSON Schema (drafts 07, 2019-09 and 2020-12): required fields, types, patterns, formats such as email and date-time, ranges, allowed values, no extra fields when the schema says so.
  • A JSON sample: an example message. Every field in it is required, other fields are refused, and each value must have the same type as in the example. For optional fields, empty values, extra fields, patterns or ranges, use JSON Schema instead.
  • An XSD element: XSD 1.0 types, sequence/choice/all, groups, occurrences, namespaces, enumeration, patterns and facets. SOAP validates the original operation namespace. XSD 1.1 is not supported, and imported or included schemas must be XSD schemas of the same project.

Threat protection

Every policy limits what a message may hold, before the Sutra sees it: nesting depth (checked on the raw text, before parsing), fields per message, items per list, the length of one text value, and the body size. XML with a DOCTYPE is always refused, so entity tricks (billion laughs, external entities) never reach the parser. Services without a policy get generous limits (depth 64, 50,000 fields).

HMAC-signed webhooks, step by step

  1. Store the shared secret (Resources → Secrets), for example as PARTNER_HOOK_SECRET, and add a Secret project property that points to it. The policy can read only secrets behind a Secret property of its project or of the engine.
  2. Create an API security policy with hmac, the secret under Accepted secrets, and the sender's header names, algorithm, encoding and prefix (many senders: X-Hub-Signature-256, sha256=, body only).
  3. To change the secret without missing calls, list the new one beside the old one until the sender has switched.
  4. Pick the policy on the REST service. The caller's auth.subject is the name of the secret that matched.

WS-Security on incoming SOAP

  • Timestamps: a Timestamp that is present is always checked (created not in the future, not expired, within the allowed clock difference); set Timestamp: required to refuse messages without one.
  • X.509: paste the callers' certificates, or the CA that issues them, into Trusted certificates. A changed body, an untrusted or expired certificate, an unsigned Timestamp or a second Body is refused.
  • SAML: paste the identity provider's signing certificate, and set the issuer and audience.
  • Encrypted requests: keep this service's private key in a Secret property and pick it under XML encryption; give callers the matching certificate. Requests encrypted for it are decrypted first (AES-GCM or AES-CBC, keys by RSA-OAEP; RSA 1.5 is refused), then checked. Require an encrypted body refuses plain ones.
  • Encrypted responses: choose caller certificate to encrypt replies for the certificate in a successfully verified X.509 request, or configured certificate and paste the recipient certificate for UsernameToken, SAML or another caller. Successful replies and faults after authentication are encrypted; a failure before a caller certificate is trusted stays a plain SOAP fault. AES-GCM is the default; use CBC only for an older partner.
Resources: an API security policy that accepts API keys kept as stored secrets.
Resources: an API security policy that accepts API keys kept as stored secrets.

TLS certificate of the gateway

  • Self-signed: for testing.
  • Own certificate: paste the PEM chain and key; the key is checked against the certificate and stored encrypted.
  • Let's Encrypt: SutraFlow uses ACME to ask Let's Encrypt for a publicly trusted certificate and renew it automatically. No certificate files need to be copied by hand.
  • Client CA: enables mutual TLS for policies that use it.

Issue a Let's Encrypt certificate

Before requesting one:

  • Use public DNS names that resolve to the firewall, load balancer or machine in front of this gateway. Let's Encrypt does not issue a certificate for localhost or a private-only host name.
  • Make public TCP port 80 reach the gateway's HTTP listener for every name. Forwarding public port 80 to a different internal gateway HTTP port is fine. Keep HTTP available for later renewals.
  • Allow the server to make outbound HTTPS connections to Let's Encrypt. A reverse proxy must pass /.well-known/acme-challenge/ to the SutraFlow gateway unchanged rather than authenticating it.
  • Know the contact email and be authorised to accept the Let's Encrypt Subscriber Agreement. Wildcard names are not supported because SutraFlow uses the HTTP-01 challenge, not DNS-01.

Nothing else needs to be installed: SutraFlow makes the keys and the certificate request itself.

  1. Open Admin Console → Server → Gateway & TLS. Confirm the gateway bind address and its HTTP and HTTPS ports.
  2. Select Let's Encrypt, enter the names separated by commas (the first becomes the common name), and enter the contact email.
  3. For the first attempt, select Use the staging environment. Accept the Subscriber Agreement and choose Request certificate.
  4. Watch the status shown below the button. Test HTTPS after it succeeds. A staging certificate is deliberately untrusted; it proves that DNS, forwarding and the challenge route work.
  5. Clear staging and request again to obtain the trusted production certificate. The HTTPS listener reloads the certificate without dropping existing connections.

The server checks twice a day. When fewer than 30 days remain it repeats the same HTTP-01 proof and installs the renewed certificate. The ACME account key and certificate private key are stored encrypted with this server's master key. In a cluster, a database lease lets one engine place the order, every gateway can answer its shared HTTP-01 tokens, and all engines reload the new certificate on their next heartbeat. The load balancer may therefore send the challenge to any healthy gateway node.

TLS 1.2 is the minimum.

46. The Approval Center: decisions by business people

When a Sutra needs a person (a refund over a limit, a new supplier, a purchase order, a question an AI agent may not answer alone), a Human approval or Ask a person step waits, and the people it names decide in the Approval Center: a page of its own at /approvals on every SutraFlow server, made for business people. It shows only their approvals: nothing of the designer or the Admin Console, and it works on a phone.

The Approval Center: what waits for the signed-in approver, with the details the step chose to show.
The Approval Center: what waits for the signed-in approver, with the details the step chose to show.

Set up the approvers (an administrator, once)

  1. Admin Console → Roles: make a role per group of approvers, for example Finance approver (it needs no permissions of its own; View lets its members also see the other waiting items of the project).
  2. Admin Console → Users: add the people, with their email address, and give them the role (on all projects or one). With single sign-on, map an identity provider group to the role instead.
  3. Send them the address: https://your-server/approvals. They sign in with their password or with single sign-on. Designers and administrators reach it with Approval Center in the designer's top bar and in the Admin Console beside Guide.

In the Sutra

  1. Add a Human approval step. Write the question with references: Approve purchase order {{input.ref}}?.
  2. Details for the approvers: label = value, such as Amount = {{input.total}}, Supplier = {{input.supplier}}. They see these first; the full data is one click away.
  3. Approver roles (Finance approver) and/or approver accounts (usernames, or from the data: {{input.managerAccount}}).
  4. Who must approve: any one of them, all of them, or a number of them (any 2 of 5). One rejection rejects.
  5. Comment required: on rejection (default), always, or never.
  6. Time (optional): Due in hours, then keep waiting, escalate (the escalation roles can decide too, with the same time again) or the expired output; Remind every hours; Email the approvers through an SMTP connection, so they get an email with a link when the approval arrives, at each reminder and on escalation.
  7. Connect approved, rejected (and expired). The output's approval holds who decided, the comment, and every approver's vote.

What the approvers see

  • Waiting for me: what they may decide and have not yet, newest last, with the details, who else must approve, how many approvals are in, and the due time.
  • All waiting: everything of the projects they may view, including items waiting for others.
  • Decided: their decisions and, for those who may view the project, everyone's, for 30 days.

Who may decide

The step namesWho decides
Roles and/or accountsOnly those people (members of the roles on that project or on all projects, and the named accounts).
Nobody (older steps)Anyone with the Approve permission on the project, as before.
Test and debug runs in the designerAlso the designers of the project, so a Sutra can be tried without the approvers.

Administrators who are not approvers see the item and can decide on behalf of the approvers, which is recorded so; Operators can reassign an approval to other roles or accounts or give it a new due time (POST /api/approvals/:id/reassign). Every decision is in the run, in the history and in the audit log.

Who decides, not who can see

Approver roles need no permissions to decide what names them. Give the role View on the project only if its members should also see the other waiting items and the history of the project.

The Admin Console's Approvals page lists what waits and for whom, and opens the Approval Center.

Releasing

47. Releases: build, package and deploy

A release moves a whole project, unchanged, from the studio to test and on to production. This chapter covers what a release is, building it, deploying it, and rolling back. The next chapter automates it in a CI/CD pipeline.

The parts of a release

PartWhat it is
Package (.sutra)One file with the whole project: every Sutra at a fixed version (marked deployed or not), connections and API policies with secret names (never values), schemas and WSDLs, project variables, logging, and a sha256 checksum. A changed or damaged package is refused.
Deployment config (deployment-config.json)The values that differ per environment: project variables, connection settings (hosts, ports, folders, queues, users, which secret), logging. Values may read environment variables: ${env:DB_HOST}, ${env:DB_HOST:-localhost}. Each environment keeps its own.
SecretsPasswords and keys stay in each server's vault and never travel. The package lists the names it needs.
FilesDocuments, templates and other files the project needs, in the release zip's files/; they go to the project's files folder (${files} in variables).
Release zipAll of it for a production team: package.sutra, deployment-config.json (filled with the package's own values, to change), README.txt (contents, secrets, where it was built from, commands), documentation.html and .md, and files/.

Versions

  • Each Sutra has its own versions: v1, v2, ... made by Deploy or by a package. Runs in progress finish on the version they started with.
  • A package has a version you choose, like 1.4.0 (major.minor.patch, optionally -rc.1): raise the patch for fixes, the minor for new Sutras or features, the major for changes callers must adapt to (a REST path or body changed). In Git, tag the commit with the same version (v1.4.0).
  • The same package deployed twice changes nothing: Sutras whose content is unchanged keep their version.

Who deploys how

EnvironmentHow Sutras get there
Development (each designer)Deploy in the designer, Sutra by Sutra; Test and Debug without deploying
System test, integrationDesigner Deploy, or packages from the pipeline
UAT, pre-productionRelease zips from the pipeline: the exact files that will go to production
Production (SUTRA_ENVIRONMENT=production)Release zips only: sutra deploy from the pipeline, or Admin Console → Releases. Designer Deploy is refused.

Build a release in the studio

  1. Write a description for every step: the release documentation is made from them (see Documenting Sutras).
  2. Deploy and test the Sutras that belong in the release on your development server. The package takes each deployed Sutra at its deployed version; Sutras never deployed come along as not deployed.
  3. Open Project → Configuration → Releases (packages), give a version and a note (what changed), and choose Download release (.zip), or Package only (.sutra).
  4. Open the zip: check README.txt (Sutras, addresses, secrets) and documentation.html, and fill in deployment-config.json for the target (or hand it to the team that owns that environment).

Build a release from the command line

# from a running studio or engine
sutra package --project "Orders" --version 1.4.0 --note "Faster lookup" --zip --server https://studio:4800 --token $TOKEN
# on the server itself, from its data folder
sutra package --project "Orders" --version 1.4.0 --out orders-1.4.0.zip
# from the project's Git repository, with no server at all (CI)
sutra package --from-git https://github.com/acme/orders.git --ref v1.4.0 --version 1.4.0 --out orders-1.4.0.zip

--sutras "A,B" takes only those Sutras with the connections and schemas they use. From Git every Sutra in the repository is deployed by the release; the package records the repository (without credentials), the ref and the commit.

Prepare the target

The steps below are usually done by the administrators of the target server; the Administration Guide covers them in full: Receiving releases on a server and The command line by task.

  1. Secrets: add every name the README lists to the target's vault, from a secret store or the pipeline: sutra secret set ORDERS_DB --from-env ORDERS_DB --server ... --token ..., or Resources → Secrets.
  2. Deployment config: hosts, folders and users of this environment; keep one file per environment in the pipeline or a config repository, with ${env:...} for values the server's environment gives.
  3. Access: a system account with the Deploy permission on the project (Admin Console → System accounts), and an API token for it.

Deploy

  • Admin Console → Releases: choose the zip; read its check (Sutras and addresses, secrets present or missing, where it was built from, the config and files it brings); change the project name or give another deployment config; Deploy.
  • Command line: sutra check orders-1.4.0.zip --server ... --token ..., then sutra deploy orders-1.4.0.zip --config prod-config.json --server ... --token .... The zip's own config applies unless --config gives another.
  • Designer (non-production): Releases → Deploy a package here.
  • Headless engines can also take packages from a folder at start (SUTRA_DEPLOY_DIR), for container images.

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

Check and roll back

  • After a deploy: Admin Console → Applications for the Sutras and their state, Runs for failures, Alerts for rules that fire. sutra test release.zip runs every Sutra of a package with its test data in a throw-away server, before you deploy.
  • Roll back: Admin Console → Releases → Roll back, or Deploy again on any earlier package; sutra rollback --project "Orders". A rollback is itself a deployment, recorded like any other.

From a Sutra

The Release palette does the same steps inside a Sutra, so a release can itself be a Sutra: on a timer or a REST call, Build package, Deploy package to a test engine, Human approval, Deploy package to production, then Send email the result. Check package and Roll back complete it. These activities are off until an administrator allows them in Admin Console → Server → Runtime.

Good practice

Promote the same zip from UAT to production; never rebuild it for production.
Keep deployment configs and secrets out of the package and out of Git; keep configs per environment, secrets in each vault.
Write the note: it shows in the history and the README.

48. CI/CD pipelines

A pipeline builds the release from Git and takes it through test to production with no hand work and no designer access. Every step is a sutra command that ends with exit code 0 (success), 1 (a failed check, test or deploy) or 2 (wrong usage), so any CI system stops at the first problem.

The stages

  1. Source: designers commit and push the project from the Git tab; a merge to the main branch, or a version tag such as v1.4.0, starts the pipeline.
  2. Build: sutra package --from-git . --ref $TAG --version $VERSION --out release.zip on the build agent; no SutraFlow server is needed.
  3. Test: sutra test release.zip --secrets-from-env runs every Sutra with its test data in a throw-away server; test secrets come from the pipeline's secret variables.
  4. Document: sutra doc release.zip --out documentation.html (also inside the zip) for reviewers.
  5. Deploy to UAT: sutra check then sutra deploy release.zip --config config/uat.json against the UAT engine.
  6. Approve: a person approves in the CI system (environments with required reviewers, manual jobs, approval gates).
  7. Deploy to production: the same zip, --config config/prod.json, against the production engine. Keep the zip as the pipeline's artifact.

What the pipeline needs

ItemWhere to keep it
The sutra commandNode.js 24 and SutraFlow on the build agent (npm ci in a checkout of SutraFlow, then npm run sutra --), or the SutraFlow container image
Server addressesPipeline variables: UAT_SERVER, PROD_SERVER (the admin port, for example https://prod-engine:4800)
TokensSecret variables: an API token of a system account with Deploy on the project, one per environment
Deployment configsA config/ folder in the repository (no secrets in it), or a separate config repository
Secret valuesThe CI system's secret store; set them on the target with sutra secret set NAME --from-env NAME as a pipeline step, or by the operations team
Git access for --from-git <address>SUTRA_GIT_TOKEN (and SUTRA_GIT_LOGIN); not needed when the pipeline has checked out the repository and passes .

GitHub Actions

name: release
on:
  push:
    tags: ['v*']
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7                      # the project repository
      - uses: actions/checkout@v7
        with: { repository: your-org/sutraflow, path: sutraflow }
      - uses: actions/setup-node@v7
        with: { node-version: 24 }
      - run: npm ci
        working-directory: sutraflow
      - name: Build the release
        run: npm run --prefix sutraflow sutra -- package --from-git "$GITHUB_WORKSPACE" --ref "$GITHUB_REF_NAME" --version "${GITHUB_REF_NAME#v}" --out "$GITHUB_WORKSPACE/release.zip"
      - name: Test it
        run: npm run --prefix sutraflow sutra -- test "$GITHUB_WORKSPACE/release.zip" --secrets-from-env
        env: { ORDERS_DB: '${{ secrets.TEST_ORDERS_DB }}' }
      - uses: actions/upload-artifact@v4
        with: { name: release, path: release.zip }
  production:
    needs: build
    runs-on: ubuntu-latest
    environment: production                           # required reviewers approve here
    steps:
      - uses: actions/download-artifact@v4
        with: { name: release }
      - uses: actions/checkout@v7
        with: { repository: your-org/sutraflow, path: sutraflow }
      - uses: actions/setup-node@v7
        with: { node-version: 24 }
      - run: npm ci
        working-directory: sutraflow
      - run: |
          npm run --prefix sutraflow sutra -- check  "$PWD/release.zip" --server "$PROD_SERVER" --token "$PROD_TOKEN"
          npm run --prefix sutraflow sutra -- deploy "$PWD/release.zip" --server "$PROD_SERVER" --token "$PROD_TOKEN" --config "$PWD/sutraflow/../config/prod.json"
        env:
          PROD_SERVER: '${{ vars.PROD_SERVER }}'
          PROD_TOKEN: '${{ secrets.PROD_TOKEN }}'

GitLab CI

stages: [build, test, uat, production]
image: node:24
variables: { VERSION: "${CI_COMMIT_TAG}" }
before_script:
  - git clone --depth 1 https://gitlab.example.com/tools/sutraflow.git /opt/sutraflow && (cd /opt/sutraflow && npm ci)
  - alias sutra="node --import tsx /opt/sutraflow/server/src/cli.ts"
build:
  stage: build
  rules: [{ if: $CI_COMMIT_TAG }]
  script: [ 'sutra package --from-git . --ref "$CI_COMMIT_TAG" --version "${VERSION#v}" --out release.zip' ]
  artifacts: { paths: [release.zip] }
test:
  stage: test
  script: [ sutra test release.zip --secrets-from-env ]
uat:
  stage: uat
  environment: uat
  script: [ sutra deploy release.zip --config config/uat.json --server "$UAT_SERVER" --token "$UAT_TOKEN" ]
production:
  stage: production
  environment: production
  when: manual
  script:
    - sutra check  release.zip --server "$PROD_SERVER" --token "$PROD_TOKEN"
    - sutra deploy release.zip --config config/prod.json --server "$PROD_SERVER" --token "$PROD_TOKEN"

Azure DevOps

trigger: { tags: { include: ['v*'] } }
pool: { vmImage: ubuntu-latest }
stages:
- stage: Build
  jobs:
  - job: package
    steps:
    - checkout: self
    - checkout: git://Tools/sutraflow
    - task: NodeTool@0
      inputs: { versionSpec: '24.x' }
    - script: cd sutraflow && npm ci
    - script: node --import tsx sutraflow/server/src/cli.ts package --from-git $(Build.SourcesDirectory)/orders --ref $(Build.SourceBranchName) --version $(Build.SourceBranchName) --out $(Build.ArtifactStagingDirectory)/release.zip
    - publish: $(Build.ArtifactStagingDirectory)/release.zip
      artifact: release
- stage: Production
  dependsOn: Build
  jobs:
  - deployment: deploy
    environment: production                           # approvals and checks on the environment
    strategy:
      runOnce:
        deploy:
          steps:
          - script: node --import tsx $(Pipeline.Workspace)/sutraflow/server/src/cli.ts deploy $(Pipeline.Workspace)/release/release.zip --server $(PROD_SERVER) --token $(PROD_TOKEN) --config config/prod.json

Jenkins

pipeline {
  agent { docker { image 'node:24' } }
  environment { SUTRA = 'node --import tsx /opt/sutraflow/server/src/cli.ts' }
  stages {
    stage('Build')  { steps { sh '$SUTRA package --from-git . --ref "$TAG_NAME" --version "${TAG_NAME#v}" --out release.zip' } }
    stage('Test')   { steps { sh '$SUTRA test release.zip --secrets-from-env' } }
    stage('UAT')    { steps { withCredentials([string(credentialsId: 'uat-token', variable: 'T')]) { sh '$SUTRA deploy release.zip --config config/uat.json --server $UAT_SERVER --token $T' } } }
    stage('Approve') { steps { input 'Deploy to production?' } }
    stage('Production') { steps { withCredentials([string(credentialsId: 'prod-token', variable: 'T')]) { sh '$SUTRA deploy release.zip --config config/prod.json --server $PROD_SERVER --token $T' } } }
  }
  post { success { archiveArtifacts 'release.zip' } }
}

Container images

For immutable production, bake the release into an engine image: FROM sutraflow:2.1.8, COPY release.zip /deploy/, and start it with SUTRA_MODE=engine SUTRA_DEPLOY_DIR=/deploy; the engine deploys every package in the folder at start. A new release is a new image.

Good practice

One zip, many environments: build once, deploy the same artifact to UAT and production.
Give each environment its own system account and token, with Deploy on the project only.
Let the pipeline fail on sutra check before anything changes; keep rollback one command away.
Store the zip with the pipeline run: it is the record of exactly what went live.

49. Troubleshooting

SymptomCause and remedy
A mapping shows not runThe activity was on a branch that was not taken in the last test. Test with data that takes that branch.
An API caller waits a minute, then gets 504A branch ended without Send HTTP response or SOAP reply. Add replies on every branch, including error branches.
A timer or file trigger does nothingOnly the deployed version listens. Deploy, then check listener health on the Designer's Services page.
Required fields not mappedThe Input tab names them. Map them, or remove the requirement from the schema.
Formula errorThe preview under the formula names the problem: an unknown function, a missing bracket, or a quote not doubled.
The run stops after 10000 stepsA loop that never ends. Check the condition that leaves it.
Let's Encrypt failsPort 80 on the domain must reach the gateway's HTTP port.

Reference

50. Activity reference

Triggers

▶Manual start

Palettes → Triggers · activity type start · trigger

Starts the Sutra from the studio, the Run API, sutra or Call Sutra, with a test payload. Its payload schema (JSON Schema or XSD) is the input contract callers see.

In scope
  • Starting a process from the studio (Test, Debug) or from another system through the Run API.
  • A test payload in JSON, and optionally a schema that describes the input or, with strict validation on, checks it.
Out of scope
  • Starting on a schedule, a request, a file or a message: use the trigger made for it.

When to use it

  • A process that another process or system starts on demand.
  • Building and testing a process before you choose its real trigger.

When to choose another activity

  • Run on a schedule → use Timer.
  • Expose the process as a REST API → use REST service.

Procedure

  1. Drag Manual start onto an empty canvas (a new flow already has one).
  2. In the General tab, write a test payload in JSON.
  3. To check the input, choose a payload schema and turn on Strict schema validation: input that does not match is refused before a run starts. With it off, the schema only describes the data.

Output

  • The payload: either what the Run API sent, or the test payload.

Outputs (ports)

out

Settings reference

General tab

SettingWhat it doesValuesDefault
Payload schemaDescribes the payload: a JSON Schema/sample, or an XSD for XML. A Call Sutra step that calls this Sutra maps to it. Turn strict validation On to enforce it before a run starts.A shared schema (json, xsd)—
Strict schema validationOn requires a payload schema and rejects invalid input from every caller before processing. Off is descriptive only.On or offOff
Test payloadJSON; XML text when the payload schema is an XSD. With an XSD the step gives the data in the Parse XML shape and the text under xml.Code or JSON{ "orderId": "A-1001" }

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⏱Timer

Palettes → Triggers · activity type timer · trigger

Starts the Sutra on a schedule while the Sutra is deployed: a cron expression or a fixed interval.

In scope
  • Cron expressions with optional seconds and a time zone.
  • A fixed interval in seconds.
  • A fixed payload added to every run, plus firedAt.
Out of scope
  • Missed runs while the server was stopped are not run afterwards.
  • Calendars of holidays: test the date in an If / else after the timer.

When to use it

  • Nightly exports, polling an API every few minutes, a daily report.

When to choose another activity

Procedure

  1. Choose cron or interval.
  2. For cron, write the expression, for example 0 30 9 * * MON-FRI, and the time zone.
  3. Deploy the Sutra. The timer runs only while the deployed version is active.

Output

  • The payload fields and firedAt (ISO date and time).
Guidelines
  • Put the schedule in a project variable ({{gv.EXPORT_CRON}}) so operations can change it per environment.

Outputs (ports)

out

Settings reference

General tab

SettingWhat it doesValuesDefault
Schedule bycron, intervalcron
Cron expression when Schedule by is cronSeconds field optional. Example: 0 30 9 * * MON-FRIText; {{gv.X}}, {{ev.X}} or an = formula0 */15 * * * *
Every (seconds) when Schedule by is intervalA number; may be a formula or variable300
Time zone when Schedule by is cronText; {{gv.X}}, {{ev.X}} or an = formulaAsia/Kolkata
Payload (JSON)Code or JSON{}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⇲REST service

Palettes → Triggers · activity type restService · trigger

Exposes the Sutra as an HTTP/REST API on the gateway. Reply with a Send HTTP response step.

In scope
  • One HTTP method and path per trigger, with :name path parameters.
  • An API security policy: Basic, API key, JWT, token introspection, HMAC signatures, gateway apps, mutual TLS, IP allow list, rate limit, CORS, threat protection.
  • JSON, XML, form and text bodies; a body schema (JSON Schema, a JSON sample or an XSD element) for mapping, and enforced with Validate requests: reject invalid (a 400 with the errors).
  • Required scopes for this service, on top of the policy's.
Out of scope
  • Several paths in one trigger: use one REST service per path, or a path parameter.

When to use it

  • Publishing a Sutra as an API for partners, apps and other systems.

When to choose another activity

Procedure

  1. Choose the method and the path, for example GET /orders/:id.
  2. Pick an API security policy (Resources → API security policy).
  3. Write a test request so you can test without a caller.
  4. End each branch with Send HTTP response.
  5. Deploy. The API is served by the gateway on ports 8080 and 8443.

Output

  • method, path, params, query, headers, body, auth (the caller after the policy check) and client (IP address, HTTPS).
Guidelines
  • Never deploy without a policy outside testing.
  • Always reply on the error branch too, or the caller waits until the reply timeout (60 seconds by default).

Outputs (ports)

out

Settings reference

General tab

SettingWhat it doesValuesDefault
MethodGET, POST, PUT, PATCH, DELETE, ANYPOST
PathUse :name for path parameters. Served on the gateway ports.Text; {{gv.X}}, {{ev.X}} or an = formula/orders/:id
API security policyEmpty = no authentication (not advised outside testing).A API security policy from Resources—
Max body size (KB)A number; may be a formula or variable1024
Required scopesSpace separated, such as orders:write. The caller's token or gateway app must hold every one (in addition to the policy's).Text; {{gv.X}}, {{ev.X}} or an = formula—
Request body schemaOptional. Shape of the JSON or XML body callers send: a JSON Schema, a JSON sample or an XSD element.A shared schema—
Validate requestsreject invalid: a body that does not match the schema is refused before a run starts (REST: 400 with the errors; SOAP: a Client fault).off, reject invalidoff
Test request (JSON)Code or JSON{ "method": "POST", "params": { "id": "A-1001" }, "query": {}, …

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⧉SOAP service

Palettes → Triggers · activity type soapService · trigger

Exposes the Sutra as a SOAP web service with a generated WSDL. Each operation is an output; reply with a SOAP reply step.

In scope
  • A SOAP 1.1 or 1.2 service with a generated WSDL at ?wsdl.
  • One output per operation, listed in the operations field.
  • The same API security policies as REST, plus WS-Security: UsernameToken, X.509 signatures, SAML assertions, timestamps and encrypted requests.
  • An XSD with an element per operation, enforced with Validate requests; scopes per operation.
Out of scope
  • Importing an existing WSDL to define the service contract.
  • Encrypting the reply to the caller.

When to use it

  • Replacing or fronting a SOAP service that partners already call.

When to choose another activity

Procedure

  1. Name the service and namespace, and the path (for example /soap/orders).
  2. List the operations, separated by commas. Each becomes an output port.
  3. Connect each operation to its steps and end each with SOAP reply.
  4. Deploy, then give callers https://host:8443/soap/orders?wsdl.

Output

  • operation, body (the operation element as data), header, soapAction, auth, client.

Outputs (ports)

GetOrder CreateOrder The outputs follow your settings; shown here with the defaults.

Settings reference

General tab

SettingWhat it doesValuesDefault
Service nameText; {{gv.X}}, {{ev.X}} or an = formulaOrderService
Target namespaceText; {{gv.X}}, {{ev.X}} or an = formulaurn:sutra:orders
PathWSDL is served at this path with ?wsdl.Text; {{gv.X}}, {{ev.X}} or an = formula/soap/orders
Operations (comma separated)Text; {{gv.X}}, {{ev.X}} or an = formulaGetOrder, CreateOrder
SOAP version1.1, 1.21.1
API security policyUse WS-Security UsernameToken for SOAP callers, or mutual TLS / Basic.A API security policy from Resources—
Scopes per operationOperation = space separated scopes the caller's token or gateway app must hold for it, such as CancelOrder = orders:cancel.Rows of name and value—
Request schema (XSD)Optional. An XSD with one element per operation, named like it (GetOrder); the content of the operation element is checked against it.A shared schema—
Validate requestsreject invalid: a body that does not match the schema is refused before a run starts (REST: 400 with the errors; SOAP: a Client fault).off, reject invalidoff
Test request (JSON)Code or JSON{ "operation": "GetOrder", "body": { "OrderId": "A-1001" } }

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⇶Channel trigger

Palettes → Triggers · activity type channelTrigger · trigger

Starts the Sutra for each message sent to an internal channel with Send to channel, while the Sutra is deployed.

In scope
  • Starting the Sutra for each message sent to a channel with Send to channel.
Out of scope
  • Messages sent while the Sutra was not deployed are not kept.

When to use it

  • Sutras that react to events from other Sutras of the project.

Procedure

  1. Set the channel name, optionally a message schema, and a test message.
  2. Deploy. The channel listens while the deployed version is active (see the Designer's Services page).

Output

  • The message.

Outputs (ports)

out

Settings reference

General tab

SettingWhat it doesValuesDefault
ChannelMay use {{gv.CHANNEL}}.Text; {{gv.X}}, {{ev.X}} or an = formulaorders
Message schemaOptional. Describes the message for mapping.A shared schema—
Strict message validationOn or offOff
Test message (JSON)Code or JSON{ "orderId": "A-1001" }

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⇄WebSocket service

Palettes → Triggers · activity type wsService · trigger

Accepts WebSocket connections on the gateway. Each message starts a run (output message); connect and disconnect start runs when open or close are connected. Answer or push with a WebSocket send step.

In scope
  • Clients connect with ws:// on the gateway HTTP port or wss:// on its HTTPS port, at a path of your choice.
  • Each message starts a run on the output message; connecting and disconnecting start runs on open and close when those outputs are connected.
  • One message at a time per connection (answers keep their order), or side by side.
  • The API security policy at connect time, with a token as ?access_token= or the key in the query for browsers; CORS origins; required scopes; message size, nesting and schema checks.
Out of scope
  • Binary protocols on top of WebSocket (messages are JSON or text; binary arrives as base64).
  • Sticky sessions: a connection stays on the engine that accepted it, but any engine can send to it.

When to use it

  • Live order status for a web page or app, dashboards that update, chat front ends, devices that keep a connection open.

When to choose another activity

Procedure

  1. Set the path, for example /ws/orders, and an API security policy.
  2. Connect message to the steps that handle a message, and end with WebSocket send to answer.
  3. Connect open to send a welcome or remember the connection id; close to clean up.
  4. Deploy, then connect: new WebSocket('wss://host:8443/ws/orders?access_token=...').

Output

  • event (message, open or close), connectionId, message, path, params, auth, client; on close also code and reason.

Outputs (ports)

message open close

Settings reference

General tab

SettingWhat it doesValuesDefault
Pathws:// on the gateway HTTP port, wss:// on its HTTPS port. Use :name for path parameters.Text; {{gv.X}}, {{ev.X}} or an = formula/ws/orders
API security policyChecked when a client connects. Browsers cannot send headers: they pass a token as ?access_token= or the key under the key header's name in the query. CORS origins limit which pages may connect.A API security policy from Resources—
Required scopesSpace separated; the caller's token or gateway app must hold every one.Text; {{gv.X}}, {{ev.X}} or an = formula—
Messages arejson, textjson
Max message size (KB)A number; may be a formula or variable256
One message at a time per connectionThe next message of a connection starts its run when the previous run ends, so answers keep their order. Off: messages run side by side.On or offOn
Message schemaOptional: a JSON Schema or JSON sample of the messages.A shared schema—
Validate messagesreject invalid: a message that does not match gets an error message back and starts no run.off, reject invalidoff
Test message (JSON)Code or JSON{ "event": "message", "connectionId": "test", "message": { "type…

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⇆WebSocket client

Palettes → Triggers · activity type wsClientTrigger · trigger

Connects to a WebSocket server and starts a run for each message it sends. Reconnects when the connection is lost (waiting longer each time), and sends a subscribe message after every connect. Runs on the leader engine of a cluster.

In scope
  • Connects to a WebSocket server (a WebSocket connection in Resources: address, headers with secrets, subprotocols).
  • Sends a subscribe message after every connect, starts a run for every message it receives, and reconnects when the connection is lost, waiting longer each time up to the longest wait.
  • Keeps the connection alive with pings.
Out of scope
  • Several connections per trigger: use one trigger per stream.

When to use it

  • Price, sensor or order feeds that push over WebSocket; partner systems that publish events this way.

When to choose another activity

Procedure

  1. Create the WebSocket connection with its address and any Authorization header.
  2. Write the subscribe message the server expects, if any.
  3. Deploy. In a cluster the leader engine holds the connection, so each message starts one run.

Output

  • message (parsed JSON, or text), connection, receivedAt.

Outputs (ports)

out

Settings reference

General tab

SettingWhat it doesValuesDefault
WebSocket connectionA WebSocket connection from Resources—
Messages arejson, textjson
Test message (JSON)Code or JSON{ "channel": "orders", "data": { "orderId": "A-1001" } }

Input tab

SettingWhat it doesValuesDefault
Send after connectingOptional, such as {"op":"subscribe","channel":"orders"}. Sent again after every reconnect.Code or JSON—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

HTTP / REST

⇋Send HTTP request

Palettes → HTTP / REST · activity type httpRequest

Calls a REST/HTTP API with headers, query, body and an outbound security profile (Basic, Bearer, API key, OAuth 2.0). TLS and client certificates come from the HTTP connection.

In scope
  • Any method, URL, query and headers; JSON, XML, text, form or a body mapped to a schema.
  • Outbound security: Basic, Bearer, API key, OAuth 2.0 client credentials, custom headers.
  • TLS and mutual TLS, proxy and timeout from an HTTP connection.
Out of scope

When to use it

  • Calling REST APIs.

When to choose another activity

Procedure

  1. Pick an HTTP connection (base URL, TLS) and outbound security, both from Resources.
  2. Choose the method and the URL; add query parameters and headers.
  3. Choose the body type and fill in the body, or map it to a schema in the Input tab.
  4. Pick a response schema so later steps see the response fields.
  5. Choose when the step fails, and connect the error output.

Output

  • status, headers, body (parsed JSON or XML when possible), ms.
Guidelines
  • Use retries in the Settings tab for calls that may fail briefly.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
HTTP connectionOptional. Base URL, TLS, client certificate, proxy.A HTTP connection from Resources—
Outbound securityA Outbound security from Resources—
MethodGET, POST, PUT, PATCH, DELETE, HEAD, OPTIONSGET
Body when Method is POST or PUT or PATCH or DELETEMapped: build the body field by field against a shared schema in the Input tab.none, json, xml, text, form, mapped JSON, mapped XMLjson
Body schema when Body is json or xml or mapped JSON or mapped XMLOptional. Validate the completed request before sending.A shared schema—
Read response asauto, json, xml, textauto
Response body schemaOptional. Validates the received response and describes it for later mapping.A shared schema—
Fail when status is4xx or 5xx, 5xx only, never4xx or 5xx

Input tab

SettingWhat it doesValuesDefault
URL or pathText; {{ }} references or an = formulahttps://httpbin.org/anything/{{input.orderId}}
Query parametersRows of name and value—
HeadersValues may use a Secret property, such as Authorization = Bearer {{gv.API_TOKEN}}; secret values are masked in run history.Rows of name and valueAccept
Request body when Body is mapped JSON or mapped XMLMapped in the Input tab—
Body content when Body is json or xml or textFor JSON, write JSON with {{ }} references, or one reference such as {{nodes.Map order}}.Code or JSON{ "orderId": "{{input.orderId}}" }
Form fields when Body is formRows of name and value—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⇱Send HTTP response

Palettes → HTTP / REST · activity type httpResponse

Replies to the caller of a REST service trigger. The Sutra can continue after replying.

In scope
  • The reply to a REST service caller: status, content type, headers and body.
Out of scope
  • Sutras without a REST trigger: the step does nothing there.

When to use it

  • The end of every branch of an API Sutra, including error branches.

Procedure

  1. Set the status code and content type.
  2. Write the body, or map it to a schema in the Input tab.

Output

  • The reply that was sent.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Content typeapplication/json, application/xml, text/plain, text/csv, text/htmlapplication/json
Build body fromtemplate, mappingtemplate
Body schemaOptional. Validates JSON/XML before replying, for templates and mappings.A shared schema—

Input tab

SettingWhat it doesValuesDefault
Status codeText; {{ }} references or an = formula200
Body when Build body from is templateCode or JSON{ "ok": true, "orderId": "{{input.orderId}}" }
Response body when Build body from is mappingMapped in the Input tab—
HeadersRows of name and value—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

SOAP / Web services

⧉Invoke SOAP service

Palettes → SOAP / Web services · activity type soapInvoke

Calls a SOAP web service from its WSDL (or a raw envelope) with WS-Security: UsernameToken, SAML token, X.509 signature, plus Basic/Bearer and mutual TLS.

In scope
  • Calling a WSDL operation from a URL or a project service descriptor, with an operation picker.
  • A raw envelope for services without a usable WSDL.
  • WS-Security: UsernameToken, SAML token, X.509 signature; Basic and other HTTP security.
Out of scope
  • WS-Security encryption.

When to use it

  • Calling SOAP services of banks, ERPs and government systems.

When to choose another activity

Procedure

  1. Choose WSDL or raw envelope.
  2. For WSDL, pick the service descriptor (Project → Service descriptors) or enter the WSDL URL, then the service, port and operation.
  3. Map the operation's arguments in the Input tab.
  4. Pick outbound security for WS-Security.
  5. Connect fault to handle SOAP faults.

Output

  • body, header, status, ms. fault carries the fault code and string.

Outputs (ports)

out fault error

Settings reference

General tab

SettingWhat it doesValuesDefault
Call usingwsdl, raw envelopewsdl
HTTP connectionTLS, client certificate, proxy, timeout.A HTTP connection from Resources—
Outbound securityWS-Security profiles add a wsse:Security header; Basic/Bearer/API key go in HTTP headers.A Outbound security from Resources—
WSDL from when Call using is wsdlurl, projecturl
WSDL URL when WSDL from is urlText; {{gv.X}}, {{ev.X}} or an = formulahttp://localhost:8080/soap/orders?wsdl
Service descriptor when WSDL from is projectA WSDL stored in the project (Service descriptors). Set the endpoint below if its address is not right for this environment.A shared schema (wsdl)—
Service when Call using is wsdlFilled by "Load operations". Empty = first service.Text; {{gv.X}}, {{ev.X}} or an = formula—
Port when Call using is wsdlText; {{gv.X}}, {{ev.X}} or an = formula—
Operation when Call using is wsdlText; {{gv.X}}, {{ev.X}} or an = formulaGetOrder
Build request from when Call using is wsdltemplate, mappingtemplate
Request schemaWSDL strict requests use a JSON contract for the arguments object. Raw-envelope requests may use an XSD for the operation XML.A shared schema—
Strict request validationOn or offOff
Response schemaOptional. Describes the response body for mapping in later steps.A shared schema—
Strict successful response validationOn checks the response body/operation before emitting out. SOAP faults retain the fault port and are not validated against the success schema.On or offOff
SOAP version when Call using is raw envelope1.1, 1.21.1

Input tab

SettingWhat it doesValuesDefault
Request message (JSON) when Build request from is templateField names follow the WSDL input message.Code or JSON{ "OrderId": "{{input.orderId}}" }
Request message when Build request from is mappingMapped in the Input tab—
Endpoint URLOverrides the WSDL address (raw mode: required).Text; {{ }} references or an = formula—
SOAPAction when Call using is raw envelopeText; {{ }} references or an = formula—
Body XML when Call using is raw envelopeCode or JSON<ord:GetOrder xmlns:ord="urn:sutra:orders"> <ord:OrderId>{{input.ord…
Extra SOAP headers (XML)Added inside soap:Header, e.g. WS-Addressing or a custom token.Code or JSON—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⧈SOAP reply

Palettes → SOAP / Web services · activity type soapReply

Replies to the caller of a SOAP service trigger with a response message or a SOAP fault.

In scope
Out of scope
  • Sutras without a SOAP trigger.

When to use it

  • The end of each operation's branch.

Procedure

  1. Choose response or fault.
  2. For a response, write or map the body; for a fault, the code and message.

Output

  • The reply that was sent.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Reply withresponse, faultresponse
Build response from when Reply with is responsetemplate, mappingtemplate
Response schema when Reply with is responseA shared schema—
Strict response validation when Reply with is responseValidate the completed successful reply: JSON checks the body value; XSD checks the actual OperationResponse element in the service namespace. Explicit SOAP faults are separate.On or offOff
Fault code when Reply with is faultText; {{gv.X}}, {{ev.X}} or an = formulasoap:Client

Input tab

SettingWhat it doesValuesDefault
Response message (JSON) when Build response from is templateWrapped in <OperationResponse> in the service namespace.Code or JSON{ "OrderId": "{{input.body.OrderId}}", "Status": "SHIPPED" }
Response message when Build response from is mappingMapped in the Input tab—
Fault message when Reply with is faultText; {{ }} references or an = formulaOrder {{input.body.OrderId}} not found

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

WebSocket

⇉WebSocket send

Palettes → WebSocket · activity type wsSend

Sends a message to a client of a WebSocket service: the one that sent the message being handled, another connection, or every connection of a service. Can also close a connection.

In scope
  • Answers the connection whose message is being handled, writes to any connection by its id, or to every connection of a service (broadcast).
  • Closes a connection with a code and a reason.
  • Works across a cluster: a connection held by another engine gets the message through the database within a fraction of a second.
Out of scope
  • Waiting for the client's answer: it arrives as a new message on the service trigger.

When to use it

  • Answering a request, pushing an update when an order changes, notifying everyone on a page.

When to choose another activity

Procedure

  1. Choose who to send to; for a later push, keep the connectionId (a memory table is a good place).
  2. Write the message as JSON or text, with references to earlier steps.

Output

  • delivered (connections reached on this engine), forwarded (messages left for other engines), connectionId.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Send tothis connection, a connection, every connection of a servicethis connection
Actionsend, closesend
Send as when Action is sendjson, textjson
Close code when Action is closeA number; may be a formula or variable1000
Close reason when Action is closeText; {{gv.X}}, {{ev.X}} or an = formula—

Input tab

SettingWhat it doesValuesDefault
Connection id when Send to is a connectionA connectionId a WebSocket service trigger gave, kept for example in a memory table.Text; {{ }} references or an = formula{{trigger.connectionId}}
Service path when Send to is every connection of a serviceText; {{ }} references or an = formula/ws/orders
Message when Action is sendCode or JSON{ "ok": true, "orderId": "{{input.message.orderId}}" }

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

↠WebSocket client send

Palettes → WebSocket · activity type wsClientSend

Connects to a WebSocket server, sends a message and, if asked, waits for the answer; then closes the connection.

In scope
  • Connects, sends one message and closes; waits for the answer when asked, optionally for the one whose field matches (an id).
Out of scope
  • Keeping the connection open between runs: use the WebSocket client trigger for streams.

When to use it

  • Request and answer over a WebSocket API: status checks, commands to a device.

When to choose another activity

Procedure

  1. Pick the WebSocket connection and write the message.
  2. Turn on Wait for the answer, and set Answer has field and Equal to when the server sends other messages too.

Output

  • sent, reply.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
WebSocket connectionA WebSocket connection from Resources—
Send asjson, textjson
Wait for the answerOn or offOn
Wait at most (ms) when Wait for the answer is onA number; may be a formula or variable10000

Input tab

SettingWhat it doesValuesDefault
MessageCode or JSON{ "op": "status", "orderId": "{{input.orderId}}" }
Answer has field when Wait for the answer is onOptional: wait for a message with this field equal to the value below, such as id (skips other messages).Text; {{ }} references or an = formula—
Equal to when Wait for the answer is onText; {{ }} references or an = formula—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

Data & mapping

⇄Map data

Palettes → Data & mapping · activity type mapper

Builds a new message from earlier steps. Pick a shared schema for the target, or add target fields by hand; map each with a formula, For-Each, If or Choose.

In scope
  • Building a new message field by field from earlier steps.
  • A shared schema for the target, or target fields added by hand.
  • Formulas with nested functions, For-Each with Where, Group by and Sort by, If, Choose.
Out of scope
  • Calling anything: mapping only reshapes data.

When to use it

  • Shaping a reply, building a request body, renaming and converting fields.

When to choose another activity

Procedure

  1. Pick a target schema in General, or leave it empty and add fields in the Input tab.
  2. In Input, drag fields from Sutra Data to the target, or select a target and write its formula.
  3. Drop a list on a repeating target to create a For-Each; add Where, Group by or Sort by below.
  4. Test, and check the values in the Output tab.

Output

  • The mapped message.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Target schemaOptional. Without one, add target fields in the Input tab.A shared schema—
Strict target validationOn checks the completed transformed target against its selected schema. Source and target field names may differ. Off leaves this generic Map target descriptive; typed Map JSON/XML targets retain their own checks.On or offOff
Start frominput: keep the incoming fields and add or replace the mapped ones.empty, inputempty

Input tab

SettingWhat it doesValuesDefault
TargetMapped in the Input tab—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

{}Parse JSON

Palettes → Data & mapping · activity type parseJson

Turns JSON text into data; a shared schema describes the result for mapping.

In scope
  • JSON text to data, with an optional schema that describes it for mapping.
  • Selected-schema validation is explicitly enabled with the checkbox (default Off). On requires a contract and enforces patterns, formats, types and ranges; JSON samples are strict shapes.
Out of scope
  • Inferring business rules absent from the selected schema.

When to use it

  • A text field, file or message that holds JSON.

Procedure

  1. Set the text, for example {{input.body}}.
  2. Pick the schema so later steps see the fields.

Output

  • The parsed data.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
SchemaA shared schema (json)—
Validate against schemaOn requires a selected contract. JSON samples require every shown field and reject extra fields; use JSON Schema for optional fields.On or offOff

Input tab

SettingWhat it doesValuesDefault
JSON textText; {{ }} references or an = formula{{input.body}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⟨⟩Render JSON

Palettes → Data & mapping · activity type renderJson

Turns data into JSON text: from one value, or mapped field by field to a shared schema.

In scope
  • Data to JSON text: from one value, or mapped field by field to a schema.
Out of scope

When to use it

  • A message body or file content that must be JSON text.

Procedure

  1. Choose value or mapping.
  2. For mapping, pick the schema and map it in the Input tab.

Output

  • text.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Build fromvalue, mappingvalue
SchemaA shared schema (json)—
Pretty printOn or offOn
Validate against schemaOn requires a selected JSON contract; it validates the value, not the serialized text. Samples are strict shapes; JSON Schema defines optional fields and allowed extras.On or offOff

Input tab

SettingWhat it doesValuesDefault
Data when Build from is valueText; {{ }} references or an = formula{{input}}
JSON content when Build from is mappingMapped in the Input tab—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

</>Parse XML

Palettes → Data & mapping · activity type parseXml

Turns XML text into data. Namespace prefixes are removed; attributes start with @_. An XSD describes the result for mapping.

In scope
  • XML text to data. Namespace prefixes are removed after validation; attributes start with @_.
  • Optional XSD 1.0 validation of original XML: namespaces, groups, patterns, enums, types and occurrences.
Out of scope
  • XSD 1.1 or loading dependencies from URLs or the server filesystem.

When to use it

  • XML from files, queues or HTTP responses.

Procedure

  1. Set the text.
  2. Pick the XSD and, when it has several, the root element.

Output

  • The parsed data, with the root element as the first field.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Schema (XSD)A shared schema (xsd)—
Validate against schemaOn requires a selected XSD and enforces it before parsing.On or offOff

Input tab

SettingWhat it doesValuesDefault
XML textText; {{ }} references or an = formula{{input.body}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⟨/⟩Render XML

Palettes → Data & mapping · activity type renderXml

Turns data into XML text: from one value under a root element, or mapped field by field to an XSD.

In scope
  • Data to XML text: from one value, or mapped to an XSD.
  • Root element name and an optional XML declaration.
Out of scope

When to use it

  • XML files and messages for partners.

Procedure

  1. Choose value or mapping.
  2. For mapping, pick the XSD and map it in the Input tab.

Output

  • text.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Build fromvalue, mappingvalue
Root element when Build from is valueText; {{gv.X}}, {{ev.X}} or an = formulaOrder
Schema (XSD)A shared schema (xsd)—
Add <?xml?> declarationOn or offOn
Validate against schemaOn requires a selected XSD and validates the exact serialized XML before returning text.On or offOff

Input tab

SettingWhat it doesValuesDefault
Data when Build from is valueText; {{ }} references or an = formula{{input}}
XML content when Build from is mappingMapped in the Input tab—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

▦Parse CSV

Palettes → Data & mapping · activity type parseCsv

Turns CSV text with a header row into a list of rows.

In scope
  • CSV text to rows, using the first line as column names.
Out of scope
  • Reading CSV files: Read file reads and types rows in one step.

When to use it

  • CSV that arrives in a message or an HTTP body.

Procedure

  1. Set the text and the separator.

Output

  • rows and count.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Separator,, ;, |, tab,

Input tab

SettingWhat it doesValuesDefault
CSV textText; {{ }} references or an = formula{{input.csv}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

▤Render CSV

Palettes → Data & mapping · activity type renderCsv

Turns a list of rows into CSV text.

In scope
  • A list of objects to CSV text, with a header row.
Out of scope
  • Writing a CSV file: Write file does it directly from rows.

When to use it

  • CSV for an email attachment or an HTTP upload.

Procedure

  1. Set the list and the separator.

Output

  • text.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Separator,, ;, |, tab,

Input tab

SettingWhat it doesValuesDefault
RowsText; {{ }} references or an = formula{{input.items}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⊻Filter list

Palettes → Data & mapping · activity type filter

Keeps the rows that pass a check.

In scope
  • Keeping list items where one field compares to a value.
Out of scope
  • Conditions on several fields: use a predicate in a formula, {input.rows}[Amount > 1000 and Country = 'IN'].

When to use it

  • Simple filters that people can read at a glance.

Procedure

  1. Set the list, the field, the comparison and the value.

Output

  • items and count.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Field in each rowText; {{gv.X}}, {{ev.X}} or an = formulastatus
Checkequals, not equals, contains, starts with, greater than, less than, is empty, is not empty, matches regexequals

Input tab

SettingWhat it doesValuesDefault
ListText; {{ }} references or an = formula{{input.rows}}
Compare toText; {{ }} references or an = formulapaid

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⇅Sort list

Palettes → Data & mapping · activity type sort

Orders rows by a field.

In scope
  • Sorting a list by one field, ascending or descending.
Out of scope
  • Several sort keys: use JSONata.

When to use it

  • Oldest first, highest amount first.

Procedure

  1. Set the list, the field and the direction.

Output

  • items and count.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Sort by fieldText; {{gv.X}}, {{ev.X}} or an = formulaamount
Orderascending, descendingascending

Input tab

SettingWhat it doesValuesDefault
ListText; {{ }} references or an = formula{{input.items}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

ΣAggregate

Palettes → Data & mapping · activity type aggregate

Sum, average, count, min or max of a field, optionally grouped.

In scope
  • Sum, average, minimum, maximum or count of a field, optionally per group.
Out of scope

When to use it

  • A total amount, the number of orders per country.

Procedure

  1. Set the list, the field, the function and optionally the group field.

Output

  • result, or one entry per group.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
FieldText; {{gv.X}}, {{ev.X}} or an = formulaamount
Calculatesum, average, count, min, maxsum
Group by field (optional)Text; {{gv.X}}, {{ev.X}} or an = formula—

Input tab

SettingWhat it doesValuesDefault
ListText; {{ }} references or an = formula{{input.items}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

{}Map JSON Data

Palettes → Data & mapping · activity type mapperJson

Builds structured JSON data with typed targets, formulas and repeating fields. Select a shared JSON Schema or define fields in Input. Use Render JSON to produce text.

In scope
  • Building a structured JSON-compatible object with a shared JSON Schema or manually typed fields.
  • Required fields, integer/number/boolean/string/object types and repeating lists with minimum/maximum items.
  • The same formulas, For-Each, Where, Group by, Sort by, If and Choose used by Map data.
Out of scope
  • Producing JSON text: use Render JSON after mapping.
  • Manual target definitions are not a complete JSON Schema; select a schema for patterns, ranges and conditional rules.

When to use it

  • Typed API replies, message bodies and file records.

When to choose another activity

Procedure

  1. Open Input. Select a Target JSON Schema there or in General. Create schema can import a schema definition or infer one from sample JSON; review the proposed types.
  2. Without a schema, enter a target path, choose its type and Required/Repeating options, then click + Field. Select a field to edit its description and list bounds.
  3. Drag sources onto targets or write formulas. Double-click a manual target or use its pencil button to rename it. Delete target field asks before removing its descendants and formulas; Undo restores the edit.
  4. Preview mapped result evaluates only this mapping using the last test input or JSON entered in the preview. It refreshes after edits. Check the displayed run id because sample data can be stale.
  5. Resolve required-target and formula errors before deployment. Stale rules and unknown source fields are warnings. Save, test the Sutra, and inspect Output.

Output

  • A structured object, not JSON text. Typed values are checked at runtime; failure follows the error output.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Target JSON SchemaA shared schema (json)—
Validate against schemaOn requires a selected contract. JSON Schema uses AJV; JSON samples are strict shapes. XML uses isolated libxml2 XSD 1.0. Manual targets are type-checked independently.On or offOff

Input tab

SettingWhat it doesValuesDefault
TargetMapped in the Input tab—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

</>Map XML Data

Palettes → Data & mapping · activity type mapperXml

Builds structured XML data with typed targets, formulas and repeating fields. Select a shared XSD or define fields in Input. Use Render XML to produce text.

In scope
  • Building an XML-shaped object from an XSD or manually defined elements and attributes.
  • One non-repeating root element, required fields, repeating child elements and namespace declarations on object elements.
Out of scope
  • Serializing XML text: follow with Render XML.
  • XSD 1.1 or unrestricted network/disk schema dependencies. Selected-schema validation enforces XSD 1.0 choice, groups, facets and occurrences.

When to use it

  • Preparing XML messages, SOAP payload objects and XML file content.

When to choose another activity

Procedure

  1. Open Input and select a Target XSD, including its root where there are several roots. Create schema accepts an authored XSD or generates a proposed XSD from sample XML.
  2. For a manual target keep or rename the initial Root object. Add Root/id as an integer element or Root/@_status as a string attribute. Attributes cannot repeat or contain objects.
  3. Select an object element to set its namespace URI. A name such as ns:User declares xmlns:ns; an unprefixed object declares a default namespace. Schema-backed complex roots use the XSD target namespace.
  4. Map child fields or For-Each repeating elements. Preview mapped result shows XML text without executing downstream steps. Then connect Render XML to serialize the mapped object.
  5. Test the Typed XML mapping sample for manual fields and XML in and out for shared Order/Invoice XSDs. Review schema-limit warnings; inferred XML schemas do not preserve namespace bindings.

Output

  • A structured object with element keys, @_attribute keys and repeating elements represented as arrays. Namespace declarations are ordinary XML attribute entries.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Target XSDA shared schema (xsd)—
Validate against schemaOn requires a selected contract. JSON Schema uses AJV; JSON samples are strict shapes. XML uses isolated libxml2 XSD 1.0. Manual targets are type-checked independently.On or offOff

Input tab

SettingWhat it doesValuesDefault
TargetMapped in the Input tab—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

JTransform (JSONata)

Palettes → Data & mapping · activity type jsonata

Reshapes JSON with a JSONata expression: filter rows, group, sum, rename, nest. $gv, $vars, $nodes and $trigger hold project variables, Sutra variables, earlier activities and the trigger.

In scope
  • A JSONata expression over the input: filter, group, aggregate and nest in one step.
Out of scope
  • Side effects such as calls or writes.

When to use it

  • Larger reshaping of repeating JSON, where many mapper rules would be needed.

When to choose another activity

  • Field-by-field mapping with a visual tree → use Map data.

Procedure

  1. Set the source, usually {{input}}.
  2. Write the expression, for example rows[Country = "IN"].{ "id": OrderId }.
  3. Test and read the result in the Output tab.

Output

  • The expression's result.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
ExpressionJSONata syntax: path.to.field, list[condition], {key: value}, $sum(), $count(), $map(), $string(). See docs.jsonata.org.Code or JSON{ "country": "INDIA", "orders": rows[$uppercase(Country) = "INDIA"…

Input tab

SettingWhat it doesValuesDefault
DataWhat the expression works on (its "$").Text; {{ }} references or an = formula{{input}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

Flow control

◇If / else

Palettes → Flow control · activity type if

Sends the data down the true or false branch.

In scope
  • One comparison with a true and a false output.
Out of scope

When to use it

  • An amount over a limit, a missing field, a status that must be approved.

When to choose another activity

  • Many conditions, first or all matches → use Router.
  • One value with many cases → use Switch.

Procedure

  1. Fill in the left value, the comparison and the right value.
  2. Connect true and false. A branch that is not taken is skipped, and Merge waits correctly for it.

Output

  • The input, unchanged.

Outputs (ports)

true false error

Settings reference

General tab

SettingWhat it doesValuesDefault
Checkequals, not equals, contains, starts with, greater than, less than, is empty, is not empty, matches regexequals

Input tab

SettingWhat it doesValuesDefault
ValueText; {{ }} references or an = formula{{input.status}}
Compare to when Check is equals or not equals or contains or starts with or greater than or less than or matches regexText; {{ }} references or an = formulapaid

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

☰Switch

Palettes → Flow control · activity type switch

Matches a value against cases. Each case is an output.

In scope
  • One value compared with a list of cases; one output per case plus default.
Out of scope
  • Conditions on different fields: use Router.

When to use it

  • Routing by status, country, message type or operation.

When to choose another activity

  • Conditions on different fields → use Router.

Procedure

  1. Set the value, for example {{input.status}}.
  2. List the cases. Each becomes an output.
  3. Connect default for anything else.

Output

  • The input, unchanged.

Outputs (ports)

retail wholesale default error The outputs follow your settings; shown here with the defaults.

Settings reference

General tab

SettingWhat it doesValuesDefault
Cases (comma separated)Text; {{gv.X}}, {{ev.X}} or an = formularetail, wholesale

Input tab

SettingWhat it doesValuesDefault
ValueText; {{ }} references or an = formula{{input.type}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⑂Router

Palettes → Flow control · activity type router

Conditional branches. Each route has a condition; take the first match or every match. Nothing matched goes to otherwise.

In scope
  • Named conditions, each with its own output, plus otherwise.
  • First match only, or every match (fan-out).
Out of scope
  • Waiting for the branches to finish: add Merge.

When to use it

  • Content-based routing: each message goes where its content says.

When to choose another activity

Procedure

  1. Add one row per route: a name and a formula that is true or false, for example {input.amount} > 1000.
  2. Choose first match or all matches.
  3. Connect each route and otherwise.

Output

  • The input, unchanged, on each matched route.

Outputs (ports)

large priority otherwise error The outputs follow your settings; shown here with the defaults.

Settings reference

General tab

SettingWhat it doesValuesDefault
Takefirst match, all matchesfirst match

Input tab

SettingWhat it doesValuesDefault
RoutesRoute name and its condition (an = expression or a {{ }} value; true when not empty or false).Rows of name and valuelarge, priority

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

↻For each

Palettes → Flow control · activity type forEach

Runs the item branch once per list entry, then the done branch once with the whole list.

In scope
  • Running the connected steps once for every item of a list.
  • A maximum item count as a safety limit.
Out of scope
  • Reshaping a list into another list: a For-Each in Map data is faster and simpler.

When to use it

  • Calling an API or writing a file once per order line, customer or row.

When to choose another activity

Procedure

  1. Set the list, for example {{input.rows}}.
  2. Connect item to the steps to run for each item; they see the item as input and its position as _index.
  3. Connect done to continue once with every item.

Output

  • item: the current item. done: items and count.

Outputs (ports)

item done error

Settings reference

General tab

SettingWhat it doesValuesDefault
Maximum itemsA number; may be a formula or variable1000

Input tab

SettingWhat it doesValuesDefault
ListText; {{ }} references or an = formula{{input.items}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⋈Merge

Palettes → Flow control · activity type merge

Waits for every incoming branch (branches not taken are skipped), then continues once with each branch's output by step name.

In scope
  • Waiting for every incoming branch, including branches that were skipped.
Out of scope
  • Combining values field by field: use Map data after the merge.

When to use it

  • Joining the true and false branches of an If / else, or parallel calls.

Procedure

  1. Connect every branch that should finish first.
  2. Read each branch's output by the name of its last step.

Output

  • One field per live branch, named after the step that reached the merge.

Outputs (ports)

out error

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⏸Wait

Palettes → Flow control · activity type wait

Pauses the branch. Waits over 5 seconds are durable and survive a restart.

In scope
  • A delay in milliseconds or until a date and time.
  • Waits over 5 seconds are stored and survive a restart.
Out of scope

When to use it

  • Backing off before a retry, sending a reminder tomorrow morning.

Procedure

  1. Enter the milliseconds, or a date in Or until such as {{input.dueAt}}.

Output

  • The input, unchanged.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Wait (milliseconds)A number; may be a formula or variable1000

Input tab

SettingWhat it doesValuesDefault
Or until (date/time)ISO date such as {{input.dueAt}}. Overrides the wait above.Text; {{ }} references or an = formula—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

✓Human approval

Palettes → Flow control · activity type approval

Pauses until the people it names approve or reject, in the Approval Center (/approvals). The run waits as saved state, for days if needed.

In scope
  • Pausing a run until the people it names approve or reject, in the Approval Center (/approvals), on a computer or a phone.
  • Approvers by role and by account (accounts may come from the data); any one of them, all of them, or a number of them; one rejection rejects.
  • Details shown to the approvers as labelled fields; a comment required on rejection (or always).
  • A due time that escalates to other roles or goes on through an expired output; reminders and email notices through an SMTP connection.
Out of scope
  • Approving by replying to an email: approvers decide in the Approval Center (the email links to it).

When to use it

  • Refunds over a limit, new suppliers, purchase orders, manual corrections.

Procedure

  1. Write the question with references, for example Refund {{input.amount}}?.
  2. Add details: Amount = {{input.total}}, Customer = {{input.customer}}.
  3. Name the approver roles (Finance approver) and/or accounts ({{input.managerAccount}}), and whether any one or all must approve.
  4. Optionally a due time, reminders and an email connection.
  5. Connect approved and rejected (and expired when it is chosen).

Output

  • The input plus approval: approved, by, comment, at, votes (each approver's decision), and expired when the due time ended it.
Guidelines
  • A waiting run costs nothing; it can wait for days.

Outputs (ports)

approved rejected error The outputs follow your settings; shown here with the defaults.

Settings reference

General tab

SettingWhat it doesValuesDefault
Approver rolesRole names or ids, such as Finance approver. Everyone holding one of these roles (on this project or all projects) can decide.A list—
Who must approveOne rejection rejects in every case.any one, all, a number of themany one
How many when Who must approve is a number of themA number; may be a formula or variable2
Comment requiredon rejection, always, neveron rejection
Due in (hours)0 = no due time.A number; may be a formula or variable0
When it is dueescalate: the escalation roles can decide too, with the same time again. expired output: the step goes on through its expired output.keep waiting, escalate, expired outputkeep waiting
Escalate to roles when When it is due is escalateA list—
Remind every (hours)0 = no reminders. Needs an email connection.A number; may be a formula or variable0
Email the approvers throughOptional. The approvers get an email when the approval arrives, at each reminder and on escalation, with a link to the Approval Center (their email address from Users).A Email (SMTP) from Resources—
Assignee (shown only)Older field: a name shown to people. Use Approver accounts to decide who may approve.Text; {{gv.X}}, {{ev.X}} or an = formula—

Input tab

SettingWhat it doesValuesDefault
QuestionText; {{ }} references or an = formulaApprove order {{input.orderId}}?
Details for the approversLabel = value, such as Amount = {{input.total}}. Shown as a short list in the Approval Center and in the email; the full data is one click away.Rows of name and value—
Approver accountsUsernames; may come from the data, such as {{input.managerAccount}}.A list—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

𝑥Set Local Variable

Palettes → Flow control · activity type setVar

Sets variables local to this Sutra run, under a record ID: every Set Local Variable step with ID 1 adds to record 1, another ID makes another record, so many values stay in one structure ({ "1": { … }, "2": { … } }). Later steps read them as {vars.1.name}, or with Get Local Variables (everything, or one ID). They survive a durable restart and are never shared with other runs. Passes its input through; what it set is in its log, shown on the Output tab.

In scope
  • Local variables for later steps in this run, read as {vars.name}. They are kept while the run waits, and when another engine takes the run over.
Out of scope
  • Values kept between runs: use an administrator-managed Project property, a Memory table or a database.

When to use it

  • Counters, a running total, a value chosen in one branch and used in another.

Procedure

  1. General offers Variable storage: choose declared/plain storage to update a Sutra variable (for example test), or record-by-ID storage for grouped values. Select a known name or enter a custom name, then its value on General; Input edits the same configuration and supports mapping.
  2. Give a Record ID (new steps start with 1): every step with the same ID adds to one record, another ID makes another, so all values of a run sit in one structure: { "1": { "name": "Jane Doe", "role": "admin" }, "2": { "who": "jane.doe@example.com" } }. An ID may come from the data, for example {{input.orderId}}, for one record per order in a For-Each.
  3. Add a row per variable: name and value.
  4. Read them later as {vars.1.name} in any formula, or with Get Local Variables: everything, or one ID.
  5. Without a Record ID (steps made before 2.1.3) the variables are plain: {vars.name}.

Output

  • The input, unchanged, so the steps after it still have the earlier data. What it set is written to its log, one line per variable (1.batch = batch-0930), shown on its Output tab under Log after a test.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Record IDThe record these variables belong to, for example 1, 2 or {input.orderId}. Steps with the same ID add to one record; read one as {vars.1.name}. Empty: plain variables, {vars.name}.Text; {{gv.X}}, {{ev.X}} or an = formula1

Input tab

SettingWhat it doesValuesDefault
VariablesRows of name and valuetotal

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

𝑥Get Local Variables

Palettes → Flow control · activity type getVar

Returns every local variable of this run as one structure ({ "1": { … }, "2": { … } } with the records Set Local Variable made), or one record by its ID, or one plain variable by name, with the id of the run they belong to. Local variables belong only to this Sutra run: runs at the same time never see each other's.

In scope
  • A snapshot of every Local variable and its latest value, or one named Local variable.
Out of scope

When to use it

  • Passing all calculated run values to a later mapping, child Sutra or response; checking whether one Local variable exists.

Procedure

  1. General shows declared names and initial values. For one variable, choose its literal name (for example test), not its value or a reference that resolves to its value. Output shows name/value pairs from this Get activity’s own completed result.
  2. Choose all variables (the whole structure of records), one ID (one record, for example 1) or one variable (a plain variable by name).
  3. For one ID or variable, give it and connect missing when absence is expected.

Output

  • All: variables (for example { "1": { … }, "2": { … } }) and count. One: name, value and found. Both carry runId, the id of the run the variables belong to: each run has its own, so runs at the same time never share them.

Outputs (ports)

out missing error

Settings reference

General tab

SettingWhat it doesValuesDefault
Getall variables, one ID, one variableall variables

Input tab

SettingWhat it doesValuesDefault
Record ID or name when Get is one ID or one variableThe record ID given in Set Local Variable (1, 2, {input.orderId}), or the name of a plain variable.Text; {{ }} references or an = formula1

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⚙Get Properties

Palettes → Flow control · activity type getProperties

Reads administrator-managed Project or Engine properties. Project secret properties are never returned. Sutras cannot change either scope.

In scope
  • Administrator-managed Project properties for this project, or Engine properties shared by every project.
  • Every property or one named property. Project secret properties are never returned.
Out of scope
  • Changing properties: only an administrator changes Project configuration/deployment config or Admin Console → Server → Runtime.
  • Run calculations: use Set Local Variable and Get Local Variables.

When to use it

  • Reading environment configuration as data, such as region, feature switches or public limits.

Procedure

  1. Choose Project or Engine.
  2. Choose every property or one named property.
  3. Connect missing when a named property is optional.

Output

  • All: scope, properties and count. One: scope, name, value and found.

Outputs (ports)

out missing error

Settings reference

General tab

SettingWhat it doesValuesDefault
Property scopeProject, EngineProject
Getall properties, one propertyall properties

Input tab

SettingWhat it doesValuesDefault
Property name when Get is one propertyText; {{ }} references or an = formula—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

!Throw error

Palettes → Flow control · activity type throw

Fails this branch with a message. Connect its error output to handle it, or the run fails.

In scope
  • Failing a branch with your own message.
Out of scope
  • Ending the whole Sutra at once: use End with Sutra: error.

When to use it

  • A business rule is broken and an error handler upstream should deal with it.

Procedure

  1. Write the message, for example Order {{input.orderId}} is not valid.
  2. Connect the error output of a step before it, or let the run fail.

Outputs (ports)

error

Settings reference

Input tab

SettingWhat it doesValuesDefault
Error messageText; {{ }} references or an = formulaOrder {{input.orderId}} is not valid

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

■End

Palettes → Flow control · activity type end

Ends a branch and records its result. Can also stop the whole Sutra at once, as succeeded or failed, cancelling the other branches.

In scope
  • Ending a branch and recording its result.
  • Stopping the whole Sutra at once, as succeeded or failed: other branches still running or waiting are cancelled.
Out of scope

When to use it

  • this branch: the normal end of a path.
  • Sutra: success: the work is done and nothing else should run, for example after a duplicate is detected.
  • Sutra: error: stop everything and mark the run failed, for example on an error output when no recovery is possible.

When to choose another activity

  • Fail a branch so an error handler can catch it → use Throw error.

Procedure

  1. Choose what ends: this branch, Sutra: success or Sutra: error.
  2. For Sutra: error, write the error message; it appears as the run's error in Runs and in the log.
  3. Connect it after the last step, or to an error output.

Output

  • The result, recorded as the run's output.

Outputs (ports)

Settings reference

General tab

SettingWhat it doesValuesDefault
EndsSutra: success / error stops every other branch now and sets the run status.this branch, Sutra: success, Sutra: errorthis branch

Input tab

SettingWhat it doesValuesDefault
ResultText; {{ }} references or an = formula{{input}}
Error message when Ends is Sutra: errorText; {{ }} references or an = formulaOrder {{input.orderId}} could not be processed

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⤷Call Sutra

Palettes → Flow control · activity type callProcess

Runs another Sutra of this project with the input you give it and, when Wait is on, continues with its result (set by its Return activity). Build a piece of logic once and call it from many Sutras.

In scope
  • Running another Sutra of the same project with an input you set or map, and continuing with its result.
  • Waiting for the result, or starting it and continuing at once.
  • The draft while testing, the deployed version when deployed.
Out of scope
  • Sutras of other projects.
  • More than 10 levels of Sutras calling Sutras.

When to use it

  • Logic used by several Sutras: customer lookup, address cleaning, sending a standard alert.
  • Breaking a large Sutra into readable parts.

When to choose another activity

Procedure

  1. Build the called Sutra: a Manual start (with a payload schema) and a Return at the end.
  2. In the calling Sutra, add Call Sutra and choose the Sutra.
  3. Set the input as a value, or choose mapping and map it to the payload schema in the Input tab.
  4. Optionally pick a result schema, so later steps see the result's fields.
  5. Connect the error output: a failure inside the called Sutra arrives there.

Output

  • With Wait on: the called Sutra's Return result. With Wait off: runId, process, started.
Guidelines
  • A called run appears in Runs as its own run with source sutra.
  • Deploy the called Sutra before the calling one, or deployed calls fail with "not deployed".

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
SutraThe called Sutra starts at its trigger (usually Manual start) with this input.Text; {{gv.X}}, {{ev.X}} or an = formula—
VersionTest runs call the draft, so you can change both Sutras together; deployed runs call the deployed version.deployed (draft while testing), deployed, draftdeployed (draft while testing)
Wait for the resultOff: start it and continue at once (fire and forget).On or offOn
Input fromvalue, mappingvalue
Input contract from the called SutraOn: the input is mapped to the payload schema of the called Sutra's Manual start (JSON Schema or XSD) for the version above, and the designer says when that Sutra changes it. Off: this step's own Input schema.On or offOff
Input schemaThis step's own description of the input, used when the input contract is Off; descriptive unless strict input validation is On.A shared schema—
Strict input validationOn or offOff
Result schemaOptional. Describes the result for mapping in later steps.A shared schema—
Strict result validationRequires Wait for result and a selected result contract.On or offOff

Input tab

SettingWhat it doesValuesDefault
Input when Input from is valueText; {{ }} references or an = formula{{input}}
Input when Input from is mappingMapped in the Input tab—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

↩Return

Palettes → Flow control · activity type return

Ends the Sutra and hands its result to the Sutra that called it (Call Sutra). Other branches stop. Also the run's result in Runs and for the Run API.

In scope
  • Ending the Sutra with a result, set as a value or mapped to a schema; other branches stop.
Out of scope

When to use it

  • The end of a Sutra that other Sutras call with Call Sutra.

When to choose another activity

  • End without a result, or stop as failed → use End.

Procedure

  1. Choose value (for example {{input}}) or mapping with a result schema.

Output

  • The result, returned to the calling Sutra and stored as the run's result.

Outputs (ports)

Settings reference

General tab

SettingWhat it doesValuesDefault
Result fromvalue, mappingvalue
Result schemaA shared schema—
Strict result validationOn or offOff

Input tab

SettingWhat it doesValuesDefault
Result when Result from is valueText; {{ }} references or an = formula{{input}}
Result when Result from is mappingMapped in the Input tab—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⚠Error handler

Palettes → Flow control · activity type catch

Runs when any activity fails and its own error output is not connected. Other branches stop; the handler's path decides how the run ends (End with process: error to mark it failed). One per process.

In scope
  • One error handler per Sutra, started by the engine when an activity fails and its own error output is not connected.
  • The error (message, activity name and type, time) and the failed activity's input.
Out of scope
  • Errors already handled by a connected error output.
  • Errors inside the handler's own path: those fail the run.

When to use it

  • A common way to log, alert and clean up for every activity of a Sutra, instead of wiring each error output.

When to choose another activity

  • Handle one activity's error differently → use Throw error.

Procedure

  1. Drag Error handler onto the canvas. It has no input connection.
  2. Connect its output to the steps to run on an error, for example Log and Send email.
  3. End the path with End: Sutra: error marks the run failed; otherwise the run counts as handled and ends as done.

Output

  • error (message, step, type, at) and input, the failed activity's input.
Guidelines
  • When the handler starts, the Sutra's other branches stop.

Outputs (ports)

out

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

○No operation

Palettes → Flow control · activity type noop

Does nothing and passes its input on. A placeholder while you design, or a joining point for connections.

In scope
  • Passing the input on unchanged.
Out of scope
  • Waiting for branches: use Merge.

When to use it

  • A placeholder for an activity you have not chosen yet; a point where several connections meet.

Procedure

  1. Drag it in and connect it.

Output

  • The input, unchanged.

Outputs (ports)

out error

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

Files

🗀File trigger

Palettes → Files · activity type fileTrigger · trigger

Starts the Sutra when a file in a folder is added, modified or removed (polling while the Sutra is deployed). Can read the file as text or as structured rows.

In scope
  • A folder with a wildcard pattern (*.csv, orders-*.xml), optionally with sub-folders.
  • Added, modified and removed events, each its own output.
  • Reading the file: text, CSV rows or lines typed by a schema, JSON, XML or base64, in the chosen encoding.
Out of scope

When to use it

  • Processing files dropped by another system or by people.

When to choose another activity

Procedure

  1. Enter the folder, for example {{gv.INBOX}}, and the pattern.
  2. Tick the events you need; each becomes an output.
  3. Set stable for seconds so files still being copied are not read early.
  4. Choose how to read the content. For CSV, pick a row schema to get typed, repeating rows.
  5. Move or delete the file at the end with Move / copy / delete file, so it is not picked up again after a restart.

Output

  • event and the file details (name, path, relativePath, folder, extension, size, modifiedAt), plus the content fields of the chosen format.

Outputs (ports)

added modified removed

Settings reference

General tab

SettingWhat it doesValuesDefault
FolderAbsolute path; may use {{gv.INBOX}}.Text; {{gv.X}}, {{ev.X}} or an = formulaC:/sutra/inbox
File name patternWildcards * and ?; several separated by commas.Text; {{gv.X}}, {{ev.X}} or an = formula*.csv
EventsA list, ,
Include sub-foldersOn or offOff
Check every (seconds)A number; may be a formula or variable10
Wait until unchanged for (seconds)Avoids reading files that are still being written.A number; may be a formula or variable2
Read content asCSV rows and lines give a repeating list to map; JSON and XML give data.do not read, text, CSV rows, lines, JSON, XML, base64 (binary)do not read
File encoding when Read content as is text or CSV rows or lines or JSON or XMLutf-8, utf-8 with BOM, utf-16le, iso-8859-1, windows-1252, ascii, shift_jis, gb18030, big5, euc-krutf-8
Column separator when Read content as is CSV rows,, ;, |, tab,
First row has column names when Read content as is CSV rowsOn or offOn
Skip rows at the start when Read content as is CSV rows or linesA number; may be a formula or variable0
Trim spaces around values when Read content as is CSV rowsOn or offOn
Decimal separator when Read content as is CSV rowsUse , for European files such as 12,5.., ,.
Strict schema validation when Read content as is JSON or XMLJSON/XML only. Check to validate each file against the selected JSON Schema or XSD. Unchecked: the schema only describes fields for mapping.On or offOff
Row / data schema when Read content as is CSV rows or JSON or XMLCSV: column names and types. JSON/XML: describes the data for mapping; required when Strict schema validation is checked. Choose JSON Schema for JSON or XSD for XML.A shared schema—
Test event (JSON)Code or JSON{ "event": "added", "path": "C:/sutra/inbox/orders.csv", "name":…

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⎘Read file

Palettes → Files · activity type fileRead

Reads a file as text, as CSV rows or lines (a repeating list to map), as JSON or XML data, or as base64 bytes. Big CSV and line files can be streamed in batches.

In scope
  • One file, in any of the supported encodings.
  • Content as text, CSV rows (typed by a row schema), lines, JSON, XML or base64.
  • Decimal comma, skipped rows, trimmed values.
Out of scope
  • Files larger than the size limit (10 MB by default).

When to use it

  • Reading a known file during a Sutra.

When to choose another activity

Procedure

  1. Set the folder (for example {{gv.INBOX}}) and the file.
  2. Choose the format and the encoding.
  3. For CSV, pick a row schema: the rows become a repeating, typed structure for For-Each mapping.

Output

  • The file details (name, path, folder, extension, size, modifiedAt) and the content: text, rows, lines, data or base64, with count.

Outputs (ports)

out error The outputs follow your settings; shown here with the defaults.

Settings reference

General tab

SettingWhat it doesValuesDefault
FolderMay use {{gv.INBOX}}.Text; {{gv.X}}, {{ev.X}} or an = formulaC:/sutra/inbox
Read content asCSV rows and lines give a repeating list to map; JSON and XML give data.text, CSV rows, lines, JSON, XML, base64 (binary)text
File encoding when Read content as is text or CSV rows or lines or JSON or XMLutf-8, utf-8 with BOM, utf-16le, iso-8859-1, windows-1252, ascii, shift_jis, gb18030, big5, euc-krutf-8
Column separator when Read content as is CSV rows,, ;, |, tab,
First row has column names when Read content as is CSV rowsOn or offOn
Skip rows at the start when Read content as is CSV rows or linesA number; may be a formula or variable0
Trim spaces around values when Read content as is CSV rowsOn or offOn
Decimal separator when Read content as is CSV rowsUse , for European files such as 12,5.., ,.
Strict schema validation when Read content as is JSON or XMLJSON/XML only. Check to validate each file against the selected JSON Schema or XSD. Unchecked: the schema only describes fields for mapping.On or offOff
Row / data schema when Read content as is CSV rows or JSON or XMLCSV: column names and types. JSON/XML: describes the data for mapping; required when Strict schema validation is checked. Choose JSON Schema for JSON or XSD for XML.A shared schema—
Stream in batches when Read content as is CSV rows or linesFor big files: reads the file piece by piece and sends its rows in batches on the batch port while reading goes on, so only one batch is in memory. out gives the totals when the whole file is read. CSV rows and lines only; the size limit does not apply.On or offOff
Rows per batch when Stream in batches is onLarger batches mean fewer steps per file; smaller ones less memory per step.A number; may be a formula or variable1000
Maximum size (MB)Files read whole are held in memory. For bigger CSV or line files, stream them in batches.A number; may be a formula or variable50

Input tab

SettingWhat it doesValuesDefault
File (relative to the folder)Text; {{ }} references or an = formula{{input.name}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

☷List / read directory

Palettes → Files · activity type fileList

Lists files matching a location such as C:\in\*.csv (or a folder plus pattern), optionally reading each one. Gives a repeating list of files; no match goes to empty.

In scope
  • Listing files with wildcards, for example C:\in\*.csv or =concat({gv.DIR}, '\*.csv').
  • Sub-folders, sorting, a maximum count.
  • Optionally reading each file with the same formats as Read file.
Out of scope

When to use it

  • A nightly batch over every file in a folder.

Procedure

  1. Set the location with a pattern, or a folder and a separate pattern.
  2. Choose the sort order and the maximum.
  3. Choose do not read for names only, or a format to read each file.
  4. Connect empty for when nothing matches.

Output

  • files (repeating: file details and content), count, folder.

Outputs (ports)

out empty error The outputs follow your settings; shown here with the defaults.

Settings reference

General tab

SettingWhat it doesValuesDefault
LocationFolder with an optional wildcard, e.g. =concat({gv.INBOX}, '\*.csv').Text; {{gv.X}}, {{ev.X}} or an = formulaC:/sutra/inbox/*.csv
Pattern (when the location is a folder)Text; {{gv.X}}, {{ev.X}} or an = formula*
Include sub-foldersOn or offOff
Ordername, oldest first, newest first, largest firstname
Maximum filesA number; may be a formula or variable1000
Read content asCSV rows and lines give a repeating list to map; JSON and XML give data.do not read, text, CSV rows, lines, JSON, XML, base64 (binary)do not read
File encoding when Read content as is text or CSV rows or lines or JSON or XMLutf-8, utf-8 with BOM, utf-16le, iso-8859-1, windows-1252, ascii, shift_jis, gb18030, big5, euc-krutf-8
Column separator when Read content as is CSV rows,, ;, |, tab,
First row has column names when Read content as is CSV rowsOn or offOn
Skip rows at the start when Read content as is CSV rows or linesA number; may be a formula or variable0
Trim spaces around values when Read content as is CSV rowsOn or offOn
Decimal separator when Read content as is CSV rowsUse , for European files such as 12,5.., ,.
Strict schema validation when Read content as is JSON or XMLJSON/XML only. Check to validate each file against the selected JSON Schema or XSD. Unchecked: the schema only describes fields for mapping.On or offOff
Row / data schema when Read content as is CSV rows or JSON or XMLCSV: column names and types. JSON/XML: describes the data for mapping; required when Strict schema validation is checked. Choose JSON Schema for JSON or XSD for XML.A shared schema—
Stream in batches when Read content as is CSV rows or linesFor big files: reads the file piece by piece and sends its rows in batches on the batch port while reading goes on, so only one batch is in memory. out gives the totals when the whole file is read. CSV rows and lines only; the size limit does not apply.On or offOff
Rows per batch when Stream in batches is onLarger batches mean fewer steps per file; smaller ones less memory per step.A number; may be a formula or variable1000

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⎙Write file

Palettes → Files · activity type fileWrite

Writes text, CSV built from rows, lines, JSON or XML in the chosen encoding; appends or overwrites; creates folders as needed.

In scope
  • Text, CSV built from rows, lines, JSON, XML or base64 (binary).
  • Append (on a new line or not) or overwrite; folders are created as needed.
  • The encoding and line ending.
Out of scope
  • Writing outside the folder: paths are kept inside it.

When to use it

  • Reports, exports and files for other systems.

Procedure

  1. Set the folder and the file name, for example =concat('report-', current-timestamp('YYYYMMDD'), '.csv').
  2. Choose the format and fill in the content, rows or data.
  3. Tick Append to add to the end, or leave it off and choose whether to overwrite.

Output

  • Always the written file's details, whatever the format or schema: name, path, relativePath, folder, extension, size, modifiedAt, plus action (created, overwritten or appended), format, encoding, bytesWritten and rowsWritten.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
FolderMay use {{gv.OUTBOX}}.Text; {{gv.X}}, {{ev.X}} or an = formulaC:/sutra/outbox
Write content astext, CSV from rows, lines from rows, JSON, XML, base64 (binary)text
Root element when Write content as is XMLText; {{gv.X}}, {{ev.X}} or an = formularoot
Column separator when Write content as is CSV from rows,, ;, |, tab,
Write a header row when Write content as is CSV from rowsOn or offOn
Row / data schema when Write content as is CSV from rows or JSON or XMLOptional: CSV column order; JSON Schema or XSD validates structured content before writing.A shared schema—
File encoding when Write content as is text or CSV from rows or lines from rows or JSON or XMLutf-8, utf-8 with BOM, utf-16le, iso-8859-1, asciiutf-8
Line ending when Write content as is CSV from rows or lines from rowsLF, CRLFLF
Append to the end of the fileAdds the content after what is already there (creates the file if missing).On or offOff
Start appended content on a new line when Append to the end of the file is onOn or offOn
Overwrite if it already exists when Append to the end of the file is offUnticked: the step fails when the file exists (and Append is off).On or offOn

Input tab

SettingWhat it doesValuesDefault
File (relative to the folder)Text; {{ }} references or an = formula=concat('report-', current-timestamp('YYYYMMDD'), '.csv')
Content when Write content as is text or base64 (binary)Text; {{ }} references or an = formula{{input.text}}
Rows when Write content as is CSV from rows or lines from rowsA list of objects (CSV columns = their fields) or of text lines.Text; {{ }} references or an = formula{{input.rows}}
Data when Write content as is JSON or XMLText; {{ }} references or an = formula{{input}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⇢Move / copy / delete file

Palettes → Files · activity type fileMove

Moves, copies or deletes a file inside the folder.

In scope
  • Moving, copying or deleting one file inside the folder.
Out of scope

When to use it

  • Moving a processed file to done/ or error/.

Procedure

  1. Set the folder and the action.
  2. Set the file and, for move and copy, the target.

Output

  • Always the file's details (for delete, from before it was removed), plus action, from and to.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
FolderMay use {{gv.INBOX}}.Text; {{gv.X}}, {{ev.X}} or an = formulaC:/sutra/inbox
Actionmove, copy, deletemove
Overwrite the target if it exists when Action is move or copyOn or offOn

Input tab

SettingWhat it doesValuesDefault
FileText; {{ }} references or an = formula{{input.name}}
To when Action is move or copyText; {{ }} references or an = formula=concat('done/', {input.name})

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

SFTP / FTP

⇣Remote file trigger

Palettes → SFTP / FTP · activity type remoteTrigger · trigger

Starts the Sutra for each new file in a folder on an SFTP or FTP server (polling while deployed). After a successful run the file is deleted, moved, or left and remembered.

In scope
  • A folder on an SFTP or FTP server, checked every few seconds for files matching a pattern.
  • Only files whose size stopped changing, so uploads still running are not read early.
  • After a successful run: move the file to a folder, delete it, or leave it and remember it.
  • Reading the file as text, CSV rows, lines, JSON, XML or base64.
Out of scope
  • Servers that push events: the trigger polls.
  • Local folders: use File trigger.

When to use it

  • Files a partner, bank or supplier drops on their server or yours.

When to choose another activity

Procedure

  1. Pick the protocol and the SFTP or FTP connection.
  2. Enter the folder (inside the connection's base folder) and the pattern, for example *.csv.
  3. Choose what happens after the run. Move to a folder keeps a copy; Leave and remember never touches the partner's files.
  4. Choose how to read the content, then deploy.

Output

  • The file details (name, path, relativePath, size, modifiedAt, server) and the content fields of the chosen format.

Outputs (ports)

out

Settings reference

General tab

SettingWhat it doesValuesDefault
ProtocolSFTP, FTPSFTP
SFTP connection when Protocol is SFTPA SFTP server from Resources—
FTP connection when Protocol is FTPA FTP server from Resources—
Folder (relative to the base folder)May use {{gv.REMOTE_INBOX}}.Text; {{gv.X}}, {{ev.X}} or an = formulainbox
File name patternWildcards * and ?; several separated by commas.Text; {{gv.X}}, {{ev.X}} or an = formula*.csv
Check every (seconds)A number; may be a formula or variable60
After a successful runmove to a folder, delete, leave and remembermove to a folder
Move to folder when After a successful run is move to a folderRelative to the base folder; created when missing.Text; {{gv.X}}, {{ev.X}} or an = formulainbox/done
Read content asCSV rows and lines give a repeating list to map; JSON and XML give data.do not read, text, CSV rows, lines, JSON, XML, base64 (binary)do not read
File encoding when Read content as is text or CSV rows or lines or JSON or XMLutf-8, utf-8 with BOM, utf-16le, iso-8859-1, windows-1252, ascii, shift_jis, gb18030, big5, euc-krutf-8
Column separator when Read content as is CSV rows,, ;, |, tab,
First row has column names when Read content as is CSV rowsOn or offOn
Skip rows at the start when Read content as is CSV rows or linesA number; may be a formula or variable0
Trim spaces around values when Read content as is CSV rowsOn or offOn
Decimal separator when Read content as is CSV rowsUse , for European files such as 12,5.., ,.
Strict schema validation when Read content as is JSON or XMLJSON/XML only. Check to validate each file against the selected JSON Schema or XSD. Unchecked: the schema only describes fields for mapping.On or offOff
Row / data schema when Read content as is CSV rows or JSON or XMLCSV: column names and types. JSON/XML: describes the data for mapping; required when Strict schema validation is checked. Choose JSON Schema for JSON or XSD for XML.A shared schema—
Maximum size to read (MB)A number; may be a formula or variable50
Test event (JSON)Code or JSON{ "name": "orders.csv", "path": "/data/inbox/orders.csv", "relat…

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

☰List remote files

Palettes → SFTP / FTP · activity type remoteList

Lists files in a folder on an SFTP or FTP server, optionally reading each one. Gives a repeating list of files; no match goes to empty.

In scope
  • Files of a remote folder matching a pattern, optionally with sub-folders, sorted by name, age or size.
  • Optionally reading each file as rows, lines or text.
Out of scope

When to use it

  • Picking up every file waiting on a server at a set time, with a Timer and a For each.

Procedure

  1. Pick the connection, enter the folder and the pattern.
  2. Choose the order and the maximum number of files.
  3. Connect empty for no files.

Output

  • files (repeating, with their content when read) and count.

Outputs (ports)

out empty error

Settings reference

General tab

SettingWhat it doesValuesDefault
ProtocolSFTP, FTPSFTP
SFTP connection when Protocol is SFTPA SFTP server from Resources—
FTP connection when Protocol is FTPA FTP server from Resources—
File name patternText; {{gv.X}}, {{ev.X}} or an = formula*
Include sub-foldersOn or offOff
Ordername, oldest first, newest first, largest firstname
Maximum filesA number; may be a formula or variable1000
Read content asCSV rows and lines give a repeating list to map; JSON and XML give data.do not read, text, CSV rows, lines, JSON, XML, base64 (binary)do not read
File encoding when Read content as is text or CSV rows or lines or JSON or XMLutf-8, utf-8 with BOM, utf-16le, iso-8859-1, windows-1252, ascii, shift_jis, gb18030, big5, euc-krutf-8
Column separator when Read content as is CSV rows,, ;, |, tab,
First row has column names when Read content as is CSV rowsOn or offOn
Skip rows at the start when Read content as is CSV rows or linesA number; may be a formula or variable0
Trim spaces around values when Read content as is CSV rowsOn or offOn
Decimal separator when Read content as is CSV rowsUse , for European files such as 12,5.., ,.
Strict schema validation when Read content as is JSON or XMLJSON/XML only. Check to validate each file against the selected JSON Schema or XSD. Unchecked: the schema only describes fields for mapping.On or offOff
Row / data schema when Read content as is CSV rows or JSON or XMLCSV: column names and types. JSON/XML: describes the data for mapping; required when Strict schema validation is checked. Choose JSON Schema for JSON or XSD for XML.A shared schema—

Input tab

SettingWhat it doesValuesDefault
Folder (relative to the base folder)Text; {{ }} references or an = formulainbox

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⇩Read remote file

Palettes → SFTP / FTP · activity type remoteRead

Reads a file from an SFTP or FTP server as text, CSV rows, lines, JSON, XML or base64 bytes. Big CSV and line files can be streamed in batches.

In scope
  • One file on an SFTP or FTP server, read as text, CSV rows, lines, JSON, XML or base64.
  • A size limit, so a wrong file cannot fill the memory.
  • Stream in batches for big CSV and line files: the rows come out on the batch output, one batch in memory at a time, and out gives the totals.
Out of scope
  • Paths outside the connection's base folder: they are refused.

When to use it

  • Reading a price list or a statement that has a known name.

Procedure

  1. Pick the connection and enter the file, for example inbox/{{input.name}}.
  2. Choose the format; for CSV, the delimiter and header.

Output

  • The file details and the content fields of the chosen format (text, rows and count, json, ...).

Outputs (ports)

out error The outputs follow your settings; shown here with the defaults.

Settings reference

General tab

SettingWhat it doesValuesDefault
ProtocolSFTP, FTPSFTP
SFTP connection when Protocol is SFTPA SFTP server from Resources—
FTP connection when Protocol is FTPA FTP server from Resources—
Read content asCSV rows and lines give a repeating list to map; JSON and XML give data.text, CSV rows, lines, JSON, XML, base64 (binary)text
File encoding when Read content as is text or CSV rows or lines or JSON or XMLutf-8, utf-8 with BOM, utf-16le, iso-8859-1, windows-1252, ascii, shift_jis, gb18030, big5, euc-krutf-8
Column separator when Read content as is CSV rows,, ;, |, tab,
First row has column names when Read content as is CSV rowsOn or offOn
Skip rows at the start when Read content as is CSV rows or linesA number; may be a formula or variable0
Trim spaces around values when Read content as is CSV rowsOn or offOn
Decimal separator when Read content as is CSV rowsUse , for European files such as 12,5.., ,.
Strict schema validation when Read content as is JSON or XMLJSON/XML only. Check to validate each file against the selected JSON Schema or XSD. Unchecked: the schema only describes fields for mapping.On or offOff
Row / data schema when Read content as is CSV rows or JSON or XMLCSV: column names and types. JSON/XML: describes the data for mapping; required when Strict schema validation is checked. Choose JSON Schema for JSON or XSD for XML.A shared schema—
Stream in batches when Read content as is CSV rows or linesFor big files: reads the file piece by piece and sends its rows in batches on the batch port while reading goes on, so only one batch is in memory. out gives the totals when the whole file is read. CSV rows and lines only; the size limit does not apply.On or offOff
Rows per batch when Stream in batches is onLarger batches mean fewer steps per file; smaller ones less memory per step.A number; may be a formula or variable1000
Maximum size (MB)Files read whole are held in memory. For bigger CSV or line files, stream them in batches.A number; may be a formula or variable50

Input tab

SettingWhat it doesValuesDefault
File (relative to the base folder)Text; {{ }} references or an = formulainbox/{{input.name}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⇧Write remote file

Palettes → SFTP / FTP · activity type remoteWrite

Writes text, CSV built from rows, lines, JSON, XML or bytes to a file on an SFTP or FTP server; appends or overwrites; creates folders as needed.

In scope
  • Text, CSV built from rows, lines, JSON, XML or base64 written to a remote file.
  • Append, overwrite, or fail when the file exists; folders are made as needed.
Out of scope
  • Partial uploads that resume: a failed upload is written again whole.

When to use it

  • Sending a daily report or an invoice file to a partner's server.

Procedure

  1. Pick the connection and enter the file path, for example =concat('outbox/report-', current-timestamp('YYYYMMDD'), '.csv').
  2. Choose the format and fill in the content or the rows.
  3. Choose append or overwrite.

Output

  • The file details and action: created, overwritten or appended.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
ProtocolSFTP, FTPSFTP
SFTP connection when Protocol is SFTPA SFTP server from Resources—
FTP connection when Protocol is FTPA FTP server from Resources—
Write content astext, CSV from rows, lines from rows, JSON, XML, base64 (binary)text
Root element when Write content as is XMLText; {{gv.X}}, {{ev.X}} or an = formularoot
Column separator when Write content as is CSV from rows,, ;, |, tab,
Write a header row when Write content as is CSV from rowsOn or offOn
Row / data schema when Write content as is CSV from rows or JSON or XMLOptional: CSV column order; JSON Schema or XSD validates structured content before writing.A shared schema—
File encoding when Write content as is text or CSV from rows or lines from rows or JSON or XMLutf-8, utf-8 with BOM, utf-16le, iso-8859-1, asciiutf-8
Line ending when Write content as is CSV from rows or lines from rowsLF, CRLFLF
Append to the end of the fileAdds the content after what is already there (creates the file if missing).On or offOff
Start appended content on a new line when Append to the end of the file is onOn or offOn
Overwrite if it already exists when Append to the end of the file is offUnticked: the step fails when the file exists (and Append is off).On or offOn

Input tab

SettingWhat it doesValuesDefault
File (relative to the base folder)Text; {{ }} references or an = formula=concat('outbox/report-', current-timestamp('YYYYMMDD'), '.csv')
Content when Write content as is text or base64 (binary)Text; {{ }} references or an = formula{{input.text}}
Rows when Write content as is CSV from rows or lines from rowsA list of objects (CSV columns = their fields) or of text lines.Text; {{ }} references or an = formula{{input.rows}}
Data when Write content as is JSON or XMLText; {{ }} references or an = formula{{input}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⇄Move / copy / delete remote file

Palettes → SFTP / FTP · activity type remoteMove

Moves (renames), copies or deletes a file on an SFTP or FTP server, inside the base folder.

In scope
  • Move (rename), copy or delete one remote file.
  • Overwriting the target or failing when it exists.
Out of scope

When to use it

  • Archiving a processed file under a dated name.

Procedure

  1. Pick the connection and the action.
  2. Enter the file and, for move and copy, where it goes.

Output

  • action, from and to.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
ProtocolSFTP, FTPSFTP
SFTP connection when Protocol is SFTPA SFTP server from Resources—
FTP connection when Protocol is FTPA FTP server from Resources—
Actionmove, copy, deletemove
Overwrite the target if it exists when Action is move or copyOn or offOn

Input tab

SettingWhat it doesValuesDefault
FileText; {{ }} references or an = formulainbox/{{input.name}}
To when Action is move or copyText; {{ }} references or an = formula=concat('inbox/done/', {input.name})

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

DB Ops

⛁SQL query

Palettes → DB Ops · activity type dbQuery

Runs a SELECT and returns the rows. No rows goes to the empty output.

In scope
  • A SELECT on PostgreSQL, MySQL/MariaDB, SQL Server, Oracle or SQLite.
  • Run data written in the SQL ({{input.id}}) and named parameters :name: both always bound, never pasted into the SQL.
  • A maximum row count.
Out of scope

When to use it

  • Looking up a customer, reading pending orders.

Procedure

  1. Pick the database connection.
  2. Write the SQL. Project and Engine properties name what differs per server (FROM {{gv.SALES_SCHEMA}}.orders); run data may be written in too (WHERE id = '{{input.orderId}}') and is sent as a bound parameter, never as SQL text.
  3. Or use :name in the SQL and add exactly one parameter row with the same case-sensitive name and its value. The designer and Deploy show missing, differently capitalised, duplicate and unnamed rows as errors; an extra unused row is a warning.
  4. Choose Test query (10 rows) to run a read-only preview through the selected connection with the latest sample input. The preview adds its own database-side ten-row cap; it never changes or limits the deployed SQL.
  5. Connect empty for no rows.

Output

  • rows (repeating), count, first.

Outputs (ports)

out empty error

Settings reference

General tab

SettingWhat it doesValuesDefault
Database connectionA Database (DB Ops) from Resources—
SQLProject and Engine properties ({{gv.X}}, {{ev.X}}) are written into the SQL: names and clauses. Run data such as {{input.id}} is always sent as a bound parameter, the same as a :name parameter.Code or JSONSELECT id, customer, amount FROM orders WHERE id = :id
Maximum rowsA number; may be a formula or variable10000

Input tab

SettingWhat it doesValuesDefault
ParametersValues for :name placeholders in the SQL. Always sent as bound parameters.Rows of name and valueid

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⛃SQL update

Palettes → DB Ops · activity type dbUpdate

Runs INSERT, UPDATE, DELETE or MERGE and returns the number of affected rows (and RETURNING rows where supported).

In scope
  • INSERT, UPDATE, DELETE or MERGE with bound parameters.
  • An expected row count that fails the step when not met.
Out of scope

When to use it

  • Saving a status, inserting an audit row.

Procedure

  1. Pick the connection, write the statement and add exactly one parameter row for every :name. The designer and Deploy show a missing, differently capitalised, duplicate or unnamed row as an error; an extra unused row is a warning.
  2. Optionally set the expected count, for example exactly 1.

Output

  • affected and, where the database returns them, generated keys.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Database connectionA Database (DB Ops) from Resources—
SQLProject and Engine properties ({{gv.X}}, {{ev.X}}) are written into the SQL: names and clauses. Run data such as {{input.id}} is always sent as a bound parameter, the same as a :name parameter.Code or JSONUPDATE orders SET status = :status WHERE id = :id
Fail when no row is affectedOn or offOff

Input tab

SettingWhat it doesValuesDefault
ParametersValues for :name placeholders.Rows of name and valueid, status

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⚙Call procedure

Palettes → DB Ops · activity type dbProcedure

Calls a stored procedure with named parameters (in order for PostgreSQL, MySQL and Oracle).

In scope
  • Calling a stored procedure with named parameters.
Out of scope
  • OUT parameters on every database: check your driver.

When to use it

  • Business logic that already lives in the database.

Procedure

  1. Pick the connection, enter the procedure name and its parameters in the order the procedure declares them.
  2. PostgreSQL output parameters (INOUT): give them the value =null; their values come back as the first row of rows.

Output

  • rows of the first result set and the driver's result.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Database connectionA Database (DB Ops) from Resources—
Procedure nameText; {{gv.X}}, {{ev.X}} or an = formulaprocess_order

Input tab

SettingWhat it doesValuesDefault
Parameters (in order)Rows of name and valuep_order_id

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⛭SQL script

Palettes → DB Ops · activity type dbScript

Runs an install or change script: CREATE DATABASE, CREATE TABLE, CREATE PROCEDURE, seed rows. Statements are separated by a line with only ";" and run one after another, not in one transaction: most databases keep table and procedure changes at once.

In scope
  • An install or change script: CREATE DATABASE, CREATE TABLE, CREATE PROCEDURE, seed rows.
  • Statements separated by a line with only ;, run one after another, so procedure bodies may hold their own semicolons.
  • Stopping at the first failure, or running the rest and listing the failures.
Out of scope
  • All-or-nothing changes to data: use SQL transaction. Most databases keep table and procedure changes at once anyway.

When to use it

  • Setting up the tables and procedures a Sutra needs, on a new server or in a test.

Procedure

  1. Pick the connection.
  2. Write the script; put a line with only ; between statements. Add exactly one parameter row for every :name; design and deployment checks show a missing, differently capitalised, duplicate or unnamed row as an error and an extra unused row as a warning across the whole script.
  3. Use IF NOT EXISTS and DROP ... IF EXISTS so the script can run again.
  4. Choose what happens when a statement fails.

Output

  • results (one per statement, with ok and error), ran and failed.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Database connectionA Database (DB Ops) from Resources—
ScriptProject and Engine properties ({{gv.X}}, {{ev.X}}) are written into the script: database and object names. Run data such as {{input.id}} is always sent as a bound parameter, the same as a :name parameter.Code or JSONCREATE TABLE IF NOT EXISTS customers ( id VARCHAR(20) PRIMARY KEY, …
When a statement failsStop: the step fails at that statement (those before it stay done). Continue: runs the rest and lists the failures.stop, continuestop

Input tab

SettingWhat it doesValuesDefault
ParametersValues for :name placeholders in any statement. Always sent as bound parameters.Rows of name and value—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⛬SQL transaction

Palettes → DB Ops · activity type dbTransaction

Runs several statements in one transaction: all succeed or none are kept. Statements are separated by a line with only ";".

In scope
  • Several statements in one transaction: all succeed or none.
Out of scope
  • Transactions that span steps.

When to use it

  • Order header and lines, transfers between tables.

Procedure

  1. Write the statements, separated by semicolons, with :name parameters.
  2. Add exactly one parameter row for every case-sensitive name. The designer and Deploy show a missing, differently capitalised, duplicate or unnamed row as an error and an extra unused row as a warning across all statements.

Output

  • One result per statement.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Database connectionA Database (DB Ops) from Resources—
StatementsProject and Engine properties ({{gv.X}}, {{ev.X}}) are written into the SQL: names and clauses. Run data such as {{input.id}} is always sent as a bound parameter, the same as a :name parameter.Code or JSONINSERT INTO audit(order_id, action) VALUES (:id, 'ship') ; UPDATE orde…

Input tab

SettingWhat it doesValuesDefault
ParametersValues for :name placeholders in the SQL. Always sent as bound parameters.Rows of name and valueid

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

MongoDB

{}List MongoDB collections

Palettes → MongoDB · activity type mongoListCollections

Lists authorized collection names and types in the selected application database. No documents or collection definitions are returned.

In scope
  • Lists the collections of the database that the connection user may see, with their type, optionally filtered.
Out of scope
  • Reading documents, or creating and dropping collections.
  • More than 1,000 collections: use a filter to narrow the list.

When to use it

  • Finding the collection names before a document step, or running the same work over several collections.

Procedure

  1. Choose the MongoDB connection.
  2. Optionally add a filter, for example {"name":"orders"}.
  3. Map collections[].name to Collection from input of a later step; a value given there wins over the collection set in General.

Output

  • collections: the name and type of each collection, sorted by name; count: how many. An empty list is not an error.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
MongoDB connectionA MongoDB from Resources—
Collection metadata schemaA shared schema (json)—
Strict schema validationOn requires the selected contract and validates the documented subject without coercion.On or offOff

Input tab

SettingWhat it doesValuesDefault
Filter (JSON / Extended JSON)Structured query operators are supported. No JavaScript or shell expressions.Text; {{ }} references or an = formula{}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

{}Insert MongoDB documents

Palettes → MongoDB · activity type mongoInsert

Inserts one or several documents. Strict mode validates every input document before any write. Ordered/unordered server failures can still leave partial writes.

In scope
  • Adds one document, or a list of up to 1,000, to a collection.
  • The connection always checks the TLS certificate; the write is confirmed by most of the database servers before the step ends.
Out of scope
  • All-or-nothing inserts: if the server fails part way through a list, the documents written so far stay written.
  • Getting round the validation rules set on the collection in MongoDB.

When to use it

  • Saving mapped records as documents in a collection.

Procedure

  1. Choose the MongoDB connection and the collection.
  2. Map a document or a list of documents into Documents. Write ids, large numbers, decimals, dates and binary data in Extended JSON, such as {"$date":"2026-11-08T10:00:00Z"}.
  3. Choose Ordered: on stops at the first document the server refuses; off tries the rest and still reports the failure.
  4. To check the documents, choose a schema and turn on Strict schema validation: every document is checked before any is written.

Output

  • acknowledged, the number inserted and the inserted ids (in Extended JSON).
Guidelines
  • Give documents a business key (such as the order number) as their id, so that trying a failed insert again cannot add a second copy.
  • The M0 sample marks its document with the run id and deletes only that document.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
MongoDB connectionA MongoDB from Resources—
CollectionText; {{gv.X}}, {{ev.X}} or an = formuladocuments
Stop batch on first server errorOn or offOn
Input document schemaA shared schema (json)—
Strict schema validationOn requires the selected contract and validates the documented subject without coercion.On or offOff

Input tab

SettingWhat it doesValuesDefault
Collection from input (optional override)Map an incoming collection name here. A supplied value overrides Collection; blank/unmapped uses the General setting.Text; {{ }} references or an = formula—
Document or document listText; {{ }} references or an = formula{{input}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

{}Find MongoDB documents

Palettes → MongoDB · activity type mongoFind

Finds one/many documents, counts matches or returns distinct values. Strict mode validates each returned document/value, not the result envelope. BSON is preserved as canonical Extended JSON.

In scope
  • Finds many documents, finds one, counts, or lists the distinct values of a field.
  • With a filter, the fields to return, a sort order, skip and a limit.
Out of scope
  • JavaScript on the database server.
  • A total count beside an ordinary find: use a Count step for that.

When to use it

  • Looking up a document, paging through matches, or counting them.

Procedure

  1. Choose the connection, the collection and the operation.
  2. Set the filter and, where they apply, the fields to return, the sort order, skip and limit, or the field for distinct values.
  3. A result may hold up to 10,000 documents or 8 MB; a query that would return more fails instead of returning part of it. Page with skip and limit, and set a limit (0 means no limit of its own).
  4. With Strict validation on, each document or value returned is checked against the schema; the schema is checked even when nothing matches.

Output

  • Find: documents and count. Count: count. Distinct: values and count.
  • Numbers, ids and dates come in Extended JSON, such as {"$numberInt":"25"}; choose a schema written for that form, or map them to plain values. Finding nothing is not an error.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
MongoDB connectionA MongoDB from Resources—
CollectionText; {{gv.X}}, {{ev.X}} or an = formuladocuments
Operationfind, findOne, count, distinctfind
SkipA number; may be a formula or variable0
Runtime limit (0 = no query limit)A number; may be a formula or variable0
Distinct field when Operation is distinctText; {{gv.X}}, {{ev.X}} or an = formula—
Returned document/value schemaA shared schema (json)—
Strict schema validationOn requires the selected contract and validates the documented subject without coercion.On or offOff

Input tab

SettingWhat it doesValuesDefault
Collection from input (optional override)Map an incoming collection name here. A supplied value overrides Collection; blank/unmapped uses the General setting.Text; {{ }} references or an = formula—
Filter (JSON / Extended JSON)Structured query operators are supported. No JavaScript or shell expressions.Text; {{ }} references or an = formula{}
ProjectionText; {{ }} references or an = formula{}
SortText; {{ }} references or an = formula{}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

{}Update MongoDB documents

Palettes → MongoDB · activity type mongoUpdate

Updates one/many matches or replaces one document. Strict mode applies to the update/replacement request. Modifier validation is not a guarantee about the final stored document; collection validators remain authoritative.

In scope
  • Updates one or many documents, replaces one, or finds one and updates it; upsert adds the document when none matches.
  • Array filters pick elements inside arrays for an update.
Out of scope
  • Checking the whole stored document: a schema check sees only the change (such as $set), not the result.
  • Transactions across several steps.

When to use it

  • Changing some fields, replacing a document, or adding it when it does not exist yet.

Procedure

  1. Choose update one or update many with operators such as $set, or replace one with a whole document.
  2. Map the filter. Updating many with an empty filter would change every document, so it needs Allow empty filter.
  3. Turn on Upsert only when a missing document should be added.
  4. With Strict validation on, the change or the replacement is checked against the schema. Rules for the stored document belong in MongoDB as collection validation.

Output

  • acknowledged, matchedCount, modifiedCount, upsertedCount and the upserted id. A document that matched but already had the values counts as matched, not modified.
  • Find one and update returns document (or null) and hasDocument, as it was Before or After the change. An upsert with Before returns null, as there was nothing before. Array filters cannot be used with a replacement.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
MongoDB connectionA MongoDB from Resources—
CollectionText; {{gv.X}}, {{ev.X}} or an = formuladocuments
OperationupdateOne, updateMany, replaceOne, findOneAndUpdateupdateOne
Returned document when Operation is findOneAndUpdateafter, beforeafter
Insert when not foundOn or offOff
Allow empty filter for updateManyOn or offOff
Update request / replacement schemaA shared schema (json)—
Strict schema validationOn requires the selected contract and validates the documented subject without coercion.On or offOff

Input tab

SettingWhat it doesValuesDefault
Collection from input (optional override)Map an incoming collection name here. A supplied value overrides Collection; blank/unmapped uses the General setting.Text; {{ }} references or an = formula—
Filter (JSON / Extended JSON)Structured query operators are supported. No JavaScript or shell expressions.Text; {{ }} references or an = formula{}
Update operators or replacementText; {{ }} references or an = formula{{input}}
Array filters (optional JSON array)Text; {{ }} references or an = formula[]

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

{}Delete MongoDB documents

Palettes → MongoDB · activity type mongoDelete

Deletes one or many matching documents. Deleting all documents requires explicit opt-in. Strict mode validates the filter request before deletion.

In scope
  • Deletes one document, or every document that matches the filter.
Out of scope
  • Dropping a collection or a database.
  • Deleting every document by accident: an empty filter with Delete all matches needs its own setting.

When to use it

  • Deleting one known document, or a chosen group.

Procedure

  1. Choose the connection and the collection.
  2. Map the filter; keep Delete all matches off to delete only one document.
  3. Deleting all matches with an empty filter (the whole collection) also needs Allow empty filter.
  4. With Strict validation on, the filter is checked against the schema before anything is deleted.

Output

  • acknowledged and deletedCount; 0 when nothing matched.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
MongoDB connectionA MongoDB from Resources—
CollectionText; {{gv.X}}, {{ev.X}} or an = formuladocuments
Delete all matchesOn or offOff
Allow empty filter for delete-manyOn or offOff
Filter request schemaA shared schema (json)—
Strict schema validationOn requires the selected contract and validates the documented subject without coercion.On or offOff

Input tab

SettingWhat it doesValuesDefault
Collection from input (optional override)Map an incoming collection name here. A supplied value overrides Collection; blank/unmapped uses the General setting.Text; {{ }} references or an = formula—
Filter (JSON / Extended JSON)Structured query operators are supported. No JavaScript or shell expressions.Text; {{ }} references or an = formula{}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

{}Bulk write MongoDB documents

Palettes → MongoDB · activity type mongoBulkWrite

Sends many inserts, updates, replacements and deletes to one collection in a single request (the MongoDB bulkWrite command). Ordered stops at the first failing operation; unordered tries every operation. Any failed operation fails the step with the counts and the first errors, so a partial write is never reported as success.

In scope
  • Many inserts, updates, replacements and deletes on one collection in a single request (the MongoDB bulkWrite command), tested on Atlas M0.
  • Ordered (stop at the first failing operation) or unordered (try every operation).
  • The same guards as the single activities: update operators for updates, plain documents for replacements, no server-side JavaScript, and an explicit opt-in for an empty updateMany/deleteMany filter.
Out of scope
  • Not a transaction: operations written before a failure stay written. Use a transaction where all-or-nothing is required.
  • At most 1000 operations per step; split bigger batches (a For each loop, or batches from Read file).

When to use it

  • Apply a batch of changes from a file, an API or a queue in one round trip.
  • Upsert many records by key, or archive and delete in one request.

Procedure

  1. Choose the connection and collection.
  2. Map Operations to an array such as [{"insertOne":{"document":{...}}}, {"updateOne":{"filter":{"_id":"A-1"},"update":{"$set":{"status":"done"}},"upsert":true}}, {"deleteOne":{"filter":{"_id":"A-0"}}}]. A mapping or a formula can build it from incoming data.
  3. Keep Ordered on when later operations depend on earlier ones; turn it off to let independent operations go ahead past a failure.
  4. Strict validation, when on, checks every inserted and replacement document against the schema before anything is sent.

Output

  • acknowledged, operations, insertedCount, matchedCount, modifiedCount, deletedCount, upsertedCount, insertedIds and upsertedIds (by operation position).
  • A failure fails the step with the counts already written and the first operation errors, so a partial write is never shown as success.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
MongoDB connectionA MongoDB from Resources—
CollectionText; {{gv.X}}, {{ev.X}} or an = formuladocuments
Ordered (stop at the first failing operation)On or offOn
Allow empty filter for updateMany/deleteManyOn or offOff
Inserted/replacement document schemaA shared schema (json)—
Strict schema validationOn requires the selected contract and validates the documented subject without coercion.On or offOff

Input tab

SettingWhat it doesValuesDefault
Collection from input (optional override)Map an incoming collection name here. A supplied value overrides Collection; blank/unmapped uses the General setting.Text; {{ }} references or an = formula—
Operations (JSON array)An array of 1 to 1000 operations, each one of: insertOne {document}, updateOne/updateMany {filter, update with $ operators, upsert?, arrayFilters?}, replaceOne {filter, replacement, upsert?}, deleteOne/deleteMany {filter}. Build it from data with a mapping, or with a formula such as =list(object("insertOne", object("document", {input}))).Text; {{ }} references or an = formula[{"insertOne":{"document":{"_id":"A-1","status":"new"}}},{"updateOne":…

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

{}Aggregate MongoDB documents

Palettes → MongoDB · activity type mongoAggregate

Queries the selected MongoDB collection through ordered stages to filter, reshape or group documents and calculate totals. It does not aggregate the preceding activity output automatically. Read-only by default; strict mode validates each returned result document.

In scope
  • Runs an aggregation pipeline on a collection: filter, reshape, group and total documents in the database.
  • Only reads by default. On Atlas M0 a pipeline may have up to 50 stages and no disk use.
  • On other MongoDB servers, disk use and output stages can be allowed in Settings, if the server and the database user permit them.
Out of scope
  • JavaScript on the database server and map-reduce.
  • Output stages ($out, $merge) and disk use on Atlas M0. Elsewhere, an output stage writes to another collection and can return no documents.

When to use it

  • Totals and counts by group, reports, and reshaping documents before they leave the database.

Procedure

  1. Choose the connection and the collection. The pipeline reads that collection, not the output of the step before.
  2. In Input, select Pipeline and give a JSON list of stages, for example [{"$match":{"status":"processed"}},{"$project":{"name":1,"amount":1}}]. Each item is a stage, not a record.
  3. For values from the run, write the pipeline as a formula: =list(object('$match', object('_id', {run.id}))). In a pipeline, $amount is a field of the documents; {input.amount} is a value of the run.
  4. Add a $match and a $limit so the result stays within 10,000 documents or 8 MB. An empty list [] returns the whole collection.
  5. To map the fields of the result, choose a schema for the result rows: after $group or $project they have a different shape from the collection.

Output

  • documents: the result rows, in Extended JSON; count: the number of rows returned (after grouping). An empty result is not an error.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
MongoDB connectionA MongoDB from Resources—
CollectionText; {{gv.X}}, {{ev.X}} or an = formuladocuments
Allow disk useRequires General MongoDB connection capabilities and server support; disabled for the M0 baseline.On or offOff
Allow output stages ($merge / $out)Explicit write opt-in on General MongoDB only. Output stages can modify data and may return no documents; a zero result count is not a zero-write guarantee.On or offOff
Result document schemaA shared schema (json)—
Strict schema validationOn requires the selected contract and validates the documented subject without coercion.On or offOff

Input tab

SettingWhat it doesValuesDefault
Collection from input (optional override)Map an incoming collection name here. A supplied value overrides Collection; blank/unmapped uses the General setting.Text; {{ }} references or an = formula—
Pipeline (JSON array)An ordered array of stage objects, not data records. Example: [{"$match":{"status":"processed"}},{"$project":{"name":1,"amount":1}}]. For this run only: =list(object('$match', object('_id', {sutra.id}))). $amount means a MongoDB field; {input.amount} is a SutraFlow parameter inside a formula. [] reads all collection documents within output limits. Output is documents plus count; collection fields are not auto-discovered.Text; {{ }} references or an = formula[]

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

Memory tables

⚡Get Memory Record

Palettes → Memory tables · activity type memGet

Gets one cached record by its configured key. When enabled, a missing record is fetched with the table's lookup query and cached; otherwise it follows missing.

In scope
  • One row of a memory table by its key, from memory: no database round trip.
  • A row not in memory is fetched with the table's lookup query (when it has one) and kept.
Out of scope

When to use it

  • Currency rates, product codes and their names, routing rules, a customer's credit limit looked up on every order.

Procedure

  1. Pick the memory table (a Memory table resource).
  2. Map the key, such as {{input.currency}}; for a key of several fields join the values with |.
  3. Connect found and missing.

Output

  • row, found, key.
Guidelines
  • In a mapping or a setting, =memory-lookup('Rates', {input.currency}, 'rate') reads the same row from memory without a step.

Outputs (ports)

found missing error

Settings reference

General tab

SettingWhat it doesValuesDefault
Memory tableA Memory table from Resources—
Fetch a missing row with the lookup queryOn or offOn

Input tab

SettingWhat it doesValuesDefault
KeyFor a key of several fields, the values joined with |, such as {{input.country}}|{{input.city}}.Text; {{ }} references or an = formula{{input.customerId}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⚡Set Memory

Palettes → Memory tables · activity type memPut

Adds or replaces one or more cached records by the table key. It changes the Memory table, not its Oracle, SQL Server, MySQL, PostgreSQL or SQLite source table. A durable copy reaches the other engines.

In scope
  • Adds or replaces one cached record, or a list of records, in a memory table.
  • With a copy in the database (failsafe), the cache change is saved there too and reaches every engine within a second. It never updates the external source table.
Out of scope
  • Saving business data: write it to your database with SQL update; a memory table is a fast copy of reference values.

When to use it

  • Keeping the latest rate received from an API; caching a token or a looked-up value for a while (Keep for).

Procedure

  1. Pick the memory table.
  2. Map the row (it must have the key fields), or a list of rows.
  3. Optionally a key, and how long to keep the row.

Output

  • count, keys, added, updated.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Memory tableA Memory table from Resources—
Keep for (seconds)0 = the time to live of the table.A number; may be a formula or variable0

Input tab

SettingWhat it doesValuesDefault
Row (or list of rows)An object with the key fields of the table, or a list of such objects.Text; {{ }} references or an = formula{{input}}
KeyEmpty = from the key fields of the row.Text; {{ }} references or an = formula—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⚡Delete Memory Records

Palettes → Memory tables · activity type memDelete

Deletes cached records by one key, a list of keys, matching fields and a condition, or every record. It never deletes records from the source database.

In scope
  • Removes one cached record, a list of keys, records matching fields and a condition, or every record of a memory table.
Out of scope

When to use it

  • Dropping a value that is no longer valid, such as a withdrawn product code.

Procedure

  1. Pick the memory table.
  2. Choose one key, a list of keys, matching records or every record; matching mode accepts equal fields, a condition and a safety limit.

Output

  • deleted, count and the keys removed.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Memory tableA Memory table from Resources—
Deleteone key, list of keys, matching records, every recordone key
Condition when Delete is matching recordsOptional, per record: ={row.amount} > 100.Text; {{gv.X}}, {{ev.X}} or an = formula—
Maximum records when Delete is list of keys or matching recordsSafety limit for one execution.A number; may be a formula or variable1000

Input tab

SettingWhat it doesValuesDefault
Key when Delete is one key or one rowText; {{ }} references or an = formula{{input.customerId}}
Keys when Delete is list of keysA list—
Fields equal to when Delete is matching recordsRows of name and value—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⚡Query Memory Records

Palettes → Memory tables · activity type memQuery

Queries records already cached in a Memory table using equal fields and an optional per-record condition. It does not query the source database.

In scope
  • Finds rows of a memory table: fields equal to values, and an optional condition per row such as ={row.rate} > 1.
  • Reads memory only.
Out of scope
  • Queries over big data: run them in the database with SQL query.

When to use it

  • All active codes of a country; the rates above a threshold.

Procedure

  1. Pick the memory table.
  2. Add fields and values to match, and or a condition on {row.field}.
  3. Connect empty for no match.

Output

  • rows (repeating) and count.

Outputs (ports)

out empty error

Settings reference

General tab

SettingWhat it doesValuesDefault
Memory tableA Memory table from Resources—
ConditionOptional, per row: ={row.amount} > 100.Text; {{gv.X}}, {{ev.X}} or an = formula—
Maximum rowsA number; may be a formula or variable1000

Input tab

SettingWhat it doesValuesDefault
Fields equal toField name and value, such as city = {{input.city}}.Rows of name and value—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⚡Refresh Memory Table

Palettes → Memory tables · activity type memReload

Executes the configured source query and atomically replaces the cached table after the rows and limits validate. The previous successful table remains available if refresh fails.

In scope
  • Loads a memory table again from its load query on this engine, and gives its figures.
Out of scope
  • Every engine at once: Reload in the Admin Console (Memory tables) or sutra memory reload.

When to use it

  • After a Sutra changed the source table, so lookups see the new values at once.

Procedure

  1. Pick the memory table.

Output

  • rows, bytes, hits, misses, loadedAt.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Memory tableA Memory table from Resources—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

Service Bus

⇪Publish message

Palettes → Service Bus · activity type busPublish

Sends a message to a queue or topic (ActiveMQ/AMQP 1.0, RabbitMQ) or a Kafka topic with JMS-style headers and custom properties, and waits for the broker to confirm.

In scope
  • ActiveMQ and other AMQP 1.0 brokers, RabbitMQ, Kafka.
  • Queue or topic; JMS headers: delivery mode, priority, time to live, message id, correlation id, reply-to, type.
  • Custom properties (headers) and Kafka keys.
Out of scope
  • Waiting for a reply on a reply queue.

When to use it

  • Handing work to another system, publishing events.

When to choose another activity

Procedure

  1. Choose the broker and its connection.
  2. Choose queue or topic and the destination, for example {{gv.ORDER_QUEUE}}.
  3. Choose JSON, XML, text, map or bytes. XML is text (build it with Render XML) and is sent exactly as it is. A map must be an object, and bytes must be base64.
  4. Set delivery mode (persistent for work that must not be lost) and any headers and properties.

Output

  • destination, messageId and the broker's confirmation.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Brokeramqp1 = ActiveMQ Classic/Artemis, Azure Service Bus, Qpid.amqp1, rabbitmq, kafkaamqp1
AMQP 1.0 connection when Broker is amqp1A ActiveMQ / AMQP 1.0 from Resources—
RabbitMQ connection when Broker is rabbitmqA RabbitMQ (AMQP 0-9-1) from Resources—
Kafka connection when Broker is kafkaA Kafka from Resources—
Destination type when Broker is amqp1 or rabbitmqqueue, topicqueue
Message typeXML = serialized XML text (use Render XML); JSON = any JSON value; map = an object of fields (JMS MapMessage style); bytes = base64 content. XML is sent as application/xml.JSON, XML, text, map, bytesJSON
Delivery modepersistent, non-persistentpersistent
Priority (0-9)A number; may be a formula or variable4
Time to live (ms, 0 = forever)A number; may be a formula or variable0
Broker acknowledgement (Kafka) when Broker is kafkaall, leader, noneall

Input tab

SettingWhat it doesValuesDefault
Queue / topic nameMappable, or a project variable such as {{gv.ORDERS_QUEUE}}.Text; {{ }} references or an = formula{{gv.ORDERS_QUEUE}}
Exchange (RabbitMQ) when Broker is rabbitmqEmpty: queue = default exchange; topic = amq.topic.Text; {{ }} references or an = formula—
Message bodyCode or JSON{{input}}
Message idEmpty = a new id.Text; {{ }} references or an = formula—
Correlation idText; {{ }} references or an = formula—
Reply toText; {{ }} references or an = formula—
Type (JMSType / subject)Text; {{ }} references or an = formula—
Message key (Kafka) when Broker is kafkaSame key = same partition, so order is kept.Text; {{ }} references or an = formula{{input.orderId}}
Custom propertiesRows of name and valuesource

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⇩Queue / topic trigger

Palettes → Service Bus · activity type busSubscribe · trigger

Subscribes to Kafka, RabbitMQ or ActiveMQ and starts the Sutra for each queue or topic message while deployed. Gives the body, JMS headers and custom properties. Acknowledge automatically, after the Sutra succeeds, or with a Confirm message activity.

In scope
  • Starts a run for each message from a queue or topic on Kafka, RabbitMQ or ActiveMQ / AMQP 1.0, with message selectors, durable subscriptions and Kafka consumer groups.
  • Acknowledgement: auto (on receipt), client (after the run succeeds) or explicit (Confirm message).
  • In a cluster, one engine (the leader) listens. With client or explicit acknowledgement, a message is still recognised when another engine takes over.
  • When a run fails: requeue the message, or reject it after a number of deliveries so the broker moves it to a dead-letter queue. Several messages can run at once.
Out of scope
  • Making calls to other systems happen exactly once: make them safe to repeat. SutraFlow recognises a repeated Kafka message by its offset, and a RabbitMQ or AMQP message by its message id or the Duplicate key you choose.
  • Fixing messages in the wrong format: choose JSON, XML, text, map or bytes to match what the sender sends. A message that does not match fails at the trigger and follows the failure settings, except with auto acknowledgement, where it is already gone. XML stays text; check it with Parse XML and an XSD.

When to use it

  • Processing work from a queue, reacting to events.

Procedure

  1. Choose the broker, connection and destination.
  2. Choose the acknowledgement mode: client suits most Sutras; explicit when one step marks the point after which the message is safe; auto only when losing a message does not matter.
  3. Leave Avoid duplicate runs on; for RabbitMQ or AMQP, make the publisher assign a unique message id, or set Duplicate key (for example {{body.orderId}}).
  4. Choose requeue or reject for failed runs, set a limit on deliveries, and set up a dead-letter queue on the broker.
  5. Choose how many messages run at once.
  6. Write a test message so you can test without a broker.
  7. Deploy; the leader engine listens while the Sutra stays deployed and started.

Output

  • body, headers (JMS headers), properties, destination, redelivered.

Outputs (ports)

out

Settings reference

General tab

SettingWhat it doesValuesDefault
Brokeramqp1 = ActiveMQ Classic/Artemis, Azure Service Bus, Qpid.amqp1, rabbitmq, kafkaamqp1
AMQP 1.0 connection when Broker is amqp1A ActiveMQ / AMQP 1.0 from Resources—
RabbitMQ connection when Broker is rabbitmqA RabbitMQ (AMQP 0-9-1) from Resources—
Kafka connection when Broker is kafkaA Kafka from Resources—
Destination type when Broker is amqp1 or rabbitmqqueue, topicqueue
Queue / topic nameMay use project variables.Text; {{gv.X}}, {{ev.X}} or an = formula{{gv.ORDERS_QUEUE}}
Message selector when Broker is amqp1JMS selector, e.g. type = 'order' AND priority > 4 (AMQP 1.0 brokers that support it).Text; {{gv.X}}, {{ev.X}} or an = formula—
Durable subscription name when Destination type is topicTopics: keeps messages while the Sutra is not running.Text; {{gv.X}}, {{ev.X}} or an = formula—
Consumer group (Kafka) when Broker is kafkaText; {{gv.X}}, {{ev.X}} or an = formulasutraflow-orders
Read from the beginning (new group) when Broker is kafkaOn or offOff
Create the queue if missing (durable) when Broker is rabbitmqOn or offOff
Message typeXML is preserved as exact text in body; use Parse XML next for structured fields and XSD validation. bodyText retains received text. Invalid JSON/XML/map bodies fail the trigger step and follow the configured acknowledgement/failure policy.JSON, XML, text, map, bytesJSON
Acknowledgeauto: on receipt. client: when the Sutra succeeds. explicit: with a Confirm message activity in the Sutra.auto, client, explicitclient
Avoid duplicate runsOn remembers each message by the Kafka topic/partition/offset, or the RabbitMQ / AMQP message id, so a message delivered again (after a leader change or a reconnect) never starts a second run. While the first run is still going, the copy is held unacknowledged and settled when that run ends.on, offon
Duplicate key when Avoid duplicate runs is onFor messages without a message id (many RabbitMQ publishers send none): a value that is unique per message, for example {{body.orderId}} or {{headers.correlationId}}. Empty = message id only.Text; {{gv.X}}, {{ev.X}} or an = formula—
Messages without an id when Avoid duplicate runs is onA message with no message id and no Duplicate key cannot be recognised if it is delivered again. Process runs it anyway (no duplicate protection). Reject sends it to the dead-letter queue of the broker (client and explicit acknowledgement). Kafka messages always have an identity.process, reject (dead-letter)process
When the Sutra fails when Acknowledge is client or explicitrequeue, reject (dead-letter)requeue
Reject after this many deliveries (0 = never) when Acknowledge is client or explicitA number; may be a formula or variable0
Messages in parallelRabbitMQ prefetch / AMQP credit / Kafka partitions at once.A number; may be a formula or variable1
Test message (JSON)Code or JSON{ "body": { "orderId": "A-1001" }, "headers": { "messageId": "m-1"…

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

✓Confirm message

Palettes → Service Bus · activity type busConfirm

Acknowledges the message that started this run (Queue / topic trigger with Acknowledge: explicit), or rejects / requeues it.

In scope
  • Acknowledging, rejecting or requeuing the message that started the run, at the point you choose.
Out of scope

When to use it

  • Acknowledging only after the step that must not be lost, such as saving an order or sending the reply; sending a message back or to the dead-letter queue on purpose.

Procedure

  1. Set the subscriber's acknowledgement mode to explicit.
  2. Place Confirm message after the last operation that must finish before the broker may remove the message.
  3. Choose confirm, requeue or reject (dead-letter). Put one on every path that ends the run; a run that ends without one is treated as failed.
  4. Do not confirm early when a later failure must cause redelivery.

Output

  • The input, unchanged.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Actionconfirm removes or commits the delivery; requeue asks for another delivery; reject does not return it to the source. Configure a broker dead-letter route if rejected messages must be retained.confirm, requeue, reject (dead-letter)confirm

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

Email

✉Send email

Palettes → Email · activity type emailSend

Sends an email over SMTP with text and/or HTML (for example from an HTML template step) and attachments.

In scope
  • SMTP with TLS; text and HTML; cc, bcc, reply-to; attachments from earlier steps.
Out of scope
  • Bulk mailing lists.

When to use it

  • Alerts, reports, confirmations.

Procedure

  1. Pick the SMTP connection.
  2. Fill in from, to, subject and the text or HTML (an HTML template can build it).
  3. Add attachments as name and content rows.

Output

  • messageId and the accepted recipients.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
SMTP connectionA Email (SMTP) from Resources—

Input tab

SettingWhat it doesValuesDefault
FromEmpty = the connection's default.Text; {{ }} references or an = formula—
ToComma separated, or a list.Text; {{ }} references or an = formula{{input.email}}
CcText; {{ }} references or an = formula—
BccText; {{ }} references or an = formula—
Reply-ToText; {{ }} references or an = formula—
SubjectText; {{ }} references or an = formula=concat('Order ', {input.orderId}, ' confirmed')
Text bodyText; {{ }} references or an = formulaHello {{input.name}}, Thank you for your order.
HTML bodyFor example {{nodes.Email body.html}} from an HTML template step.Text; {{ }} references or an = formula—
AttachmentsA list of { filename, content (text or base64), encoding: "base64", contentType }.Text; {{ }} references or an = formula—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

📥Email trigger

Palettes → Email · activity type emailTrigger · trigger

Starts the Sutra for each new email in an IMAP mailbox (polling while deployed). Marks it read or moves it after the Sutra succeeds.

In scope
  • IMAP mailbox polling with sender and subject filters.
  • Marking read or moving the message after success; attachments as base64.
Out of scope
  • Push notification of new mail.

When to use it

  • Orders and invoices that arrive by email.

Procedure

  1. Pick the IMAP connection and the mailbox.
  2. Set filters and the poll interval.
  3. Choose where to move processed mail.

Output

  • from, to, subject, text, html, date, attachments.

Outputs (ports)

out

Settings reference

General tab

SettingWhat it doesValuesDefault
IMAP connectionA Email (IMAP) from Resources—
MailboxText; {{gv.X}}, {{ev.X}} or an = formulaINBOX
Only from (contains)Text; {{gv.X}}, {{ev.X}} or an = formula—
Only subject containingText; {{gv.X}}, {{ev.X}} or an = formula—
Check every (seconds)A number; may be a formula or variable60
After the Sutra succeedsmark read, move, leavemark read
Move to mailbox when After the Sutra succeeds is moveText; {{gv.X}}, {{ev.X}} or an = formulaProcessed
Include attachmentsno, base64base64
Test email (JSON)Code or JSON{ "from": "customer@example.com", "subject": "Order A-1001", "te…

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

Firebase

🔥Firestore

Palettes → Firebase · activity type firestore

Reads and writes Firestore documents: get, set (merge or replace), add with a new id, query, delete.

In scope
  • Get, set (with merge), add, query (where, order, limit) and delete documents.
Out of scope
  • Listening for changes.

When to use it

  • Using Firestore as the Sutra's database.

Procedure

  1. Pick the Firebase connection.
  2. Choose the operation, collection and document id.
  3. Fill in the data or the query.

Output

  • The document or documents; notFound for a missing document.

Outputs (ports)

out notFound error

Settings reference

General tab

SettingWhat it doesValuesDefault
Firebase connectionA Firebase from Resources—
Operationget, set, add, query, deleteget
Merge with the existing document when Operation is setOn or offOn
Order by when Operation is queryText; {{gv.X}}, {{ev.X}} or an = formula—
Limit when Operation is queryA number; may be a formula or variable100

Input tab

SettingWhat it doesValuesDefault
CollectionText; {{ }} references or an = formulaorders
Document id when Operation is get or set or deleteText; {{ }} references or an = formula{{input.orderId}}
Data when Operation is set or addCode or JSON{{input}}
Where (field, op, value) when Operation is queryKey is "field op" with op one of = != < <= > >= array-contains in.Rows of name and valuestatus =

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⟳Realtime Database

Palettes → Firebase · activity type firebaseRtdb

Reads, writes, updates, pushes to or deletes a path in the Firebase Realtime Database.

In scope
  • Get, set, update, push and delete at a path.
Out of scope
  • Listening for changes.

When to use it

  • Live status for apps.

Procedure

  1. Pick the connection, the operation and the path; fill in the data.

Output

  • The value at the path, or the new key for push.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Firebase connectionA Firebase from Resources—
Operationget, set, update, push, deleteget

Input tab

SettingWhat it doesValuesDefault
PathText; {{ }} references or an = formulaorders/{{input.orderId}}
Data when Operation is set or update or pushCode or JSON{{input}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

🔔Push notification (FCM)

Palettes → Firebase · activity type firebaseNotify

Sends a push notification with Firebase Cloud Messaging to a device token, a topic or a condition.

In scope
  • Push notifications to a device token, a topic or a condition, with data and a link.
Out of scope
  • Delivery reports.

When to use it

  • Telling app users about an order or an approval.

Procedure

  1. Pick the connection and the target.
  2. Write the title, body and optional data.

Output

  • The message name returned by Firebase.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Firebase connectionA Firebase from Resources—
Send totoken, topic, conditiontoken

Input tab

SettingWhat it doesValuesDefault
Device token / topic / conditionText; {{ }} references or an = formula{{input.deviceToken}}
TitleText; {{ }} references or an = formula=concat('Order ', {input.orderId}, ' shipped')
TextText; {{ }} references or an = formulaYour order is on the way.
Image URLText; {{ }} references or an = formula—
Data (key/value)Rows of name and valueorderId
Open URL on click (web)Text; {{ }} references or an = formula—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

Apps and social (Google, YouTube, Twitch, Discord, Telegram, Dropbox, Facebook)

⇋Connected API call

Palettes → Apps and social (Google, YouTube, Twitch, Discord, Telegram, Dropbox, Facebook) · activity type oauthRequest

Calls any REST API of a connected account (Google, Microsoft Graph, Dropbox, Facebook Graph, or a custom OAuth service) with its access token.

In scope
  • Any REST API of a connected OAuth account; the token is added and refreshed for you.
Out of scope

When to use it

  • An API of Google, Dropbox or Facebook that has no activity of its own.

Procedure

  1. Pick the OAuth connection (Project → Resources, then Connect account).
  2. Set the method, URL (relative to the API base), query and body.

Output

  • status and body.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Account (OAuth connection)A OAuth connection (Google, YouTube, Twitch, Dropbox, Facebook) from Resources—
MethodGET, POST, PUT, PATCH, DELETEGET

Input tab

SettingWhat it doesValuesDefault
URL or pathText; {{ }} references or an = formulahttps://www.googleapis.com/oauth2/v3/userinfo
QueryRows of name and value—
JSON body when Method is POST or PUT or PATCHCode or JSON—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

▦Google Sheets

Palettes → Apps and social (Google, YouTube, Twitch, Discord, Telegram, Dropbox, Facebook) · activity type googleSheets

Reads a range, appends rows, updates a range or clears it. Rows can be objects (first row is the header) or lists.

In scope
  • Reading a range as rows, appending rows, updating and clearing a range.
Out of scope
  • Formatting and charts.

When to use it

  • Spreadsheets as a simple shared table.

Procedure

  1. Pick the Google connection, the spreadsheet id and the range.
  2. For reading, choose whether the first row is a header.
  3. For appending, set the rows.

Output

  • rows and count, or the update result.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Account (OAuth connection)Scope https://www.googleapis.com/auth/spreadsheetsA OAuth connection (Google, YouTube, Twitch, Dropbox, Facebook) from Resources—
Operationread, append, update, clearread
First row is a headerOn or offOn
Values are when Operation is append or updateUSER_ENTERED, RAWUSER_ENTERED

Input tab

SettingWhat it doesValuesDefault
Spreadsheet idFrom the sheet URL: /spreadsheets/d/<id>/editText; {{ }} references or an = formula—
RangeText; {{ }} references or an = formulaSheet1!A1:F
Rows when Operation is append or updateText; {{ }} references or an = formula{{input.items}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

△Google Drive / Docs

Palettes → Apps and social (Google, YouTube, Twitch, Discord, Telegram, Dropbox, Facebook) · activity type googleDrive

Lists, uploads, downloads files, and exports Google Docs/Sheets as text, PDF, CSV or Word.

In scope
  • List, read (with Google Docs exported as text, PDF and other formats), upload, update, append and delete files.
  • Big files both ways without holding them in memory: download with Save to: server file, upload with Upload from: server file (a resumable upload).
  • Big CSV and text files (and Sheets exported as CSV) read without saving them: Save to: rows in batches reads the file as it downloads and sends its rows on the batch output, one batch in memory at a time.
  • Wait for each call (5 minutes by default) for slow links; streamed transfers run until the time limit of the step, 30 minutes by default.
Out of scope
  • Sharing permissions.

When to use it

  • Reading documents people keep in Drive; saving reports to Drive.

Procedure

  1. Pick the Google connection and the operation.
  2. Fill in the folder or file id and the content.

Output

  • The file details and, when read, its content.

Outputs (ports)

out error The outputs follow your settings; shown here with the defaults.

Settings reference

General tab

SettingWhat it doesValuesDefault
Account (OAuth connection)Scope https://www.googleapis.com/auth/driveA OAuth connection (Google, YouTube, Twitch, Dropbox, Facebook) from Resources—
Operationlist, upload, download, exportlist
Save to when Operation is download or exportserver file: streamed to disk, for videos and other large files. rows in batches: a CSV or text file (or a Sheet exported as CSV) read as it downloads, never saved; its rows come out on the batch output, one batch in memory at a time. step output: the content in the output, for small files.step output, server file, rows in batchesstep output
Read as when Save to is rows in batchesCSV rows, linesCSV rows
Delimiter when Read as is CSV rows,, ;, tab, |,
First row has column names when Read as is CSV rowsOn or offOn
Rows per batch when Save to is rows in batchesA number; may be a formula or variable1000
Export as when Operation is exporttext/plain, text/html, application/pdf, text/csv, application/vnd.openxmlformats-officedocument.wordprocessingml.documenttext/plain
Upload from when Operation is uploadserver file: streamed from disk in a resumable upload, for big files; the content is never held in memory. content: the Content below.content, server filecontent
Content is when Operation is uploadtext, base64text
MIME type when Operation is uploadText; {{gv.X}}, {{ev.X}} or an = formulatext/csv
Convert to a Google Doc/Sheet when Operation is uploadOn or offOff
Wait for each call (seconds)How long one call to Drive may take before it fails: raise it for slow links. Streamed uploads and downloads to server files run until the step's time limit (Settings: 30 minutes by default).A number; may be a formula or variable300
Append to the end of the file when Operation is uploadAdds to the end of a file with the same name in the folder (not for Google Docs/Sheets).On or offOff
Start appended content on a new line when Append to the end of the file is onOn or offOn
Overwrite if it already exists when Append to the end of the file is offReplaces the content of a file with the same name in the folder. Unticked: a second file with the same name is created.On or offOn

Input tab

SettingWhat it doesValuesDefault
Folder id when Operation is list or uploadText; {{ }} references or an = formula—
Search (Drive query) when Operation is liste.g. mimeType = 'application/vnd.google-apps.document'Text; {{ }} references or an = formulatrashed = false
File id when Operation is download or exportText; {{ }} references or an = formula{{input.id}}
Server file when Save to is server fileFull path of the file to write; its folder is made when missing.Text; {{ }} references or an = formula=concat({gv.DOWNLOADS}, '/', {input.name})
File name when Operation is uploadWith Upload from server file: empty = the name of the file.Text; {{ }} references or an = formulareport.csv
Server file when Upload from is server fileText; {{ }} references or an = formula{{input.path}}
Content when Operation is uploadText; {{ }} references or an = formula{{input.text}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

△Google Drive / Docs trigger

Palettes → Apps and social (Google, YouTube, Twitch, Discord, Telegram, Dropbox, Facebook) · activity type googleDriveTrigger · trigger

Starts the Sutra when a file in a Google Drive folder (for example Google Docs) is added, modified or removed. Polls while deployed.

In scope
  • Added, modified and removed files in a Drive folder, optionally of one type.
Out of scope
  • Instant push: the folder is polled.

When to use it

  • Starting a Sutra when someone saves a Google Doc or Sheet.

Procedure

  1. Pick the Google connection and the folder.
  2. Set the poll interval and deploy.

Output

  • event and the file details.

Outputs (ports)

added modified removed

Settings reference

General tab

SettingWhat it doesValuesDefault
Account (OAuth connection)Scope https://www.googleapis.com/auth/drive.readonlyA OAuth connection (Google, YouTube, Twitch, Dropbox, Facebook) from Resources—
Folder idText; {{gv.X}}, {{ev.X}} or an = formula—
Only this typeany, Google Docs, Google Sheets, PDFGoogle Docs
Check every (seconds)A number; may be a formula or variable60
Test event (JSON)Code or JSON{ "event": "modified", "id": "1AbC", "name": "Quarterly plan", …

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

◇Dropbox

Palettes → Apps and social (Google, YouTube, Twitch, Discord, Telegram, Dropbox, Facebook) · activity type dropbox

Uploads, downloads or lists files in Dropbox.

In scope
  • List, read, upload, append and delete files.
Out of scope
  • Shared links.

When to use it

  • Exchanging files with people who use Dropbox.

Procedure

  1. Pick the Dropbox connection, the operation and the path.

Output

  • The file details and, when read, its content.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Account (OAuth connection)Scopes files.content.read files.content.writeA OAuth connection (Google, YouTube, Twitch, Dropbox, Facebook) from Resources—
Operationlist, upload, downloadlist
Content is when Operation is uploadtext, base64text
Append to the end of the file when Operation is uploadAdds the content after what is already there (creates the file if missing).On or offOff
Start appended content on a new line when Append to the end of the file is onOn or offOn
Overwrite if it already exists when Append to the end of the file is offUnticked: the step fails when the file exists (and Append is off).On or offOn

Input tab

SettingWhat it doesValuesDefault
PathText; {{ }} references or an = formula/reports
Content when Operation is uploadText; {{ }} references or an = formula{{input.text}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

▶YouTube

Palettes → Apps and social (Google, YouTube, Twitch, Discord, Telegram, Dropbox, Facebook) · activity type youtube

Your channel on YouTube: its videos, playlists, comments and statistics, search, Analytics reports (views, watch time, subscribers by day, video or country), uploading a video from a file on the server, changing a video's title, description, tags and privacy, and setting its thumbnail. To publish videos kept in Google Drive, save them to a server file with Google Drive / Docs first.

In scope
  • Your channel: videos, playlists, playlist videos, comments, channel statistics and video statistics; search.
  • YouTube Analytics reports by day, month, video, country, device or traffic source.
  • Uploading a video from a file on the server (resumable, streamed), changing title, description, tags, category and privacy, scheduling publication, and setting a thumbnail.
Out of scope
  • Videos kept in Google Drive or elsewhere: save them to a server file first with Google Drive / Docs (Save to: server file) or a file trigger.
  • Live streaming and channel memberships.

When to use it

  • Publishing videos from a shared folder.
  • Weekly or monthly channel reports into Google Sheets or a database.
  • Watching comments on new videos.

Procedure

  1. An OAuth connection with Service google and the scopes the operations need: youtube.readonly, youtube.upload, youtube.force-ssl (changes, comments), yt-analytics.readonly.
  2. Pick the operation and fill its fields; uploads take the server file path, usually {{input.path}} from the step before.
  3. Upload as private or unlisted first, then publish with update video after a check, or set Publish at.

Output

  • items for lists; videoId and url after an upload; rows and columns for an Analytics report.
Guidelines
  • YouTube allows a limited number of uploads per day (the API quota); a failed upload reports it on the error output.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Account (OAuth connection)Scopes: .../auth/youtube.readonly to read, .../auth/youtube.upload to upload, .../auth/youtube.force-ssl to change videos and read comments, .../auth/yt-analytics.readonly for Analytics.A OAuth connection (Google, YouTube, Twitch, Dropbox, Facebook) from Resources—
Operationmy videos, search, video stats, channel stats, playlists, playlist videos, comments, analytics report, upload video, update video, set thumbnailmy videos
Metrics when Operation is analytics reportComma separated YouTube Analytics metrics.Text; {{gv.X}}, {{ev.X}} or an = formulaviews,estimatedMinutesWatched,averageViewDuration,likes,subscribersGai…
By when Operation is analytics reportday, month, video, country, deviceType, insightTrafficSourceType, noneday
Video from when Operation is upload videoserver file, earlier step (base64)server file
Category id when Operation is upload video or update video22 People & Blogs, 27 Education, 28 Science & Technology, 24 Entertainment, 26 Howto & Style.Text; {{gv.X}}, {{ev.X}} or an = formula22
Privacy when Operation is upload video or update videoprivate, unlisted, publicprivate
Made for kids when Operation is upload videoOn or offOff
Notify subscribers when Operation is upload videoOn or offOn
Maximum results when Operation is my videos or search or playlists or playlist videos or commentsA number; may be a formula or variable25

Input tab

SettingWhat it doesValuesDefault
Search when Operation is searchText; {{ }} references or an = formula—
Video ids (comma separated) when Operation is video stats or comments or update video or set thumbnailText; {{ }} references or an = formula{{input.videoId}}
Playlist id when Operation is playlist videosFrom the playlist address: list=...Text; {{ }} references or an = formula—
From when Operation is analytics reportText; {{ }} references or an = formula=format-date('YYYY-MM-DD', add-to-date(current-date(), 0, 0, -28))
To when Operation is analytics reportText; {{ }} references or an = formula=current-date()
Filters when Operation is analytics reportOptional, for example video==dQw4w9WgXcQ or country==IN.Text; {{ }} references or an = formula—
Video file when Video from is server fileA file on the SutraFlow server, for example saved there by Google Drive / Docs (Save to: server file) or a file trigger. Streamed, so large videos are fine.Text; {{ }} references or an = formula{{input.path}}
Video content (base64) when Video from is earlier step (base64)For short clips only; large videos belong in a server file.Text; {{ }} references or an = formula{{input.content}}
Thumbnail image file when Operation is set thumbnailJPEG or PNG under 2 MB, 1280x720 is best.Text; {{ }} references or an = formula{{input.path}}
Title when Operation is upload video or update videoText; {{ }} references or an = formula{{input.name}}
Description when Operation is upload video or update videoText; {{ }} references or an = formula—
Tags (comma separated) when Operation is upload video or update videoText; {{ }} references or an = formula—
Publish at when Operation is upload video or update videoOptional: an ISO date and time; the video stays private until then.Text; {{ }} references or an = formula—
Add to playlist id when Operation is upload videoText; {{ }} references or an = formula—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

fFacebook Page

Palettes → Apps and social (Google, YouTube, Twitch, Discord, Telegram, Dropbox, Facebook) · activity type facebookPage

Publishes a post (with an optional link) to a Facebook Page you manage, or reads its latest posts.

In scope
  • Posting to a Facebook Page and reading its posts.
Out of scope
  • Personal profiles.

When to use it

  • Publishing announcements.

Procedure

  1. Pick the connection and the page; write the message and an optional link.

Output

  • The post id, or the posts.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Account (OAuth connection)Scopes pages_manage_posts pages_read_engagementA OAuth connection (Google, YouTube, Twitch, Dropbox, Facebook) from Resources—
Operationpost, latest postspost
Page idText; {{gv.X}}, {{ev.X}} or an = formula—

Input tab

SettingWhat it doesValuesDefault
Message when Operation is postText; {{ }} references or an = formulaNew arrivals this week: {{input.title}}
Link when Operation is postText; {{ }} references or an = formula—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

◘Twitch

Palettes → Apps and social (Google, YouTube, Twitch, Discord, Telegram, Dropbox, Facebook) · activity type twitch

Twitch channels: users, whether a channel is live and its viewers, channel information, followers, past broadcasts (videos), clips, the schedule, and for your own channel: changing the title, game and tags, creating a clip, and sending a chat message.

In scope
  • Users, whether channels are live and their viewers, channel information, followers, videos (past broadcasts), clips and the schedule.
  • For your own channel: changing the title, game and tags, creating a clip, and sending a chat message.
Out of scope
  • Watching chat as it happens and channel point rewards (EventSub): use Twitch live trigger for going live and offline.

When to use it

  • Announcing streams on other networks.
  • Recording follower and viewer numbers after each stream.
  • Setting the stream title from a schedule.

Procedure

  1. An application at dev.twitch.tv with the redirect address shown on the connection; an OAuth connection with Service twitch, its client id and secret, and the scopes the operations need.
  2. Pick the operation; leave Channels empty for your own channel.

Output

  • items for lists; the changed values or the clip and message ids.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Account (OAuth connection)An OAuth connection with Service twitch (dev.twitch.tv > Your Console > Applications). Scopes: user:read:email; channel:manage:broadcast to change the channel; clips:edit for clips; user:write:chat for chat; moderator:read:followers for followers.A OAuth connection (Google, YouTube, Twitch, Dropbox, Facebook) from Resources—
Operationusers, stream status, channel info, followers, videos, clips, schedule, update channel, create clip, chat messagestream status
Maximum results when Operation is followers or videos or clips or scheduleA number; may be a formula or variable20

Input tab

SettingWhat it doesValuesDefault
Channels (login names, comma separated)Empty = the connected account's own channel.Text; {{ }} references or an = formula—
Title when Operation is update channelText; {{ }} references or an = formula{{input.title}}
Game or category when Operation is update channelA category name such as Just Chatting or Software and Game Development.Text; {{ }} references or an = formula—
Tags (comma separated) when Operation is update channelText; {{ }} references or an = formula—
Message when Operation is chat messageText; {{ }} references or an = formulaThanks for watching! New video: {{input.url}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

◘Twitch live trigger

Palettes → Apps and social (Google, YouTube, Twitch, Discord, Telegram, Dropbox, Facebook) · activity type twitchLiveTrigger · trigger

Starts the Sutra when a Twitch channel goes live or ends its stream: to announce it on other networks, post in a chat, or record statistics. Polls while deployed.

In scope
  • Going live and going offline of one or more channels, checked every minute or so.
Out of scope
  • Instant notifications (Twitch EventSub needs a public HTTPS callback).

When to use it

  • A welcome in chat, a post on other networks, statistics after the stream.

Procedure

  1. Pick the Twitch connection and the channels (leave empty for your own), then connect live and offline.

Output

  • event, login, title, game, viewers, startedAt, url.

Outputs (ports)

live offline

Settings reference

General tab

SettingWhat it doesValuesDefault
Account (OAuth connection)An OAuth connection with Service twitch.A OAuth connection (Google, YouTube, Twitch, Dropbox, Facebook) from Resources—
Channels (login names, comma separated)Empty = the connected account's own channel.Text; {{gv.X}}, {{ev.X}} or an = formula—
Check every (seconds)A number; may be a formula or variable60
Test event (JSON)Code or JSON{ "event": "live", "login": "ashatraders", "name": "AshaTraders"…

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

◙Discord

Palettes → Apps and social (Google, YouTube, Twitch, Discord, Telegram, Dropbox, Facebook) · activity type discord

Posts a message to Discord, with an optional embed (title, text, link, colour) and files from the server; with a bot, also reads the latest messages of a channel. A webhook posts to its own channel; a bot to any channel it is in.

In scope
  • Messages to a channel by webhook or bot, with an embed (title, text, link, colour) and files from the server.
  • Reading the latest messages of a channel (bot).
Out of scope
  • Voice, slash commands and member management.

When to use it

  • Team alerts from failed runs or loads.
  • Answers to commands people type in a channel (Discord trigger).

Procedure

  1. A Discord connection: a webhook address (one channel, nothing to install) or a bot token with the channel id.
  2. Write the message or embed; attach files by their server paths.

Output

  • The message: id, channelId, content; or items when reading.
Guidelines
  • Mentions are switched off, so a message never pings @everyone by mistake.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Discord connectionA Discord from Resources—
Operationsend message, read messagessend message
Embed colour when Operation is send messageText; {{gv.X}}, {{ev.X}} or an = formula#2f6fd8
Messages when Operation is read messagesA number; may be a formula or variable20

Input tab

SettingWhat it doesValuesDefault
Channel id (bot)Empty = the default channel of the connection. Webhooks always post to their own channel.Text; {{ }} references or an = formula—
Message when Operation is send messageUp to 2000 characters; Discord markdown works (**bold**, `code`).Text; {{ }} references or an = formulaOrder {{input.orderId}} has shipped.
Post as (webhook) when Operation is send messageOptional name shown for a webhook message.Text; {{ }} references or an = formula—
Embed title when Operation is send messageText; {{ }} references or an = formula—
Embed text when Operation is send messageText; {{ }} references or an = formula—
Embed link when Operation is send messageText; {{ }} references or an = formula—
Files to attach when Operation is send messagePaths of files on the server, one per line (up to 25 MB in total).Text; {{ }} references or an = formula—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

◙Discord trigger

Palettes → Apps and social (Google, YouTube, Twitch, Discord, Telegram, Dropbox, Facebook) · activity type discordTrigger · trigger

Starts the Sutra for each new message in a Discord channel (a bot connection). Messages that start with the command prefix, such as !status A-1001, go to command with the command and its text apart. Messages of bots are left out. Polls while deployed.

In scope
  • New messages in a channel, checked every few seconds by a bot; commands with a prefix such as ! go to their own output.
Out of scope
  • Messages of other bots, and direct messages.

When to use it

  • Chat commands: !status A-1001, !report today.

Procedure

  1. A bot connection with Message Content Intent turned on in the Discord developer portal; the channel id; the command prefix.

Output

  • content, author, command, args, channelId, attachments.

Outputs (ports)

message command

Settings reference

General tab

SettingWhat it doesValuesDefault
Discord connectionA Discord from Resources—
Channel idEmpty = the default channel of the connection.Text; {{gv.X}}, {{ev.X}} or an = formula—
Command prefixText; {{gv.X}}, {{ev.X}} or an = formula!
Check every (seconds)A number; may be a formula or variable10
Test event (JSON)Code or JSON{ "id": "1300000000000000001", "channelId": "1290000000000000000",…

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

➤Telegram

Palettes → Apps and social (Google, YouTube, Twitch, Discord, Telegram, Dropbox, Facebook) · activity type telegram

Sends a message, photo, document or video from your Telegram bot to a chat, group or channel (text with HTML or Markdown, a reply to a message, link previews on or off), or reads what the bot knows about a chat.

In scope
  • Messages (plain, HTML or MarkdownV2), photos, documents and videos from a file on the server or an address, replies to a message, silent sending; chat information.
Out of scope

When to use it

  • Alerts to a team chat, answers to /commands, sending reports as documents.

Procedure

  1. Create a bot with @BotFather; keep the token as a secret on a Telegram bot connection.
  2. Give the chat id (or the trigger's {{trigger.chatId}}) and the message or file.

Output

  • The sent message: messageId, chatId, text.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Telegram botA Telegram bot from Resources—
Operationsend message, send photo, send document, send video, chat infosend message
Text format when Operation is send message or send photo or send document or send videoHTML: <b>bold</b>, <i>italic</i>, <a href="...">link</a>, <code>code</code>.plain, HTML, MarkdownV2plain
Show link previews when Operation is send messageOn or offOn
Send silentlyOn or offOff

Input tab

SettingWhat it doesValuesDefault
Chat idEmpty = the default chat of the connection. A Telegram trigger gives {{trigger.chatId}} to answer in the same chat.Text; {{ }} references or an = formula{{trigger.chatId}}
Message when Operation is send messageUp to 4096 characters.Text; {{ }} references or an = formulaOrder {{input.orderId}} has shipped.
File when Operation is send photo or send document or send videoA file on the server, or an https address Telegram fetches itself.Text; {{ }} references or an = formula{{input.path}}
Caption when Operation is send photo or send document or send videoText; {{ }} references or an = formula—
Reply to message idOptional; {{trigger.messageId}} answers the message that started the Sutra.Text; {{ }} references or an = formula—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

➤Telegram trigger

Palettes → Apps and social (Google, YouTube, Twitch, Discord, Telegram, Dropbox, Facebook) · activity type telegramTrigger · trigger

Starts the Sutra for each message people send your Telegram bot (in a private chat, or in a group when addressed to it). /commands such as /status A-1001 go to command with the command and its text apart. Uses long polling while deployed, so no public address is needed.

In scope
  • Every message sent to the bot, received by long polling (no public address needed); /commands go to their own output.
Out of scope
  • A bot that already has a webhook set elsewhere: Telegram gives messages to one reader only.

When to use it

  • Bots that answer questions, take orders or run reports on request.

Procedure

  1. Pick the Telegram bot; limit it to chosen chat ids when it does real work.

Output

  • text, command, args, chatId, messageId, from.

Outputs (ports)

message command

Settings reference

General tab

SettingWhat it doesValuesDefault
Telegram botA Telegram bot from Resources—
Only these chat idsComma separated; empty = any chat. Limit who can use a bot that does real work.Text; {{gv.X}}, {{ev.X}} or an = formula—
Test event (JSON)Code or JSON{ "messageId": 42, "chatId": 123456789, "chatType": "private", …

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

▤SharePoint / OneDrive

Palettes → Apps and social (Google, YouTube, Twitch, Discord, Telegram, Dropbox, Facebook) · activity type msFiles

Lists, reads, searches or uploads files in a SharePoint document library or OneDrive. Read can return the document text (PDF, Word, PowerPoint, Excel) ready for Add to knowledge.

In scope
  • Listing, reading, searching and uploading files in a SharePoint document library or OneDrive, through Microsoft Graph.
  • Reading as document text (PDF, Word, PowerPoint, Excel), ready for a knowledge base, or as the file in base64.
Out of scope
  • SharePoint lists and pages: use Connected API call with Microsoft Graph.
  • Uploads over 4 MB.

When to use it

  • Feeding a knowledge base from policy documents; saving reports to a library.

Procedure

  1. Create an OAuth connection with the provider microsoft (scopes Files.Read.All Sites.Read.All offline_access) and connect the account.
  2. Choose SharePoint site (its address and library) or OneDrive.
  3. Choose the operation and the folder or file.

Output

  • List and search: items (repeating: name, path, size, modifiedAt, modifiedBy, webUrl) and count. Read: the file details and text, or content in base64.

Outputs (ports)

out empty error

Settings reference

General tab

SettingWhat it doesValuesDefault
Microsoft account (OAuth connection)Provider microsoft; scopes Files.Read.All Sites.Read.All offline_access (Files.ReadWrite.All to upload).A OAuth connection (Google, YouTube, Twitch, Dropbox, Facebook) from Resources—
WhereSharePoint site, OneDriveSharePoint site
Document library when Where is SharePoint siteEmpty = the default library (Documents / Shared Documents).Text; {{gv.X}}, {{ev.X}} or an = formula—
Operationlist, read, search, uploadlist
File name pattern when Operation is listText; {{gv.X}}, {{ev.X}} or an = formula*
Include sub-folders when Operation is listOn or offOff
Read as when Operation is readdocument text, file (base64)document text
Content is when Operation is uploadtext, base64text

Input tab

SettingWhat it doesValuesDefault
Site address when Where is SharePoint siteText; {{ }} references or an = formulahttps://contoso.sharepoint.com/sites/Policies
Folder when Operation is listPath inside the library, for example Policies/HR. Empty = the top.Text; {{ }} references or an = formula—
File when Operation is read or uploadPath inside the library, for example Policies/Returns.docxText; {{ }} references or an = formula{{input.path}}
Search for when Operation is searchText; {{ }} references or an = formula{{input.question}}
Content when Operation is uploadText; {{ }} references or an = formula{{input.text}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

▥SharePoint / OneDrive trigger

Palettes → Apps and social (Google, YouTube, Twitch, Discord, Telegram, Dropbox, Facebook) · activity type msFilesTrigger · trigger

Starts the Sutra when a file in a SharePoint library or OneDrive folder is added, changed or removed. Checks while deployed. Pair it with SharePoint / OneDrive read and Add to knowledge to keep a knowledge base up to date.

In scope
  • Added, changed and removed files in a SharePoint library or OneDrive folder, each its own output, with a file name pattern and sub-folders.
  • Optionally every existing file as added on the first check.
Out of scope
  • Instant notifications: it checks every few minutes.

When to use it

  • Keeping a knowledge base in step with a document library.

Procedure

  1. Set the connection and the place as for SharePoint / OneDrive.
  2. Set the folder, the pattern and how often to check.
  3. Connect added and modified to SharePoint / OneDrive read and Add to knowledge, removed to Remove knowledge, and deploy.

Output

  • event and the file details: id, name, path, size, modifiedAt, modifiedBy, webUrl.

Outputs (ports)

added modified removed

Settings reference

General tab

SettingWhat it doesValuesDefault
Microsoft account (OAuth connection)Provider microsoft; scopes Files.Read.All Sites.Read.All offline_access (Files.ReadWrite.All to upload).A OAuth connection (Google, YouTube, Twitch, Dropbox, Facebook) from Resources—
WhereSharePoint site, OneDriveSharePoint site
Document library when Where is SharePoint siteEmpty = the default library (Documents / Shared Documents).Text; {{gv.X}}, {{ev.X}} or an = formula—
FolderText; {{gv.X}}, {{ev.X}} or an = formula—
File name patternText; {{gv.X}}, {{ev.X}} or an = formula*
Include sub-foldersOn or offOn
Check every (seconds)A number; may be a formula or variable300
Start with the files already thereTicked: the first check reports every existing file as added (to fill a knowledge base). Unticked: only later changes.On or offOff
Test event (JSON)Code or JSON{ "event": "modified", "id": "01ABC", "name": "Returns.docx", …

Input tab

SettingWhat it doesValuesDefault
Site address when Where is SharePoint siteText; {{ }} references or an = formulahttps://contoso.sharepoint.com/sites/Policies

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

Azure Data Factory & Databricks

⛁Run ADF pipeline

Palettes → Azure Data Factory & Databricks · activity type adfRun

Runs an Azure Data Factory pipeline with parameters and, when asked, waits for it: Succeeded goes to out; Failed or Cancelled to failed, with the failing activities and their errors. Can rerun a failed run from the failed activity.

In scope
  • Running an Azure Data Factory pipeline with parameters (nested values as JSON).
  • Waiting for it, with the activity runs, their output and errors.
  • Rerunning an earlier run from its failed activity or from a named activity.
Out of scope
  • Editing pipelines: do that in Data Factory Studio.

When to use it

  • Starting loads from an event (a file arrived, an order batch closed) instead of a fixed schedule.
  • Chaining pipelines with work outside Azure, and acting on their outcome.

Procedure

  1. An Azure Data Factory connection (service principal, managed identity or Azure CLI) with the Data Factory Contributor role.
  2. The pipeline name and its parameters.
  3. Keep Wait until it ends on to branch on the outcome; connect failed.

Output

  • runId, status, message, durationMs, activities, failedActivities and monitorUrl (the run in Data Factory Studio).
Guidelines
  • A wait that runs out cancels the run when Cancel the run is ticked, so nothing keeps running unseen.

Outputs (ports)

out failed error

Settings reference

General tab

SettingWhat it doesValuesDefault
Data factoryA Azure Data Factory from Resources—
RunReruns repeat an earlier run (its run id below) from where it failed, or from a named activity.new run, rerun from the failed activity, rerun from an activitynew run
Wait until it endsOff: start it and go on at once with its run id (check it later with a status step).On or offOn
Wait at most (minutes) when Wait until it ends is onA number; may be a formula or variable120
Cancel the run when the wait runs out when Wait until it ends is onOn or offOn
Include activity runs when Wait until it ends is onEach activity of the run with its status, duration, output and error.On or offOn

Input tab

SettingWhat it doesValuesDefault
PipelineThe pipeline name as in the factory.Text; {{ }} references or an = formulaCopySalesToLake
ParametersPipeline parameters by name. Objects and lists are passed as JSON.Rows of name and valuerunDate
More parameters (JSON)Optional: a JSON object merged with the rows above, for nested values.Code or JSON—
Earlier run id when Run is rerun from the failed activity or rerun from an activityText; {{ }} references or an = formula{{input.runId}}
Start from activity when Run is rerun from an activityText; {{ }} references or an = formula—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

◷ADF pipeline run

Palettes → Azure Data Factory & Databricks · activity type adfMonitor

Checks on Azure Data Factory: the status of a run, waiting for it, cancelling it, its activity runs, the recent runs of the factory, the pipelines, or starting and stopping a factory trigger.

In scope
  • The status of a run, waiting for one started elsewhere, cancelling it, its activity runs.
  • The recent runs of the factory by pipeline and status; the pipelines and their parameters; starting and stopping factory triggers.
Out of scope
  • Pipelines of other factories: give each factory its own connection.

When to use it

  • Checking a run started with Wait until it ends off.
  • Daily reports of failed runs.
  • Pausing a schedule during maintenance.

Procedure

  1. Pick the connection and the operation; give the run id where it asks.

Output

  • A run, runs, activities or pipelines, by operation.

Outputs (ports)

out failed error

Settings reference

General tab

SettingWhat it doesValuesDefault
Data factoryA Azure Data Factory from Resources—
Operationget run, wait for run, cancel run, activity runs, recent runs, list pipelines, start trigger, stop triggerget run
Only with status when Operation is recent runsany, Succeeded, Failed, InProgress, Queued, Cancelledany
Updated in the last (hours) when Operation is recent runsA number; may be a formula or variable24
Wait at most (minutes) when Operation is wait for runA number; may be a formula or variable120
Cancel the run when the wait runs out when Operation is wait for runOn or offOff

Input tab

SettingWhat it doesValuesDefault
Run id when Operation is get run or wait for run or cancel run or activity runsText; {{ }} references or an = formula{{input.runId}}
Only this pipeline when Operation is recent runsText; {{ }} references or an = formula—
Factory trigger when Operation is start trigger or stop triggerText; {{ }} references or an = formula—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⛁ADF run finished trigger

Palettes → Azure Data Factory & Databricks · activity type adfRunTrigger · trigger

Starts the Sutra when a pipeline run of the data factory ends, whoever started it (a schedule, a person, another tool): to alert on failures, rerun them, or carry on with the next work. Polls while deployed.

In scope
  • Pipeline runs of a factory that end, however they were started (schedules, people, other tools), checked every minute or so.
Out of scope
  • Runs that are still going.

When to use it

  • Alerting on failures, asking a person whether to rerun, and starting follow-on work when a load succeeds.

Procedure

  1. Pick the connection and, optionally, the pipelines; connect succeeded, failed and cancelled.

Output

  • The run: runId, pipeline, status, message, durationMs, parameters, monitorUrl.

Outputs (ports)

succeeded failed cancelled

Settings reference

General tab

SettingWhat it doesValuesDefault
Data factoryA Azure Data Factory from Resources—
Only these pipelinesComma separated; empty = every pipeline.Text; {{gv.X}}, {{ev.X}} or an = formula—
Check every (seconds)A number; may be a formula or variable60
Test event (JSON)Code or JSON{ "runId": "a1b2c3d4-0000-4000-8000-000000000001", "pipeline": "Co…

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

◆Run Databricks job or notebook

Palettes → Azure Data Factory & Databricks · activity type databricksRun

Runs a Databricks job (by id, with job parameters) or a notebook (by path, with parameters, on a cluster, serverless or a new job cluster) and, when asked, waits for it. A notebook's dbutils.notebook.exit value comes back as result (JSON when it is JSON). Failed or cancelled runs go to failed with the error.

In scope
  • Running a Databricks job by id with job parameters, or a notebook by path with parameters on an all-purpose cluster, serverless compute or a new job cluster.
  • Waiting for it and reading the notebook's dbutils.notebook.exit value.
Out of scope
  • Creating and editing jobs: use Workflows in Databricks.

When to use it

  • Notebooks that transform data after a file or event arrives.
  • Machine learning scoring runs started by a process.

Procedure

  1. A Databricks workspace connection (personal access token, Databricks OAuth or an Azure identity).
  2. A notebook path and parameters (read in the notebook with dbutils.widgets.get), or a job id.
  3. End the notebook with dbutils.notebook.exit(json.dumps({...})) to hand values back.

Output

  • runId, state, result (JSON when the exit value is JSON), error, runPageUrl, tasks.

Outputs (ports)

out failed error

Settings reference

General tab

SettingWhat it doesValuesDefault
Databricks workspaceA Databricks workspace from Resources—
Runnotebook, jobnotebook
Compute when Run is notebookexisting cluster, serverless, new job clusterexisting cluster
Runtime version when Compute is new job clusterText; {{gv.X}}, {{ev.X}} or an = formula15.4.x-scala2.12
Node type when Compute is new job clusterText; {{gv.X}}, {{ev.X}} or an = formulaStandard_DS3_v2
Workers when Compute is new job clusterA number; may be a formula or variable1
Wait until it endsOff: start it and go on at once with its run id (check it later with a status step).On or offOn
Wait at most (minutes) when Wait until it ends is onA number; may be a formula or variable120
Cancel the run when the wait runs out when Wait until it ends is onOn or offOn

Input tab

SettingWhat it doesValuesDefault
Job id when Run is jobWorkflows > the job > Job ID.Text; {{ }} references or an = formula—
Job parameters when Run is jobRows of name and value—
Notebook path when Run is notebookThe notebook in the workspace (or Repos), without .py or .ipynb.Text; {{ }} references or an = formula/Workspace/Shared/sales/daily_totals
Notebook parameters when Run is notebookRead in the notebook with dbutils.widgets.get("run_date"). Values are text.Rows of name and valuerun_date
Cluster id when Compute is existing clusterEmpty = the default cluster of the workspace connection.Text; {{ }} references or an = formula—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

❖Databricks code block

Palettes → Azure Data Factory & Databricks · activity type databricksCommand

Runs a block of Python, SQL, Scala or R on a running all-purpose cluster, like one notebook cell, and returns its text or table. Python gets the parameters as the dict sutra_params. Can start the cluster first.

In scope
  • One block of Python, SQL, Scala or R on a running all-purpose cluster, like a notebook cell; the cluster can be started first.
Out of scope

When to use it

  • A quick check or calculation on data in the lakehouse in the middle of a process.

Procedure

  1. Pick the workspace, cluster (or its default), language and code; Python gets the parameters as sutra_params.

Output

  • text, or rows and columns for a table.
Guidelines
  • Parameters travel as data, never pasted into the code, so values cannot change what runs.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Databricks workspaceA Databricks workspace from Resources—
Languagepython, sql, scala, rpython
CodeThe last expression or print() is the result. A SQL block returns its rows.Code or JSONdf = spark.table("samples.nyctaxi.trips").where(f"pickup_zip = {sutra_…
Start the cluster when stoppedOn or offOn
Wait at most (minutes)A number; may be a formula or variable30

Input tab

SettingWhat it doesValuesDefault
Cluster idEmpty = the default cluster of the workspace connection.Text; {{ }} references or an = formula—
Parameters (Python) when Language is pythonAvailable in the code as sutra_params["name"]; passed as data, never pasted into the code.Rows of name and valuezip

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

◫Databricks SQL

Palettes → Azure Data Factory & Databricks · activity type databricksSql

Runs a SQL statement on a Databricks SQL warehouse with named parameters (:name, passed as values, never pasted into the SQL) and returns the rows as objects.

In scope
  • A SQL statement on a Databricks SQL warehouse with named parameters (:name), catalog and schema, all result chunks read.
Out of scope
  • Writing large data sets: use a notebook or job.

When to use it

  • Reading lakehouse tables into a process: lookups, report rows, checks.

Procedure

  1. Pick the workspace and warehouse (or its default); write the SQL with :name parameters and add exactly one row for every case-sensitive name. The designer and Deploy show binding defects as errors and an unused row as a warning.
  2. Choose Test query (10 rows) for a read-only SELECT sample through the selected warehouse. Write statements are refused in preview; the deployed statement keeps its configured row limit.

Output

  • rows as objects, columns, count; empty when no rows.

Outputs (ports)

out empty error

Settings reference

General tab

SettingWhat it doesValuesDefault
Databricks workspaceA Databricks workspace from Resources—
SQLProject and Engine properties ({{gv.X}}, {{ev.X}}) are written into the SQL: catalog, schema or table names. Run data such as {{input.zip}} is always sent as a named parameter, the same as a :name parameter.Code or JSONSELECT pickup_zip, count(*) AS trips, round(avg(fare_amount), 2) AS av…
CatalogText; {{gv.X}}, {{ev.X}} or an = formula—
SchemaText; {{gv.X}}, {{ev.X}} or an = formula—
Maximum rowsA number; may be a formula or variable10000
Wait at most (minutes)A number; may be a formula or variable30

Input tab

SettingWhat it doesValuesDefault
SQL warehouse idEmpty = the default warehouse of the workspace connection.Text; {{ }} references or an = formula—
ParametersNamed parameters used as :name in the SQL.Rows of name and valuezip

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

Custom code

JSJavaScript code

Palettes → Custom code · activity type jsCode

Runs your JavaScript in a sandbox. Use input, nodes, vars, gv, trigger and run; return the output. console.log goes to the run log. No network or file access.

In scope
  • JavaScript over input, nodes, vars and gv, returning the output.
  • A sandbox without host access, with time and memory limits.
Out of scope
  • Files, network and npm packages.

When to use it

  • Logic that is awkward in formulas: checksums, custom parsing, scoring.

When to choose another activity

  • Reshape data without code → use Map data.

Procedure

  1. Write the code; return the output.
  2. Set the time and memory limits.
  3. Test and check the Output tab.

Output

  • What the code returns.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
CodeCode or JSON// input = previous step output; nodes["Step name"] = any earlier step…
Time limit (ms)A number; may be a formula or variable5000
Memory limit (MB)A number; may be a formula or variable64

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

</>HTML template

Palettes → Custom code · activity type htmlTemplate

Builds HTML (an email body, a page, a report) from a template: {{input.x}} is escaped, {{{x}}} is raw, {{=formula}}, {{#each list}}…{{/each}}, {{#if x}}…{{else}}…{{/if}}.

In scope
  • HTML with {{ }} placeholders (escaped), {{#each}} and {{#if}}.
Out of scope

When to use it

  • Email bodies, simple reports, HTML replies.

Procedure

  1. Write the HTML with placeholders.

Output

  • html.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
HTMLCode or JSON<h1>Order {{input.orderId}}</h1> <table> {{#each input.lines}}<tr><t…

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

Scripts (PowerShell, shell, Python)

PyPython script

Palettes → Scripts (PowerShell, shell, Python) · activity type python

Runs Python 3 code written here, or a .py file on the server, with arguments and parameters, and captures its output, error output and exit code. Printed JSON becomes json and result. The designer and Deploy warn when Python, the file or a package is missing, or the code does not parse. Needs scripts to be allowed in Admin Console > Server > Runtime.

In scope
  • Python 3 written in the step, or a .py file on the server, with arguments, parameters (a JSON file and environment variables) and the previous step's output (a JSON file).
  • A chosen interpreter or virtual environment.
  • Checks before anything runs: Python installed, the code parses, the file exists, the packages are installed.
Out of scope
  • Installing packages: do that on the server (python -m pip install ...) or in a virtual environment.

When to use it

  • Data work with pandas and other libraries, calculations, calling tools that only have a Python library.

Procedure

  1. An administrator allows scripts in Admin Console → Server → Runtime, where the Python in use is shown.
  2. Write the code (or give the file), add parameters, list the packages it imports.
  3. Print JSON on the last line to hand values to the next step.

Output

  • result (the printed JSON), stdout, stderr, exitCode, ms, python.
Guidelines
  • A non-zero exit code or a traceback fails the step with the last lines of the error.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Code fromcode, filecode
Code when Code from is codePrint JSON (json.dumps) on the last line to hand structured data to the next step.Code or JSONimport json, os, sys params = json.load(open(os.environ["SUTRA_PARAMS…
Script file when Code from is fileA .py file on the SutraFlow server. May use {{gv.SCRIPTS}}.Text; {{gv.X}}, {{ev.X}} or an = formulaC:/scripts/report.py
Pythondetected: the server's Python (Admin Console > Server > Runtime shows which). this interpreter: a path you give, such as a virtual environment's python.detected, this interpreterdetected
Interpreter path when Python is this interpreterText; {{gv.X}}, {{ev.X}} or an = formula—
Virtual environment folderOptional: a venv folder; its python is used and its packages are available.Text; {{gv.X}}, {{ev.X}} or an = formula—
Packages it importsComma separated import names, such as pandas, requests, openpyxl: checked before it runs, so a missing one is found in the designer, not in production.Text; {{gv.X}}, {{ev.X}} or an = formula—
Working folderEmpty = a new temporary folder for each run (the script file's folder for a file).Text; {{gv.X}}, {{ev.X}} or an = formula—
Time limit (ms)A number; may be a formula or variable300000
Fail when the exit code is not 0Then the error output carries the exit code and the last lines of the traceback.On or offOn

Input tab

SettingWhat it doesValuesDefault
ArgumentsOne per line, each passed as one argument (sys.argv[1:]).A list—
ParametersA JSON file named by SUTRA_PARAMS_FILE, and environment variables of the same names. The previous step's output is in SUTRA_INPUT_FILE.Rows of name and valueorderId, taxRate

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

❯PowerShell script

Palettes → Scripts (PowerShell, shell, Python) · activity type powershell

Runs a PowerShell script on the server and captures its output, error output and exit code. Values come in as environment variables. Needs scripts to be allowed in Admin Console > Server > Runtime.

In scope
  • A PowerShell script on the server: Windows PowerShell 5.1 or PowerShell 7.
  • Values as environment variables ($env:NAME) and the previous step's output as a JSON file ($env:SUTRA_INPUT_FILE).
  • Output, error output, both together in order, the exit code, and JSON output read as data.
Out of scope
  • Scripts that wait for someone to type: they run without a console.
  • Running on another machine: use PowerShell remoting inside the script.

When to use it

  • Windows administration: services, files, event logs, Active Directory, IIS, scheduled tasks.

When to choose another activity

Procedure

  1. Ask an administrator to tick Allow script activities in Admin Console → Server → Runtime.
  2. Choose Windows PowerShell or PowerShell 7.
  3. Add the values the script needs under Variables, for example ORDER_ID = {{input.orderId}}, and read them as $env:ORDER_ID.
  4. Write the script. End with ... | ConvertTo-Json to hand data to the next step.
  5. Connect the error output: it carries the exit code, the output and the error output.

Output

  • exitCode, stdout (output), stderr (error output), output (both, in the order printed), lines, json (when the output is JSON), ms, timedOut, truncated (output over 5 MB). On the error output, the same under {input.error.details}.
Guidelines
  • Never paste values into the script text; use Variables. Data from a request or a file then cannot become commands.
  • Scripts run with the rights of the account SutraFlow runs as: give that account only what the scripts need.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
PowerShellWindows PowerShell 5.1 comes with Windows; PowerShell 7 must be installed (pwsh).Windows PowerShell, PowerShell 7 (pwsh)Windows PowerShell
ScriptPrint JSON (ConvertTo-Json) to hand structured data to the next step; it arrives as json.Code or JSON$order = Get-Content $env:SUTRA_INPUT_FILE -Raw | ConvertFrom-Json $fi…
Working folderEmpty = a new temporary folder for each run.Text; {{gv.X}}, {{ev.X}} or an = formula—
Time limit (ms)A number; may be a formula or variable60000
Fail when the exit code is not 0Then the error output carries the exit code and what the script printed. Untick to continue and check exitCode yourself.On or offOn

Input tab

SettingWhat it doesValuesDefault
VariablesPassed as environment variables: $env:ORDER_ID in PowerShell, $ORDER_ID in bash, %ORDER_ID% in cmd. The previous step's output is in the JSON file named by SUTRA_INPUT_FILE.Rows of name and valueORDER_ID

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

$Shell script

Palettes → Scripts (PowerShell, shell, Python) · activity type shellScript

Runs a bash, sh or Windows cmd script on the server and captures its output, error output and exit code. Values come in as environment variables. Needs scripts to be allowed in Admin Console > Server > Runtime.

In scope
  • A bash or sh script, or a Windows cmd batch script, on the server.
  • Values as environment variables ($NAME in bash, %NAME% in cmd) and the previous step's output as a JSON file ($SUTRA_INPUT_FILE).
  • Output, error output, exit code and JSON output, as for PowerShell script.
Out of scope
  • Interactive programs.

When to use it

  • Linux administration, existing shell scripts, command-line tools such as curl, rsync, tar or git.

When to choose another activity

  • A program with arguments, no shell → use Run program.

Procedure

  1. Have scripts allowed in Admin Console → Server → Runtime.
  2. Choose bash, sh or cmd. On Windows, bash from Git for Windows is found by itself.
  3. Add Variables and write the script; set -e stops at the first failing command.
  4. Connect the error output.

Output

Guidelines
  • Quote variables in bash ("$FILE") so names with spaces stay one argument.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
ShellOn Windows, bash comes with Git for Windows or WSL.bash, sh, cmd (Windows)bash
ScriptPrint JSON to hand structured data to the next step; it arrives as json.Code or JSONset -e echo "Order $ORDER_ID" ls -1 "${TMPDIR:-/tmp}" | head -5
Working folderEmpty = a new temporary folder for each run.Text; {{gv.X}}, {{ev.X}} or an = formula—
Time limit (ms)A number; may be a formula or variable60000
Fail when the exit code is not 0Then the error output carries the exit code and what the script printed. Untick to continue and check exitCode yourself.On or offOn

Input tab

SettingWhat it doesValuesDefault
VariablesPassed as environment variables: $env:ORDER_ID in PowerShell, $ORDER_ID in bash, %ORDER_ID% in cmd. The previous step's output is in the JSON file named by SUTRA_INPUT_FILE.Rows of name and valueORDER_ID

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

▷Run program

Palettes → Scripts (PowerShell, shell, Python) · activity type runProgram

Starts a program with its arguments, without a shell, and captures its output, error output and exit code. Each argument is passed as it is, so values cannot add commands. Needs scripts to be allowed in Admin Console > Server > Runtime.

In scope
  • Starting a program with a list of arguments, without any shell.
  • Arguments with {{ }} references, each passed as exactly one argument; optional standard input.
  • Output, error output, exit code and JSON output, as for PowerShell script.
Out of scope
  • Pipes, redirection and other shell features: use Shell script.

When to use it

  • Command-line tools with clear arguments: 7-Zip, ImageMagick, ffmpeg, a vendor's export tool. The safest way to pass values: no shell can read them as commands.

Procedure

  1. Have scripts allowed in Admin Console → Server → Runtime.
  2. Give the program's full path, or its name when it is on the server's PATH.
  3. List the arguments, one per line.
  4. Connect the error output.

Output

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
ProgramFull path, or a name on the server's PATH.Text; {{gv.X}}, {{ev.X}} or an = formulaC:/Program Files/7-Zip/7z.exe
Working folderEmpty = a new temporary folder for each run.Text; {{gv.X}}, {{ev.X}} or an = formula—
Time limit (ms)A number; may be a formula or variable60000
Fail when the exit code is not 0Then the error output carries the exit code and what the script printed. Untick to continue and check exitCode yourself.On or offOn

Input tab

SettingWhat it doesValuesDefault
ArgumentsOne per line; each may use {{ }} references and is passed as one argument.A list, ,
Standard inputOptional text sent to the program.Text; {{ }} references or an = formula—
VariablesPassed as environment variables: $env:ORDER_ID in PowerShell, $ORDER_ID in bash, %ORDER_ID% in cmd. The previous step's output is in the JSON file named by SUTRA_INPUT_FILE.Rows of name and valueORDER_ID

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

Release (packages)

⬢Build package

Palettes → Release (packages) · activity type releasePackage

Builds a package of a project: every deployed Sutra at its version, connections without secret values, schemas and variables. On this server or a remote one; can also save it as a file.

In scope
  • A package of a project on this server or a remote one: every deployed Sutra at its version, connections without secret values, schemas, variables.
  • Only chosen Sutras; a version formula; saving the file to a folder.
Out of scope
  • Secret values: they never leave a vault.

When to use it

  • The first step of a release Sutra, on a timer or when a REST call asks for a release.

When to choose another activity

Procedure

  1. Have an administrator allow release activities in Admin Console → Server → Runtime.
  2. Choose the server: this one, or a remote one with its admin token from the vault.
  3. Give the project (leave empty for the project of this Sutra) and the version, for example =concat('1.4.', {input.build}).
  4. Optionally pick Sutras and a folder to save the file in.

Output

  • name, version, checksum, sutras, secrets (names the target needs), file, and the package itself for the next step.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Serverthis server, remote serverthis server
Server address when Server is remote serverThe engine's admin address. May use {{gv.PROD_ENGINE}}.Text; {{gv.X}}, {{ev.X}} or an = formulahttps://engine-1:4800
Admin token when Server is remote serverSecret property holding the SUTRA_ADMIN_TOKEN of that server.The name of a vault secret—
Only these SutrasEmpty = all of them.A list—

Input tab

SettingWhat it doesValuesDefault
ProjectProject name. Empty = the project of this Sutra.Text; {{ }} references or an = formula—
VersionLike 1.4.0.Text; {{ }} references or an = formula=concat('1.0.', format-dateTime('YYYYMMDDHHmm', current-dateTime(), 'U…
NoteText; {{ }} references or an = formula—
Also save to folderOptional: writes <project>-<version>.sutra there. A folder name such as nightly is inside the server's releases folder (<data>/releases); a full path must be inside that folder or the files folder of a project (<data>/files).Text; {{ }} references or an = formula—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

✓Check package

Palettes → Release (packages) · activity type releaseCheck

Checks whether a package can be deployed on a server: activities it knows, secrets present, API paths and skill names not used by another project.

In scope
  • Whether a package can be deployed on a server: activities known there, secrets present, API paths and skill names free.
Out of scope
  • Running the Sutras: use sutra test.

When to use it

  • Before a deploy, with the problems output leading to a notification.

Procedure

  1. Take the package from the previous step or a file.
  2. Choose the server and, optionally, the project name to deploy as.
  3. Connect ok to the deploy and problems to a notification.

Output

  • ok, errors, warnings, secrets (each present or missing), and the package.

Outputs (ports)

ok problems error

Settings reference

General tab

SettingWhat it doesValuesDefault
Package fromprevious step, fileprevious step
Serverthis server, remote serverthis server
Server address when Server is remote serverThe engine's admin address. May use {{gv.PROD_ENGINE}}.Text; {{gv.X}}, {{ev.X}} or an = formulahttps://engine-1:4800
Admin token when Server is remote serverSecret property holding the SUTRA_ADMIN_TOKEN of that server.The name of a vault secret—

Input tab

SettingWhat it doesValuesDefault
Package when Package from is previous stepThe package an earlier Build package produced.Text; {{ }} references or an = formula{{input.package}}
Package file when Package from is fileA .sutra file on this server.Text; {{ }} references or an = formula—
Deploy as projectEmpty = the package's project name.Text; {{ }} references or an = formula—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⇪Deploy package

Palettes → Release (packages) · activity type releaseDeploy

Deploys a package to this server or a remote engine. Refused, on the error output, when the check finds a problem; Sutras not in the package are undeployed unless kept.

In scope
  • Deploying a package to this server or a remote engine, with an optional deployment config file.
  • Keeping or undeploying Sutras that are not in the package.
Out of scope
  • Partial deploys: a package is all or nothing (refused when its check fails).

When to use it

Procedure

  1. Take the package from the previous step or a file.
  2. Choose the server, the project name to deploy as, and optionally a deployment config file for that environment.
  3. Connect the error output: a refused deploy carries the check's problems.

Output

  • The deployment report: project, package, each Sutra with its action (created, updated, unchanged) and version, undeployed, unchanged, warnings.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Package fromprevious step, fileprevious step
Serverthis server, remote serverthis server
Server address when Server is remote serverThe engine's admin address. May use {{gv.PROD_ENGINE}}.Text; {{gv.X}}, {{ev.X}} or an = formulahttps://engine-1:4800
Admin token when Server is remote serverSecret property holding the SUTRA_ADMIN_TOKEN of that server.The name of a vault secret—
Keep Sutras that are not in the package deployedOn or offOff

Input tab

SettingWhat it doesValuesDefault
Package when Package from is previous stepThe package an earlier Build package produced.Text; {{ }} references or an = formula{{input.package}}
Package file when Package from is fileA .sutra file on this server.Text; {{ }} references or an = formula—
Deploy as projectEmpty = the package's project name.Text; {{ }} references or an = formula—
Deployment config fileOptional: a JSON deployment config on this server, applied with the package.Text; {{ }} references or an = formula—
Approved planNeeded when the package replaces or undeploys Sutras already deployed: the plan id from Check package (plan.planId), after a person approved it, for example in an Approval step. Without it the deployment stops and lists what it would replace.Text; {{ }} references or an = formula—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

↶Roll back

Palettes → Release (packages) · activity type releaseRollback

Deploys the package that was current before the latest one (or a chosen earlier deployment) to a project, on this server or a remote engine.

In scope
  • Deploying the package before the current one, or a chosen earlier deployment, on this server or a remote engine.
Out of scope
  • Undoing changes made by runs (data written, messages sent).

When to use it

  • An automatic way back when checks after a deploy fail.

Procedure

  1. Choose the server and the project.
  2. Optionally give a deployment id from the history.

Output

  • The deployment report of the package deployed again.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Serverthis server, remote serverthis server
Server address when Server is remote serverThe engine's admin address. May use {{gv.PROD_ENGINE}}.Text; {{gv.X}}, {{ev.X}} or an = formulahttps://engine-1:4800
Admin token when Server is remote serverSecret property holding the SUTRA_ADMIN_TOKEN of that server.The name of a vault secret—

Input tab

SettingWhat it doesValuesDefault
ProjectEmpty = the project of this Sutra.Text; {{ }} references or an = formula—
To deployment idOptional: from the history; empty = the previous package.Text; {{ }} references or an = formula—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

Dashboards

▦Dashboard page

Palettes → Dashboards · activity type dashboardPage · trigger

Publishes the Sutra as a dashboard page on the gateway at /dash/<name> while it is deployed, behind its security policy, with filters (slicers) at the top. The page asks for data every refresh and when a filter changes; the run makes the charts (Chart) and answers with Dashboard reply. Results are cached for the refresh time and shared by the viewers.

In scope
  • Publishes the Sutra as a dashboard page on the gateway at /dash/<name> while it is deployed, with Apache ECharts served by SutraFlow itself.
  • Filters (slicers) at the top of the page: a list, a multi list, a date range, a number range or a search, each on a field. Their values are in the page address, so a link shows the same view, and a click on a chart sets the filter of its category field.
  • A security policy for who may see it; the page itself holds no data, the data request needs the policy.
  • A refresh time: the page asks for data that often (and at once when a filter changes); results are kept on the server for that time and shared by every viewer with the same filters (or per caller).
  • /dash/<name>/embed.js puts it on another web page, which passes its login with window.SutraDashboard = { token: () => accessToken }.
Out of scope
  • Reports to download or email: export PNG or SVG from each chart in the browser.

When to use it

  • Sales, operations and service dashboards for people outside the studio, on a database, an API or any JSON.
  • A KPI page embedded in a website or intranet.

Procedure

  1. Give it a name, title and description.
  2. Add the filters: one row each, the field and its kind, such as region = list, category = multi list: Tea, Cups, order_date = date range.
  3. Choose who may see it and the refresh time; each caller when every caller sees their own data.
  4. Query the data, using the filters (below), make Chart steps, and end with Dashboard reply.
  5. Deploy, then open /dash/<name>.

Output

  • dashboard, params (the filters as text, and other query parameters of the page address), filters (the filters typed: a text, a list, {from, to}, {contains}) and caller (subject, method, claims, scopes).
Guidelines
  • Filters in SQL: every filter is in {{trigger.params.<field>}}, empty when nothing is chosen; a multi list is the values joined by commas; a range is <field>_from and <field>_to. Written in the SQL they are bound parameters, never pasted in: WHERE ({{trigger.params.region}} = '' OR region = {{trigger.params.region}}). A multi list: FIND_IN_SET(category, {{trigger.params.category}}) > 0 in MySQL, category = ANY(string_to_array({{trigger.params.category}}, ',')) in PostgreSQL.
  • Filters on JSON: Chart steps apply {{trigger.filters}} to their rows themselves (their Page filters setting), so data from an API needs nothing else.
  • Connect the empty port of an SQL query to the charts as well: filters that match nothing then show empty charts instead of an error.

Outputs (ports)

out

Settings reference

General tab

SettingWhat it doesValuesDefault
Dashboard nameLetters, digits and -. The page is /dash/<name>; /dash/<name>/embed.js puts it on another web page.Text; {{gv.X}}, {{ev.X}} or an = formulasales
TitleText; {{gv.X}}, {{ev.X}} or an = formulaSales
DescriptionText; {{gv.X}}, {{ev.X}} or an = formulaOrders and revenue of the last months.
FiltersSlicers at the top of the page, one row each: the field, then its kind: list, multi list, date range, number range or search. Fixed choices after a colon: "list: North, South". Without them, a list offers the values of the Filter choices of the Dashboard reply, else of the charts. Values reach the run in {{trigger.params.<field>}} (text, for SQL; ranges as <field>_from and <field>_to) and {{trigger.filters}} (for Chart steps). A click on a chart sets the filter of its category field.Rows of name and value—
Who may see itEmpty = anyone who reaches the gateway. A website that embeds it passes its login with window.SutraDashboard = { token: () => accessToken }.A API security policy from Resources—
Refresh every (seconds)How often the page asks for data, and how long results are kept on the server for all viewers: 100 viewers within that time cause one run (per set of filter values).A number; may be a formula or variable60
Results are the same for"each caller" keeps results per signed-in caller: for dashboards that show each caller their own data.everyone, each callereveryone
ColumnsCharts per row on a wide screen (1 to 4); one per row on a phone.A number; may be a formula or variable2

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

▤Chart

Palettes → Dashboards · activity type chart

Makes a chart from rows: an SQL query, an API answer or any JSON. Bar, line, area, pie, donut, scatter, a number, a KPI card (with the change and a target), a gauge or a table. Groups raw rows and adds them up (sum, average, count, distinct count, min, max), by day, week, month, quarter or year, split into series by a field; applies the page filters. Optionally takes its settings from an earlier step (an AI suggestion), used only when they pass the check.

In scope
  • A chart from rows: an SQL query, an API answer, a JSON list or an object holding one (List inside). Bar, horizontal bar, line, area, pie, donut, scatter, a number, a KPI card, a gauge or a table.
  • Grouping raw rows: sum, average, count, distinct count, min or max per category; dates by day, week, month, quarter or year; series split by a field (a legend). Nested fields as customer.city.
  • KPI cards: the total, or the latest period with the change against the one before (or a value to compare with), a trend line and a target; Better is lower for costs.
  • The page filters applied to the rows that have the field.
  • Settings from an earlier step (an AI suggestion), used only when they pass the check: known settings, chart types, palettes and groupings, and fields that are in the rows.
Out of scope
  • Code or links in charts: the chart is plain JSON, and the data always comes from Rows.

When to use it

  • Each chart of a dashboard.
  • Charts on raw records from an API without writing a query.
  • Letting an AI choose the best chart for the data without letting it change the data.

Procedure

  1. Set Rows ({{input.rows}} of an SQL query, or an API body with List inside).
  2. Pick the chart, the category field and the value fields.
  3. For raw rows, choose Group and add up, Dates by and Split into series by; for rows an SQL query already grouped, leave none.
  4. Optionally put an AI prompt's JSON in Settings from a step; refused parts are logged and the step's own settings are used.

Output

  • chart (id, title, type, its category field, and the ECharts option, value, KPI details or table rows), rows (after the filters) and problems (what was refused from a suggestion).

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
List insideWhen Rows is an object, the path of its list, such as data.items. Empty = its first list.Text; {{gv.X}}, {{ev.X}} or an = formula—
Chartbar, horizontal bar, line, area, pie, donut, scatter, number, kpi, gauge, tablebar
Category fieldThe field along the axis, the slices of a pie, or the periods of a KPI trend. Nested fields as customer.city.Text; {{gv.X}}, {{ev.X}} or an = formulamonth
Value fieldsOne or more fields, comma separated: one series each. A number or KPI uses the first; a gauge shows the first row. Not needed for count.Text; {{gv.X}}, {{ev.X}} or an = formularevenue
Group and add upnone: one point per row, as the rows come (an SQL query that already groups). sum, average, count, distinct count, min, max: rows with the same category become one point. A number or KPI adds up (sum) when none.none, sum, average, count, distinct count, min, maxnone
Dates byWhen the category is a date: one point per day, week, month, quarter or year.none, day, week, month, quarter, yearnone
Split into series byA field whose values become series (as a legend), such as region: the first value field per region. At most 12.Text; {{gv.X}}, {{ev.X}} or an = formula—
KPI shows when Chart is kpitotal: all rows added up. latest: the last period of the category, compared with the one before.total, latesttotal
Better is when Chart is kpilower: for costs, returns or waiting times; a fall is shown green.higher, lowerhigher
Stack the seriesOn or offOff
SortBy the first value field.none, descending, ascendingnone
At most rowsA number; may be a formula or variable1000
UnitShown on the value axis or the number, such as INR or %.Text; {{gv.X}}, {{ev.X}} or an = formula—
ColoursSutraFlow, Calm, BoldSutraFlow

Input tab

SettingWhat it doesValuesDefault
RowsA list of objects, such as the rows of an SQL query, a JSON list, or an object holding one (an API answer).Text; {{ }} references or an = formula{{input.rows}}
TitleText; {{ }} references or an = formulaRevenue by month
Compare with when Chart is kpiOptional: the value to compare with, such as last year's from another query. Empty with "latest" = the period before.Text; {{ }} references or an = formula—
Target when Chart is kpiOptional: a number; the card shows how far the value is.Text; {{ }} references or an = formula—
Page filtersApplied to the rows that have the filter's field. Rows an SQL query already filtered pass as they are. Empty = no filtering here.Text; {{ }} references or an = formula{{trigger.filters}}
Settings from a stepOptional: chart settings as JSON from an earlier step, such as an AI prompt asked to choose a chart ({"type": "line", "category": "month", "values": ["revenue"], "title": "..."}). Only known settings and fields of the rows are used; anything else is refused and logged, and the settings above are used instead. The data always comes from Rows.Text; {{ }} references or an = formula—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

✦Charts from AI

Palettes → Dashboards · activity type chartsFromAi

Plans the charts of a dashboard for rows of any shape (an API answer, a JSON file, a query): KPI cards, a trend, rankings, shares and a table. With an AI provider, the model chooses from the field names and kinds (and a few rows, when allowed) what to show; without one, built-in rules choose. Every chart passes the allow-list check, and the numbers are always worked out here from the rows, never by the model.

In scope
  • Plans the charts of a dashboard for rows of any shape: KPI cards, a trend, rankings, shares and a table.
  • With an AI provider the model chooses from the field names and kinds, and a few rows when allowed; without one, built-in rules choose.
  • Every chart passes the same allow-list check as Chart; the numbers are worked out from the rows, never by the model.
Out of scope
  • Answers or numbers from the model: only chart settings come from it.

When to use it

  • A first dashboard for an API or a file you do not know yet.
  • A section of suggested charts beside the ones you designed.

Procedure

  1. Set Rows (and List inside for an API answer).
  2. Optionally choose an AI provider and say what the dashboard should show; set Rows shown to the model to 0 to send only field names and kinds.
  3. Put {{nodes.<step>.charts}} in one row of Dashboard reply.

Output

  • charts, settings (the plan after the check), by (AI or built-in rules), problems and rows.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
AI providerEmpty = built-in rules, no model.A AI provider from Resources—
List insideWhen Rows is an object, the path of its list, such as data.items. Empty = its first list.Text; {{gv.X}}, {{ev.X}} or an = formula—
At most chartsA number; may be a formula or variable6
Rows shown to the model0 = only field names and kinds go to the model, never values.A number; may be a formula or variable5
ColoursSutraFlow, Calm, BoldSutraFlow
EffortUsed with an AI provider.low, medium, highlow

Input tab

SettingWhat it doesValuesDefault
RowsText; {{ }} references or an = formula{{input.rows}}
What should it showText; {{ }} references or an = formulaThe most important figures for a manager: totals, the trend over time,…
Page filtersApplied to the rows before the charts are made.Text; {{ }} references or an = formula{{trigger.filters}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

↵Dashboard reply

Palettes → Dashboards · activity type dashboardReply

Sends the charts to the dashboard page, in this order, with the choices of its filters. Use one at the end of every branch of a dashboard Sutra.

In scope
  • Sends the charts of a dashboard Sutra to its page, in the order given.
  • The choices of list filters, such as the rows of SELECT DISTINCT region.
  • An optional note shown under the title.
Out of scope

When to use it

  • The end of every branch of a dashboard Sutra.

Procedure

  1. One row per chart: a name for you, and {{nodes.<Chart step>.chart}}, or the list of a Charts from AI step.
  2. Optionally, per list filter, its choices.

Output

  • charts, choices, note and at (when the data was made).

Outputs (ports)

out error

Settings reference

Input tab

SettingWhat it doesValuesDefault
ChartsOne row per chart: a name for you, and the chart of a Chart step ({{nodes.<step>.chart}}), or the list of a Charts from AI step ({{nodes.<step>.charts}}).Rows of name and valueRevenue by month
Filter choicesOptional, per list filter: its field, and a list of choices, such as the rows of SELECT DISTINCT region FROM orders ({{nodes.Regions.rows}}: the first field of each row is used).Rows of name and value—
NoteOptional line under the title, such as where the data comes from.Text; {{ }} references or an = formula—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

General

✎Log

Palettes → General · activity type log

Writes a message to the run log and passes data through.

In scope
  • A message in the run log and the project log file, at a chosen level.
Out of scope

When to use it

  • Recording business events: received, processed, skipped.

Procedure

  1. Write the message with references and choose the level.

Output

  • The input, unchanged.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Levelinfo, warn, errorinfo

Input tab

SettingWhat it doesValuesDefault
MessageText; {{ }} references or an = formula{{input}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

☑Validate fields

Palettes → General · activity type validate

Checks required fields and an optional JSON Schema or XSD. Invalid input goes to the invalid branch with a list of problems.

In scope
  • Checking that required fields are present and not empty.
  • Optional JSON Schema/XSD validation using the same contracts as Map/Parse/Render, including types, patterns and formats.
Out of scope
  • Business rules not described by required paths or the selected schema.

When to use it

  • The first step after an API trigger, before any call.

Procedure

  1. List the required paths, for example params.id, or remove them for schema-only validation.
  2. Optionally select a JSON Schema or XSD and map Data to check. XSD accepts XML text or a root-wrapped XML object.
  3. Connect valid and invalid; invalid carries problems and data.

Output

  • valid: the input. invalid: the input and problems.

Outputs (ports)

valid invalid error

Settings reference

General tab

SettingWhat it doesValuesDefault
Required fieldsA list
SchemaOptional. JSON Schema checks structured data; XSD checks XML text or an XML-shaped object.A shared schema—

Input tab

SettingWhat it doesValuesDefault
Data to checkText; {{ }} references or an = formula{{input}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⇶Send to channel

Palettes → General · activity type channelPublish

Sends a message to an internal channel. Every deployed Sutra of this project with a Channel trigger on that channel starts with it. In memory, no broker needed; use the Service Bus for messages that must survive a restart.

In scope
  • In-memory messages between Sutras of the same project, with no broker.
  • Every deployed Sutra with a Channel trigger on the channel starts with the message.
Out of scope
  • Messages that must survive a restart or reach other servers: use Publish message.

When to use it

  • One Sutra telling others that something happened: an order arrived, a file was processed.

When to choose another activity

  • Call one process and wait for its result → use Call Sutra.

Procedure

  1. Set the channel name (not case-sensitive) and the message.
  2. Tick Fail when no Sutra listens if a listener must exist.

Output

  • channel, delivered (how many Sutras started) and their runIds.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
ChannelMay use {{gv.CHANNEL}}.Text; {{gv.X}}, {{ev.X}} or an = formulaorders
Message schemaA shared schema—
Strict message validationOn or offOff
Fail when no Sutra listensOn or offOff

Input tab

SettingWhat it doesValuesDefault
MessageText; {{ }} references or an = formula{{input}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

#Counter

Palettes → General · activity type counter

A named number kept by the server for this project: increment, decrement, read, set or reset it. Safe when many runs change it at once; kept across restarts.

In scope
  • A named number per project: increment, decrement, get, set, reset.
  • Kept across restarts; safe when many runs change it at once.
Out of scope
  • Counters shared between projects: use a database; Engine properties are administrator-managed and read-only to Sutras.

When to use it

  • Sequence numbers for file names, daily totals, limits such as "at most 100 orders per hour".

Procedure

  1. Set the counter name; a formula gives one counter per value, for example per day.
  2. Choose the operation and the amount. Everything is on the General tab: the counter takes no input, so its Input tab has nothing to map.
  3. Unlike a Local variable, the number stays after the run: test twice and it has grown. Sample: Counter, Wait and Sutra variables shows both side by side.

Output

  • name, value (after the change) and previous.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Counter nameMay use {{gv.X}}; a formula gives one counter per value, e.g. =concat('orders-', current-date()).Text; {{gv.X}}, {{ev.X}} or an = formulaorders
Operationincrement, decrement, get, set, resetincrement
By when Operation is increment or decrementA number; may be a formula or variable1
Value when Operation is setA number; may be a formula or variable0

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

AI

✦AI prompt

Palettes → AI · activity type aiPrompt

Sends instructions and mapped data to the AI provider and returns the text reply.

In scope
  • A prompt with references, an optional system prompt, and the effort level.
Out of scope
  • Decisions that need an audit trail without review: add Human approval.

When to use it

  • Summaries, drafts, translations.

Procedure

  1. Pick the AI provider (Resources).
  2. Write the prompt with references.

Output

  • text and usage.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
AI providerThe AI engine and model: Claude, Gemini, OpenAI, Ollama or a CLI. Set up under Resources.A AI provider from Resources—
InstructionsText; {{gv.X}}, {{ev.X}} or an = formulaYou are a concise assistant for an integration Sutra.
Effortlow, medium, highmedium

Input tab

SettingWhat it doesValuesDefault
PromptText; {{ }} references or an = formula{{input}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

◈AI classify

Palettes → AI · activity type aiClassify

The AI picks one label for the text. Each label is an output branch.

In scope
  • Choosing one of your labels for a text; one output per label.
Out of scope

When to use it

  • Routing emails and tickets by topic or urgency.

Procedure

  1. Pick the provider, set the text and list the labels.
  2. Connect each label's output.

Output

  • label and the reason.

Outputs (ports)

refund complaint question other error The outputs follow your settings; shown here with the defaults.

Settings reference

General tab

SettingWhat it doesValuesDefault
AI providerThe AI engine and model: Claude, Gemini, OpenAI, Ollama or a CLI. Set up under Resources.A AI provider from Resources—
Labels (comma separated)Text; {{gv.X}}, {{ev.X}} or an = formularefund, complaint, question
GuidanceText; {{gv.X}}, {{ev.X}} or an = formula—
Effortlow, medium, highmedium

Input tab

SettingWhat it doesValuesDefault
TextText; {{ }} references or an = formula{{input}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⑂AI router

Palettes → AI · activity type aiRouter

The AI reads the text and sends it down the route whose description fits best (or every route that fits). Nothing fits: otherwise.

In scope
  • Routes described in plain words; the AI sends the text down the best route, or every route that fits.
  • otherwise when nothing fits.
Out of scope
  • Rules that can be written as conditions: Router is faster, free and exact.

When to use it

  • Support mail and tickets that need a team: billing, technical, sales.

When to choose another activity

  • One label per text, a label per output → use AI classify.
  • Conditions on fields → use Router.

Procedure

  1. Pick the provider and set the text.
  2. Add one route per row: a name and a description of what belongs there. Each becomes an output.
  3. Choose best match or all matches, and connect otherwise.

Output

  • routes (the chosen routes), reason, and the original input.

Outputs (ports)

billing technical otherwise error The outputs follow your settings; shown here with the defaults.

Settings reference

General tab

SettingWhat it doesValuesDefault
AI providerThe AI engine and model: Claude, Gemini, OpenAI, Ollama or a CLI. Set up under Resources.A AI provider from Resources—
RoutesRoute name and a plain description of what belongs there.Rows of name and valuebilling, technical
Takebest match, all matchesbest match
Effortlow, medium, highmedium

Input tab

SettingWhat it doesValuesDefault
TextText; {{ }} references or an = formula{{input}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⌗AI extract

Palettes → AI · activity type aiExtract

Pulls structured fields out of free text (emails, documents). One field per row: name and description.

In scope
  • Pulling named fields out of free text.
Out of scope
  • Guaranteed accuracy: validate the result.

When to use it

  • Order details from emails, data from documents.

Procedure

  1. Pick the provider, set the text and list the fields with a short description each.

Output

  • One field per requested field.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
AI providerThe AI engine and model: Claude, Gemini, OpenAI, Ollama or a CLI. Set up under Resources.A AI provider from Resources—
FieldsRows of name and valueorderId, amount
Effortlow, medium, highmedium

Input tab

SettingWhat it doesValuesDefault
Source textText; {{ }} references or an = formula{{input}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

≡AI summarize

Palettes → AI · activity type aiSummarize

Shortens long text (emails, documents, tickets, logs) into a summary of the chosen length and style.

In scope
  • Paragraph, bullet points, one line, or key points and actions.
  • An approximate length, a language and a focus.
Out of scope
  • Very long documents beyond the model's context: split them first.

When to use it

  • Ticket and email summaries for people or dashboards; a one-line subject for a long message.

Procedure

  1. Pick the provider and set the text.
  2. Choose the style, the length and, optionally, the language and focus.

Output

  • summary, points (repeating) and words.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
AI providerThe AI engine and model: Claude, Gemini, OpenAI, Ollama or a CLI. Set up under Resources.A AI provider from Resources—
Styleparagraph, bullet points, one line, key points and actionsparagraph
Length (words, about)A number; may be a formula or variable120
LanguageFor example English, Hindi, French.Text; {{gv.X}}, {{ev.X}} or an = formulasame as the text
Focus onOptional, for example "customer requests and dates".Text; {{gv.X}}, {{ev.X}} or an = formula—
Effortlow, medium, highmedium

Input tab

SettingWhat it doesValuesDefault
TextText; {{ }} references or an = formula{{input}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

文AI translate

Palettes → AI · activity type aiTranslate

Translates text into the chosen language, keeping names, numbers and formatting; reports the language it came from.

In scope
  • Any language by name or code, with detection of the source language.
  • Tone, and terms that must stay untranslated (product names).
Out of scope
  • Certified or legal translation: have a person review it.

When to use it

  • Replies in the customer's language; partner messages in a single working language.

Procedure

  1. Pick the provider and set the text.
  2. Set Translate into, for example {{input.customer.lang}}.
  3. Optionally set the tone and the terms to keep.

Output

  • text, from (the detected language) and to.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
AI providerThe AI engine and model: Claude, Gemini, OpenAI, Ollama or a CLI. Set up under Resources.A AI provider from Resources—
Fromdetect, or the source language.Text; {{gv.X}}, {{ev.X}} or an = formuladetect
Toneas written, formal, informalas written
Keep these termsComma separated words that must not be translated, such as product names.Text; {{gv.X}}, {{ev.X}} or an = formula—
Effortlow, medium, highmedium

Input tab

SettingWhat it doesValuesDefault
TextText; {{ }} references or an = formula{{input}}
Translate intoA language name or code, for example Hindi, de, pt-BR, or {{input.lang}}.Text; {{ }} references or an = formulaEnglish

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

☺AI sentiment

Palettes → AI · activity type aiSentiment

Rates the feeling of a text (reviews, emails, chats): positive, neutral or negative, each its own output, with a score and the emotions found.

In scope
  • Positive, neutral or negative, each its own output, with a score from -1 to 1 and the emotions found.
  • Separate ratings for aspects such as delivery, price or support.
Out of scope
  • Sarcasm and mixed messages are rated less reliably; check the reason.

When to use it

  • Escalating unhappy customers, tracking review sentiment.

Procedure

  1. Pick the provider and set the text.
  2. Optionally list aspects to rate.
  3. Connect negative to an escalation, for example Send email or Human approval.

Output

  • sentiment, score, emotions, aspects, reason, and the original input.

Outputs (ports)

positive neutral negative error

Settings reference

General tab

SettingWhat it doesValuesDefault
AI providerThe AI engine and model: Claude, Gemini, OpenAI, Ollama or a CLI. Set up under Resources.A AI provider from Resources—
Also rateOptional, comma separated, for example delivery, price, support.Text; {{gv.X}}, {{ev.X}} or an = formula—
Effortlow, medium, highmedium

Input tab

SettingWhat it doesValuesDefault
TextText; {{ }} references or an = formula{{input}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

◉Ollama

Palettes → AI · activity type ollama

Calls an Ollama endpoint: generate, chat, embed (vectors for search), list or show models, running models, pull, copy or delete a model, version. Works offline against a local Ollama.

In scope
  • Every Ollama endpoint: generate, chat, embed, list models, running models, show model, pull, copy and delete a model, version.
  • Images for vision models, JSON or schema-shaped replies, model options (temperature, context size), keep-alive, thinking.
  • A local Ollama with no internet connection.
Out of scope
  • Other engines: use AI prompt and the other AI activities, which work with every engine.

When to use it

  • Embeddings for search and matching; managing models from a Sutra; Ollama features the general AI activities do not expose.

When to choose another activity

  • A prompt that works with any engine → use AI prompt.

Procedure

  1. Pick an AI provider connection whose engine is Ollama.
  2. Choose the endpoint.
  3. Fill in the model (leave empty for the model of the connection) and the fields for that endpoint.

Output

  • Ollama's answer as it gives it. Generate and chat add text; generate, chat and embed add ai with the model, tokens and time.
Guidelines
  • The first call after Ollama starts loads the model and takes longer; set Keep loaded for to keep it ready.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
AI provider (Ollama)An AI provider connection with engine Ollama; its address and model are used.A AI provider from Resources—
Endpointgenerate, chat, embed, list models, running models, show model, pull model, copy model, delete model, versiongenerate
Model when Endpoint is generate or chat or embed or show model or pull model or copy model or delete modelEmpty = the connection's model.Text; {{gv.X}}, {{ev.X}} or an = formula—
New name when Endpoint is copy modelText; {{gv.X}}, {{ev.X}} or an = formula—
Reply format when Endpoint is generate or chatEmpty, json, or a JSON schema the reply must follow.Text; {{gv.X}}, {{ev.X}} or an = formula—
Options when Endpoint is generate or chat or embedModel options such as temperature 0.2, num_ctx 8192, num_predict 512, seed 42.Rows of name and value—
Keep loaded for when Endpoint is generate or chat or embede.g. 5m or 1h; 0 unloads at once.Text; {{gv.X}}, {{ev.X}} or an = formula—
Thinking (models that support it) when Endpoint is generate or chatOn or offOff

Input tab

SettingWhat it doesValuesDefault
System when Endpoint is generate or chatText; {{ }} references or an = formula—
Prompt when Endpoint is generate or chatText; {{ }} references or an = formula{{input}}
Messages (optional) when Endpoint is chatA list of { role, content } for a whole conversation; replaces System and Prompt.Text; {{ }} references or an = formula—
Text to embed when Endpoint is embedOne text or a list of texts.Text; {{ }} references or an = formula{{input.text}}
Images (base64) when Endpoint is generate or chatFor vision models: a list of base64 images, e.g. {{nodes.Read file.base64}}.Text; {{ }} references or an = formula—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

✺AI agent

Palettes → AI · activity type aiAgent

Works towards a goal in steps: thinks, picks a tool, uses it, looks at the result, until it can answer. Tools are Sutras with an AI tool trigger, a knowledge base and the tools of an MCP server. Keeps the conversation in an AI memory store. Waits for tool Sutras without holding a worker, and never repeats a finished tool after a restart.

In scope
  • A goal or a message worked on in steps: the model thinks, picks a tool, uses it, reads the result, and repeats until it can answer.
  • Tools: Sutras that start with AI tool, the knowledge base (search_knowledge), and the tools of an MCP client connection.
  • Memory per session in an AI memory store, fitted to the context window; passages from a knowledge base before the first step.
  • Limits on steps, tokens and time; outputs done, needs a person and limit reached.
Out of scope
  • Decisions that must always go one way, such as refunds: route them with If / else before the agent; small models do not reliably choose to ask.
  • Streaming the answer word by word.

When to use it

  • An order desk, a support assistant, an internal helper that looks things up in several systems.

When to choose another activity

Procedure

  1. Pick the AI provider and write the instructions: who the agent is, what it may do, the tone.
  2. Set the message (usually {{input.message}}) and, for conversations, an AI memory store and the session id.
  3. Choose the tools: all AI tools of the project, chosen ones, or none; add a knowledge base or an MCP client.
  4. Set the limits, and connect needs a person to Ask a person and limit reached to a reply.

Output

  • answer (done), question (needs a person) or reason (limit reached); steps with each tool, input, result or error; toolCalls, tokens, session and ai.
Guidelines
  • A tool Sutra runs as a called Sutra: the agent waits without holding a worker, and after a restart it continues without running a finished tool again.
  • Messages of one session are handled one at a time, in arrival order; other sessions run alongside.
  • Small local models (phi4-mini) handle look-ups well; give them few tools and clear instructions.

Outputs (ports)

done needs a person limit reached error

Settings reference

General tab

SettingWhat it doesValuesDefault
AI providerThe model that thinks: Claude, Gemini, OpenAI, Ollama or a CLI.A AI provider from Resources—
AI memory storeWhere the conversation is kept between runs. Empty = no memory: each run starts fresh.A AI memory store from Resources—
ToolsAI tools are Sutras that start with the AI tool trigger. Test runs use drafts; deployed runs use deployed tools.all AI tools of this project, chosen tools, noneall AI tools of this project
Tool names when Tools is chosen toolsComma separated, as in each AI tool trigger.Text; {{gv.X}}, {{ev.X}} or an = formula—
Knowledge baseAdds the tool search_knowledge.A Knowledge base (RAG) from Resources—
Passages fetched before the first stepSearches the knowledge base with the message first and gives the agent this many passages (up to a quarter of the context window). 0 = only when the agent searches.A number; may be a formula or variable0
MCP client (outside tools)Adds the tools of another MCP server.A MCP client (outside tools) from Resources—
May ask a personThe agent may stop with a question (output "needs a person"). Connect it to Ask a person.On or offOn
Answer astext, JSONtext
Maximum stepsModel calls in this run. Each tool use takes one.A number; may be a formula or variable8
Maximum tokensTokens of all model calls in this run together.A number; may be a formula or variable60000
Maximum time (seconds)A number; may be a formula or variable600
Context window without memory (tokens)With a memory store, its context window is used.A number; may be a formula or variable8000
Keep tool results in memoryLater runs of the session see which tools were used and what they returned.On or offOn
Effortlow, medium, highmedium

Input tab

SettingWhat it doesValuesDefault
InstructionsWho the agent is, what it may do, and the tone. The tool list and the reply format are added for you.Text; {{ }} references or an = formulaYou are the order desk assistant of Asha Traders. Answer questions abo…
Message or goalWhat the user said, or the goal for this run.Text; {{ }} references or an = formula{{input.message}}
Session idOne id per conversation: a chat, ticket, email thread or customer id. Runs with the same id share the memory, one at a time.Text; {{ }} references or an = formula{{input.sessionId}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

☏Ask a person

Palettes → AI · activity type askPerson

Waits for a person to answer a question, in the Approval Center (/approvals), for minutes or days, without holding a worker. The answer goes on, for example back to the agent with the same session.

In scope
  • A question to a person, answered in writing in the Approval Center; outputs answered and declined.
  • Who can answer by role and account, details, a due time, reminders and email notices, as on Human approval.
  • Waits as saved state, minutes or days, costing nothing.
Out of scope

When to use it

  • Refunds, exceptions and anything the agent may not decide.

Procedure

  1. Write the question, usually {{input.question}} from the agent.
  2. Optionally name who should answer.
  3. Connect answered to the reply or back to the agent with the same session.

Output

  • answer, and approval with who answered and when.

Outputs (ports)

answered declined error

Settings reference

General tab

SettingWhat it doesValuesDefault
Who can answer: rolesRole names or ids. Empty with no accounts = anyone with the Approve permission on the project.A list—
Due in (hours)A number; may be a formula or variable0
Remind every (hours)A number; may be a formula or variable0
Email throughA Email (SMTP) from Resources—
Who should answer (shown only)Text; {{gv.X}}, {{ev.X}} or an = formula—

Input tab

SettingWhat it doesValuesDefault
QuestionText; {{ }} references or an = formula{{input.question}}
Who can answer: accountsA list—
Details for the personRows of name and value—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⇢Hand off to agent

Palettes → AI · activity type agentHandoff

Passes the conversation to another agent Sutra (one that starts with an Agent channel trigger) with the same session, and continues with its answer. For a supervisor agent with specialists.

In scope
  • Passing a conversation to another agent Sutra (one with an Agent channel trigger), with the same session and an optional note.
  • Draft or deployed version, as for Call Sutra.
Out of scope

When to use it

  • A supervisor agent with specialists: orders, policies, billing.

Procedure

  1. Choose the agent Sutra.
  2. Set the message, the session id and, when useful, a note on why it is handed over.

Output

  • What the other agent replied: answer, status and sessionId.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Agent SutraText; {{gv.X}}, {{ev.X}} or an = formula—
Versiondeployed (draft while testing), deployed, draftdeployed (draft while testing)

Input tab

SettingWhat it doesValuesDefault
MessageText; {{ }} references or an = formula{{input.message}}
Session idText; {{ }} references or an = formula{{input.sessionId}}
Note for the agent (optional)Why it is handed over, for example "The customer asks for a refund".Text; {{ }} references or an = formula—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⟲Load memory

Palettes → AI · activity type memoryLoad

Reads a session from an AI memory store, trimmed to the context window: the running summary and the newest turns. Use it to build your own prompts; the AI agent loads memory by itself.

In scope
  • A session from an AI memory store: the running summary and the newest turns that fit a token budget.
Out of scope
  • The AI agent: it loads memory by itself.

When to use it

  • Your own prompts with history, in AI prompt or a custom code step.

Procedure

  1. Pick the memory store and set the session id.
  2. Optionally set the token budget; 0 uses the store context window.

Output

  • summary, turns (repeating), text ready for a prompt, tokens, leftOut and total. No turns goes to empty.

Outputs (ports)

out empty error

Settings reference

General tab

SettingWhat it doesValuesDefault
AI memory storeThe store to read.A AI memory store from Resources—
Tokens for the history0 = the context window of the store minus the answer.A number; may be a formula or variable0

Input tab

SettingWhat it doesValuesDefault
Session idOne id per conversation: a chat, ticket, email thread or customer id. Runs with the same id share the memory, one at a time.Text; {{ }} references or an = formula{{input.sessionId}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⟳Save memory

Palettes → AI · activity type memorySave

Adds turns to a session, with their token counts. When the history no longer fits the context window, the oldest turns are folded into the running summary.

In scope
  • Adding turns (user, assistant, tool, system) to a session; old turns are folded into the summary when the history no longer fits.
Out of scope
  • The AI agent: it saves its own turns.

When to use it

  • Keeping history for conversations you run with AI prompt.

Procedure

  1. Pick the store and the session id.
  2. Add one row per turn: the role and the text.
  3. Optionally choose a provider for the summary.

Output

  • saved, compacted and summary.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
AI memory storeThe store to write.A AI memory store from Resources—
AI provider for the summaryEmpty = the one set in the memory store; with neither, old turns are only left out.A AI provider from Resources—

Input tab

SettingWhat it doesValuesDefault
Session idOne id per conversation: a chat, ticket, email thread or customer id. Runs with the same id share the memory, one at a time.Text; {{ }} references or an = formula{{input.sessionId}}
TurnsOne row per turn: role (user, assistant, tool or system) and text.Rows of name and valueuser, assistant

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⌫Clear memory

Palettes → AI · activity type memoryClear

Forgets one session (for example on a privacy request), or every turn older than the days to keep of the store.

In scope
  • Forgetting one session, or every turn older than the days to keep of the store.
Out of scope

When to use it

  • Privacy requests; a nightly clean-up with a Timer.

Procedure

  1. Pick the store, choose what to clear, and for one session set its id.

Output

  • cleared and turns.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
AI memory storeThe store to clear.A AI memory store from Resources—
Clearone session, older than the days to keepone session

Input tab

SettingWhat it doesValuesDefault
Session id when Clear is one sessionOne id per conversation: a chat, ticket, email thread or customer id. Runs with the same id share the memory, one at a time.Text; {{ }} references or an = formula{{input.sessionId}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⊕Add to knowledge

Palettes → AI · activity type knowledgeAdd

Adds a document to a knowledge base: splits it into passages, makes their vectors and stores them with the source name and details. Adding the same source again replaces it. Feed it from any palette: files, SFTP, SharePoint, Google Drive, a database, a web page.

In scope
  • Splitting a document into passages, making their vectors and storing them with the source name and details.
  • Adding a source again replaces it.
Out of scope

When to use it

  • Filling a knowledge base from SharePoint, web pages, files, SFTP or a database.

Procedure

  1. Pick the knowledge base.
  2. Set the source name (file path or address) and the text.
  3. Add details to filter by later, for example department or groups.

Output

  • source, chunks, tokens, replaced and model.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Knowledge baseA Knowledge base (RAG) from Resources—
Same text as beforeskip: when the source already holds exactly this text and details, nothing is done (no new vectors). For feeds that read a whole folder on a timer.add again, skipadd again

Input tab

SettingWhat it doesValuesDefault
Source nameFile name, address or document id. Used to replace or remove it later and shown as the citation.Text; {{ }} references or an = formula{{input.name}}
TextText; {{ }} references or an = formula{{input.text}}
DetailsStored with every passage and usable as search filters, for example department = sales or groups = finance.Rows of name and value—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

Read document text

Palettes → AI · activity type docText

Takes the text out of a document for a knowledge base or an AI step: PDF, Word, PowerPoint, Excel, OpenDocument, HTML pages and text files. The document comes from an earlier step (Read file, SFTP, SharePoint, Google Drive, Dropbox: as base64) or from a web address.

In scope
  • Text out of PDF, Word, PowerPoint, Excel, OpenDocument, HTML pages and text files.
  • The document from an earlier step (as base64) or from a web address.
Out of scope
  • Scanned PDFs without a text layer: they need text recognition first.
  • Pages that build their text with JavaScript.

When to use it

Procedure

  1. Choose where the document comes from.
  2. Leave Type on auto, or choose it.

Output

  • text, type, title, pages, name, url, chars and tokens.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Document fromearlier step, web addressearlier step
Content is when Document from is earlier stepbase64, textbase64
Typeauto, pdf, docx, pptx, xlsx, odt, html, textauto
Maximum size (MB)A number; may be a formula or variable25

Input tab

SettingWhat it doesValuesDefault
Content when Document from is earlier stepText; {{ }} references or an = formula{{input.content}}
File name when Document from is earlier stepIts extension tells the type when Type is auto.Text; {{ }} references or an = formula{{input.name}}
Web address when Document from is web addressText; {{ }} references or an = formulahttps://www.example.com/returns

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⌕Search knowledge

Palettes → AI · activity type knowledgeSearch

Finds the passages of a knowledge base closest to a question, by meaning and by shared words, best first, with their sources. Filter by source or details (for example only what the user may see).

In scope
  • The passages closest to a question, by meaning and by shared words, best first, with their sources.
  • Filters by source, folder of sources, or details.
Out of scope

When to use it

  • Showing sources to a person; building your own prompt.

Procedure

  1. Pick the knowledge base and set the question.
  2. Set how many passages and, when needed, filters.

Output

  • hits (repeating: text, source, chunk, score, details), count and context ready for a prompt. Nothing found goes to empty.

Outputs (ports)

out empty error

Settings reference

General tab

SettingWhat it doesValuesDefault
Knowledge baseA Knowledge base (RAG) from Resources—
PassagesA number; may be a formula or variable5
Minimum score (0 to 1)A number; may be a formula or variable0.05

Input tab

SettingWhat it doesValuesDefault
QuestionText; {{ }} references or an = formula{{input.message}}
Only from sourceA source name or a folder of sources.Text; {{ }} references or an = formula—
Only with detailsRows of name and value—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⁇Ask knowledge

Palettes → AI · activity type knowledgeAsk

Answers a question from a knowledge base only (retrieval-augmented generation): finds the closest passages and has the model answer from them, with the sources it used. No passages, or no answer in them, goes to "not found".

In scope
  • An answer from the knowledge base only, with the sources it used.
  • not found when no passage answers the question.
Out of scope
  • Questions that need tools or several steps: use AI agent with the knowledge base.

When to use it

  • A policy assistant; answers from manuals and terms.

Procedure

  1. Pick the AI provider and the knowledge base.
  2. Set the question, the number of passages and, optionally, filters by details.

Output

  • answer with [source#n] citations, sources, found, hits and ai.

Outputs (ports)

out not found error

Settings reference

General tab

SettingWhat it doesValuesDefault
AI providerThe model that thinks: Claude, Gemini, OpenAI, Ollama or a CLI.A AI provider from Resources—
Knowledge baseA Knowledge base (RAG) from Resources—
PassagesA number; may be a formula or variable5
Effortlow, medium, highlow

Input tab

SettingWhat it doesValuesDefault
QuestionText; {{ }} references or an = formula{{input.message}}
InstructionsText; {{ }} references or an = formulaAnswer briefly in the language of the question.
Only with detailsRows of name and value—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⊖Remove knowledge

Palettes → AI · activity type knowledgeRemove

Removes a source (or a folder of sources) from a knowledge base, everything, the sources not in a list (files deleted from a folder a feed reads), or makes every vector again after the vector model changed.

In scope
  • Removing a source or a folder of sources, everything, or making every vector again after the vector model changed.
Out of scope

When to use it

  • A file deleted in SharePoint; a new vector model.

Procedure

  1. Pick the knowledge base and the action; for a source, set its name.

Output

  • removed; for rebuild, chunks and model.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Knowledge baseA Knowledge base (RAG) from Resources—
ActionBuild search index (pgvector): makes the HNSW index of a table that already holds passages, so searches stay fast as it grows; new tables get it at once. Give the step a longer timeout for a large table.remove a source, keep only these sources, remove everything, rebuild vectors, build search indexremove a source

Input tab

SettingWhat it doesValuesDefault
Source name when Action is remove a sourceText; {{ }} references or an = formula{{input.name}}
Sources to keep when Action is keep only these sourcesA list of source names, or of files (their relativePath, else name, is the source). Every other source is removed.Text; {{ }} references or an = formula{{input.items}}
Only in the folder of sources when Action is keep only these sourcesEmpty = the whole knowledge base.Text; {{ }} references or an = formula—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⋮AI embed

Palettes → AI · activity type aiEmbed

Turns texts into vectors (embeddings), for your own similarity checks or vector stores.

In scope
  • Vectors (embeddings) for one text or a list, from the knowledge base settings or an AI provider.
Out of scope
  • Storing and searching them: knowledge bases do that for you.

When to use it

  • Your own similarity checks, duplicates, or another vector store.

Procedure

  1. Choose where the vectors come from, and set the texts.

Output

  • vectors, dimensions and model.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Vectors fromknowledge base settings, AI providerknowledge base settings
Knowledge base when Vectors from is knowledge base settingsA Knowledge base (RAG) from Resources—
AI provider when Vectors from is AI providerThe model that thinks: Claude, Gemini, OpenAI, Ollama or a CLI.A AI provider from Resources—
Vector model when Vectors from is AI providerText; {{gv.X}}, {{ev.X}} or an = formulanomic-embed-text

Input tab

SettingWhat it doesValuesDefault
Text or list of textsText; {{ }} references or an = formula{{input.text}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⧉Call MCP tool

Palettes → AI · activity type mcpCall

Lists the tools of another MCP server, or calls one with arguments: a file system, GitHub, a database, a search engine, another SutraFlow. The tool reporting an error goes to "tool error".

In scope
  • Listing the tools of another MCP server, or calling one with arguments, over HTTP or a command started on this server.
Out of scope
  • Giving the tools to an AI agent: set the MCP client on the agent instead.

When to use it

  • A file system, GitHub, a database or search engine that has an MCP server; another SutraFlow.

Procedure

  1. Create an MCP client connection under Resources.
  2. Use list tools once to see the names, then call a tool with its arguments as JSON.

Output

  • result, text and isError; for list, tools. A tool error goes to tool error.

Outputs (ports)

out tool error error

Settings reference

General tab

SettingWhat it doesValuesDefault
MCP clientA MCP client (outside tools) from Resources—
Actioncall a tool, list toolscall a tool
Tool name when Action is call a toolUse "list tools" in a test run to see the names.Text; {{gv.X}}, {{ev.X}} or an = formula—

Input tab

SettingWhat it doesValuesDefault
Arguments (JSON) when Action is call a toolCode or JSON{ "path": "{{input.path}}" }

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

☄Agent channel

Palettes → AI · activity type agentChannel · trigger

Publishes the Sutra as an agent while it is deployed, at several entry points at once: a chat page and chat API, an OpenAI-compatible API (model = agent name), a tool on an MCP server (Claude, ChatGPT, Copilot, Antigravity, Cursor) and an A2A agent. Every message arrives the same way; answer with Agent reply.

In scope
  • Publishing the Sutra as an agent while it is deployed, at several entry points: chat page and chat API (with a chat button for any web page), OpenAI-compatible API, a tool on an MCP server, and A2A.
  • A security policy per entry point, and an answer time after which callers get a job id.
Out of scope
  • Messaging apps (Slack, Teams, WhatsApp): use their webhooks with a REST service that hands off to the agent.

When to use it

  • An agent people chat with on your site, that Claude, ChatGPT, Copilot or Antigravity call as a tool, and that other agents call over A2A.

Procedure

  1. Give the agent a name (it becomes the addresses) and a description.
  2. Tick the entry points and set who may use each.
  3. Build the work, usually AI guard then AI agent, and end every branch with Agent reply.
  4. Deploy. The Designer's Services page lists the addresses.

Output

  • message, sessionId, channel (chat, openai, mcp, a2a, handoff, test), caller and history.
Guidelines
  • Callers without a security policy are visitors: each gets a signed visitor token in the X-Sutra-Visitor response header (and as visitor in the chat API answer). Sending it back keeps the visitor’s conversation, memory and jobs; without it, or with a token this server did not sign, the caller is a new visitor. The chat page and chat button keep the token in the browser by themselves. An API client without a policy sends the header back (an OpenAI SDK as a default header); for integrations, a security policy (API key or token) is the better choice. caller shows the visitor as visitor:<id>, and Traceability shows it under Started by.

Outputs (ports)

out

Settings reference

General tab

SettingWhat it doesValuesDefault
Agent nameLetters, digits and -. The chat page is /chat/<name>, the OpenAI model name <name>, the MCP tool ask_<name>, the A2A agent /a2a/<name>.Text; {{gv.X}}, {{ev.X}} or an = formulaorder-desk
TitleText; {{gv.X}}, {{ev.X}} or an = formulaOrder desk
What it does (for people and other AIs)Text; {{gv.X}}, {{ev.X}} or an = formulaAnswers questions about orders and stock, and hands refund requests to…
Chat page and chat APIOn or offOn
Who may chat when Chat page and chat API is onEmpty = anyone who reaches the gateway; set a policy with a rate limit for a public page.A API security policy from Resources—
OpenAI-compatible APIOn or offOff
Who may use the API when OpenAI-compatible API is onA API security policy from Resources—
Tool on an MCP serverOn or offOff
MCP server when Tool on an MCP server is onEmpty = the default address /mcp. The tool is ask_<agent name>.A MCP server (AI skills) from Resources—
Agent-to-agent (A2A)On or offOff
Who may call it when Agent-to-agent (A2A) is onA API security policy from Resources—
Answer within (seconds)Callers wait this long for the answer. Longer work answers "working" with a job id; the caller asks again for the result.A number; may be a formula or variable50
Conversation lasts (hours)Every answer carries a signed conversation token; the caller sends it back to continue. A token continues the conversation only for the caller who started it, and only for this long after it began; then the next message starts a new conversation. Administrators clear expired conversations and their memory in Admin Console, Agent conversations.A number; may be a formula or variable24
Test message (JSON)Code or JSON{ "message": "Where is order A-1001?", "sessionId": "test-1" }

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

↵Agent reply

Palettes → AI · activity type agentReply

Sends the answer of a published agent back through the entry point the message came in: chat, OpenAI-compatible API, MCP or A2A. Use one on every branch.

In scope
  • The answer of a published agent, sent back in the format of the entry point it came in by.
  • Status answer, needs a person or error.
Out of scope

When to use it

  • The end of every branch of an agent Sutra.

Procedure

  1. Set the answer, usually {{input.answer}}, the status and the session id.

Output

  • answer, status and sessionId.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Status"needs a person": the caller is told someone will follow up. "error": the caller sees it as a failed request.answer, needs a person, erroranswer

Input tab

SettingWhat it doesValuesDefault
AnswerText; {{ }} references or an = formula{{input.answer}}
Session idText; {{ }} references or an = formula{{trigger.sessionId}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

⛉AI guard

Palettes → AI · activity type aiGuard

Checks text before it goes to a model or out to a person: hides personal data, catches instructions hidden in text an agent reads (prompt injection), blocks topics, scores moderation categories, tells the language (and can translate), and checks length or JSON shape. Optionally asks a model as well. Can also keep answers to repeated questions, per Sutra and per person: a question asked before leaves by the cached port with its answer.

In scope
  • Hiding personal data (emails, phone numbers, cards, IBAN, Aadhaar, PAN), catching hidden instructions, blocking topics, checking length and JSON shape.
  • Optionally a model as a second opinion.
Out of scope
  • A full content moderation service.

When to use it

  • Before an agent reads what a customer or a web page wrote; before an answer goes out.

Procedure

  1. Set the text and tick the checks.
  2. List blocked topics, one per line.
  3. Connect pass to the work and blocked to a polite reply.

Output

  • text with personal data hidden, original, hidden, findings and reason.

Outputs (ports)

pass blocked cached error

Settings reference

General tab

SettingWhat it doesValuesDefault
ChecksHidden personal data is replaced by [EMAIL], [PHONE], [CARD] and so on; the text goes on hidden.A list, ,
Blocked topicsOne per line: words or phrases. Project properties may supply the list for each environment.Text; {{gv.X}}, {{ev.X}} or an = formulamedical advice legal advice weapons
Maximum length (characters)A number; may be a formula or variable8000
Must match schemaFor model answers that must be JSON of this shape.A shared schema (json)—
Moderation thresholds when Checks is moderationOne row per category (hate, harassment, self-harm, sexual, violence, illegal activity) with a threshold from 0 to 1; a score at or above it blocks. Remove a row or set 0 to skip that category.Rows of name and valuehate, harassment, self-harm, sexual, violence, illegal activity
Warn only when Checks is moderationCategories that only warn: the text goes on, the warning is in warnings and in the run log.A list—
Translate to when Checks is languageLanguage code such as en. Text in another language is translated with the model in Also ask a model. Empty = only tell the language.Text; {{gv.X}}, {{ev.X}} or an = formula—
Also ask a modelA second opinion on hidden instructions, topics and moderation, and the model that translates. Empty = rules only.A AI provider from Resources—
Answer cacheLook up: the text is the question; one asked before leaves by the cached port with answer. Store: the text is the answer to Question. Use one guard of each kind in the Sutra.off, look up the question, store the answeroff
Cache for when Answer cache is look up the question or store the answerEach person: an answer is only given back to the person who asked; callers who are not identified get no cache. Everyone: only for answers that hold no personal data.each person, everyoneeach person
Keep for (minutes) when Answer cache is store the answerA number; may be a formula or variable60

Input tab

SettingWhat it doesValuesDefault
TextText; {{ }} references or an = formula{{input.message}}
Question when Answer cache is store the answerThe question this answer belongs to.Text; {{ }} references or an = formula{{trigger.message}}
Person when Cache for is each personWho is asking, as the entry point identified them.Text; {{ }} references or an = formula{{trigger.caller}}

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

✧AI tool

Palettes → AI · activity type mcpTool · trigger

Makes the Sutra a tool: the AI agents of this project can use it, and, while deployed, AI assistants such as Claude can call it over the Model Context Protocol at the gateway address /mcp. Describe what it does and what it needs; end the Sutra with Reply to AI.

In scope
  • Making a Sutra a tool: the AI agents of this project use it, and AI assistants such as Claude call it over the Model Context Protocol while it is deployed.
  • A name, a title and a description the AI reads; inputs as rows or a JSON schema; an optional result schema.
  • An MCP server to group skills under one address, and an API security policy.
Out of scope
  • Calling other MCP servers from a Sutra: use Call MCP tool.
  • Streaming partial results.

When to use it

  • Letting an assistant do real work through your Sutras: write a CSV file, post to a Facebook page, look up an order, raise a ticket.

When to choose another activity

  • Expose the Sutra to programs instead of AI assistants → use REST service.

Procedure

  1. Create an MCP server under Resources (address such as /mcp/orders, instructions, security policy), or leave the server empty to use /mcp.
  2. Drag AI tool (AI palette) onto a new Sutra and choose the server.
  3. Give a tool name and a description that says what it does, when to use it and what it returns.
  4. List the inputs: one row each, with a description; start it with number:, array: and so on for other types, and optional: when it may be left out.
  5. Tick Changes data when it creates, changes or deletes something.
  6. End every branch with Reply to AI, and Deploy.

Output

  • arguments (what the AI sent), tool, auth (the caller after the policy check) and client.
Guidelines
  • The description is what the AI chooses by: write it for a person who has never seen the Sutra.
  • A skill that changes data should be confirmed by the user; assistants do so when Changes data is ticked.

Outputs (ports)

out

Settings reference

General tab

SettingWhat it doesValuesDefault
MCP serverThe set of skills this tool belongs to (Resources > MCP server). Empty = the gateway's default address /mcp.A MCP server (AI skills) from Resources—
Tool nameLetters, digits, _ and -. The AI sees and calls it by this name; unique on this server.Text; {{gv.X}}, {{ev.X}} or an = formulacheck_order_status
TitleText; {{gv.X}}, {{ev.X}} or an = formulaCheck order status
What it does (for the AI)The skill as the AI reads it: what the tool does, when to use it, what it returns. A clear description is what makes the AI choose it correctly.Text; {{gv.X}}, {{ev.X}} or an = formulaLooks up an order by its number and returns its status, delivery date …
InputsOne row per input: name and description. Start the description with number:, integer:, boolean:, array: or object: for other types, and with optional: when it may be left out.Rows of name and valueorderId
Input schema (instead of the rows)Optional. A shared JSON schema for richer inputs.A shared schema (json)—
Result schemaOptional. Tells the AI the shape of the result.A shared schema (json)—
Strict tool input validationOn enforces the selected Input schema before a run is created and during execution. Off leaves it descriptive.On or offOff
Strict successful result validationOn enforces Result schema before any successful reply leaves this Sutra. Explicit isError replies use the error contract instead; they are not success results.On or offOff
AI agents of this project may use itUnticked: only AI assistants over MCP (when deployed).On or offOn
Changes data (not read-only)Tick when the tool creates, changes or deletes something; assistants then ask the user before calling it.On or offOff
API security policyWho may call it: an API key, bearer token (JWT) or Basic, sent by the AI assistant as a header. Empty = the MCP server's policy; with neither, anyone who reaches the gateway.A API security policy from Resources—
Test arguments (JSON)Code or JSON{ "orderId": "A-1001" }

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

↵Reply to AI

Palettes → AI · activity type mcpReply

Sends the outcome back to the AI agent or assistant that called this Sutra through its AI tool trigger. Use one on every branch, including error branches (tick "Is an error" there).

In scope
  • Sending the outcome back to the AI: text, or data (sent as JSON and as structured content).
  • Marking the outcome as an error, so the AI can explain it or try something else.
Out of scope
  • Sutras not started by AI tool: there it does nothing.

When to use it

  • The end of every branch of a skill, including error branches.

Procedure

  1. Set the result: a value such as {{input}} or =object('path', {input.path}), or a mapping to a result schema.
  2. On error branches, tick Is an error and write what went wrong.

Output

  • result and isError.

Outputs (ports)

out error

Settings reference

General tab

SettingWhat it doesValuesDefault
Result fromvalue, mappingvalue
Result schemaA shared schema (json)—
Strict result validationOn checks the completed Result in either value or mapping mode before replying, including explicit error results.On or offOff
Is an errorTells the AI the tool did not succeed, so it can explain or try something else.On or offOff

Input tab

SettingWhat it doesValuesDefault
Result when Result from is valueText, or data (sent as JSON and as structured content).Text; {{ }} references or an = formula{{input}}
Result when Result from is mappingMapped in the Input tab—

Also has the Settings tab every activity shares: retries, timeout, skip and breakpoint.

51. Connection and security reference

Shared resources are created under Project → Resources. Settings that hold a secret take the name of a vault secret. Any text setting may use {{gv.X}} and {{ev.X}}, and the deployment config can override every setting per environment.

HTTP connection

Project → Resources · kind httpConnection

Base URL, timeouts and TLS for calling an API or SOAP endpoint: trusted CA, client certificate (mutual TLS) and proxy.

Settings

SettingWhat it doesValuesDefault
Base URLSteps may use a path such as /orders; it is joined to this URL.Text; {{gv.X}}, {{ev.X}} or an = formula—
Timeout (ms)A number; may be a formula or variable30000
Default headersRows of name and value—
Verify server certificateTurn off only for test servers with self-signed certificates.On or offOn
CA certificateA file on the server (C:\certs\ca.pem, or {{ev.CERTS}}\ca.pem), a Certificate property ({{gv.CA}}), or the PEM text. Empty uses the operating system trust store. Renew by replacing the file or changing the property.Code or JSON—
Client certificateA file on the server, a Certificate property ({{gv.CLIENT_CERT}}), or the PEM text.Code or JSON—
Client private keyA Private key or Secret property, or a key file on the server readable only by the SutraFlow account.The name of a vault secret—
Private key passphraseThe name of a vault secret—
Proxy URLText; {{gv.X}}, {{ev.X}} or an = formula—
Open the circuit after (failures in a row)0 = off. After this many errors or 5xx replies in a row, calls fail at once instead of waiting.A number; may be a formula or variable0
Keep it open for (seconds)Then one trial call: success closes the circuit, failure opens it again.A number; may be a formula or variable30
Maximum concurrent activities (0 = unlimited)How much work may use this connection at once, across all engines: Sutra steps that select it (or a connection that uses it, such as a knowledge base or AI memory), plus listener polls and scheduled refreshes. One step counts once, however many requests it makes. Excess steps wait in the queue (no retry used, no worker held, timeout not started); a poll with no room is skipped. A Project property such as {{gv.CRM_LIMIT}} can set it per server. Not a pool size or a rate limit; in-memory Sutras cannot use a limited connection. Admin Console: Connection limits.A number; may be a formula or variable0

Outbound security connection

Project → Resources · kind outboundAuth

How a call proves who it is: Basic, Bearer, API key, OAuth 2.0 client credentials, or WS-Security (UsernameToken, SAML token, X.509 signature) for SOAP.

Settings

SettingWhat it doesValuesDefault
Methodnone, basic, bearer, apiKey, oauth2ClientCredentials, hmac, wssUsernameToken, wssSaml, wssX509, customHeadersbasic
Signing secret when Method is hmacThe secret shared with the receiver.The name of a vault secret—
Signature header when Method is hmacText; {{gv.X}}, {{ev.X}} or an = formulaX-Signature
Timestamp header when Method is hmacUnix seconds. Not used when only the body is signed.Text; {{gv.X}}, {{ev.X}} or an = formulaX-Timestamp
What is signed when Method is hmactimestamp and body: the timestamp, a dot, then the body. method, path, timestamp and body: each on its own line. body only: as some webhook senders do (replays are refused only within the allowed age).timestamp and body, method, path, timestamp and body, body onlytimestamp and body
Algorithm when Method is hmacsha256, sha512, sha1sha256
Encoding when Method is hmachex, base64hex
Signature prefix when Method is hmacText before the signature, such as sha256=.Text; {{gv.X}}, {{ev.X}} or an = formula—
Username when Method is basic or wssUsernameToken; or Also send UsernameToken is onText; {{ }} references or an = formula—
Password when Method is basic or wssUsernameToken; or Also send UsernameToken is onThe name of a vault secret—
Password type when Method is wssUsernameToken; or Also send UsernameToken is onPasswordDigest, PasswordTextPasswordDigest
Token when Method is bearerThe name of a vault secret—
Key name when Method is apiKeyText; {{gv.X}}, {{ev.X}} or an = formulaX-API-Key
Send key in when Method is apiKeyheader, queryheader
Key when Method is apiKeyThe name of a vault secret—
Token URL when Method is oauth2ClientCredentialsText; {{gv.X}}, {{ev.X}} or an = formula—
Client ID when Method is oauth2ClientCredentialsText; {{gv.X}}, {{ev.X}} or an = formula—
Client secret when Method is oauth2ClientCredentialsThe name of a vault secret—
Scope when Method is oauth2ClientCredentialsText; {{gv.X}}, {{ev.X}} or an = formula—
Audience when Method is oauth2ClientCredentialsText; {{gv.X}}, {{ev.X}} or an = formula—
Send client credentials as when Method is oauth2ClientCredentialsbasic header, form bodybasic header
SAML assertion from when Method is wssSamlsecret, expressionsecret
SAML assertion when SAML assertion from is secretSecret property holding the full <saml:Assertion> XML.The name of a vault secret—
SAML assertion expression when SAML assertion from is expressionReference to an earlier step that fetched the assertion from your IdP/STS.Text; {{ }} references or an = formula{{nodes.Get SAML token.body}}
Also send UsernameToken when Method is wssSamlOn or offOff
Signing certificate when Method is wssX509A file on the server, a Certificate property ({{gv.CLIENT_CERT}}), or the PEM text.Code or JSON—
Signing private key when Method is wssX509A Private key or Secret property, or a key file on the server readable only by the SutraFlow account.The name of a vault secret—
Key passphrase when Method is wssX509The name of a vault secret—
Signature algorithm when Method is wssX509rsa-sha256, rsa-sha1rsa-sha256
Add Timestamp (seconds valid, 0 = none) when Method is wssUsernameToken or wssSaml or wssX509A number; may be a formula or variable300
Encrypt the body for (certificate) when Method is wssUsernameToken or wssSaml or wssX509The receiving service's certificate. Empty = not encrypted. Signed messages are signed first, then encrypted. A file on the server, a Certificate property ({{gv.CLIENT_CERT}}), or the PEM text.Code or JSON—
Encryption algorithm when Method is wssUsernameToken or wssSaml or wssX509The content key is sent with RSA-OAEP. Use CBC only for services that do not support GCM.aes256-gcm, aes128-gcm, aes256-cbc, aes128-cbcaes256-gcm
Headers when Method is customHeadersValues may use a Secret property, such as {{gv.API_TOKEN}}.Rows of name and value—
Maximum concurrent activities (0 = unlimited)How much work may use this connection at once, across all engines: Sutra steps that select it (or a connection that uses it, such as a knowledge base or AI memory), plus listener polls and scheduled refreshes. One step counts once, however many requests it makes. Excess steps wait in the queue (no retry used, no worker held, timeout not started); a poll with no room is skipped. A Project property such as {{gv.CRM_LIMIT}} can set it per server. Not a pool size or a rate limit; in-memory Sutras cannot use a limited connection. Admin Console: Connection limits.A number; may be a formula or variable0

API security policy connection

Project → Resources · kind inboundPolicy

Protects a REST or SOAP service this server exposes: who may call it, from where, how often, and over which transport.

Settings

SettingWhat it doesValuesDefault
Caller authenticationapps: gateway apps from the Admin Console (Gateway > Apps), with keys, scopes and plans. oauth2Introspection: opaque access tokens checked at the identity provider. hmac: requests signed with a shared secret (webhooks). wssX509: SOAP requests signed with a trusted certificate. wssSaml: SOAP requests carrying a signed SAML assertion.none, basic, apiKey, apps, jwt, oauth2Introspection, hmac, wssUsernameToken, wssX509, wssSaml, mtlsapiKey
Accepted secrets when Caller authentication is hmacNames of stored secrets, each behind a Secret property of this project or the engine; each holds one accepted secret (two while one is replaced).A list—
Signature header when Caller authentication is hmacText; {{gv.X}}, {{ev.X}} or an = formulaX-Signature
Timestamp header when Caller authentication is hmacUnix seconds. Not used when only the body is signed.Text; {{gv.X}}, {{ev.X}} or an = formulaX-Timestamp
What is signed when Caller authentication is hmactimestamp and body: the timestamp, a dot, then the body. method, path, timestamp and body: each on its own line. body only: as some webhook senders do (replays are refused only within the allowed age).timestamp and body, method, path, timestamp and body, body onlytimestamp and body
Algorithm when Caller authentication is hmacsha256, sha512, sha1sha256
Encoding when Caller authentication is hmachex, base64hex
Signature prefix when Caller authentication is hmacText before the signature, such as sha256=.Text; {{gv.X}}, {{ev.X}} or an = formula—
Allowed age (seconds) when Caller authentication is hmacOlder timestamps are refused, and a signature seen within this time is refused as a replay.A number; may be a formula or variable300
Introspection URL when Caller authentication is oauth2IntrospectionText; {{gv.X}}, {{ev.X}} or an = formula—
Client id when Caller authentication is oauth2IntrospectionThis gateway's client at the identity provider.Text; {{gv.X}}, {{ev.X}} or an = formula—
Client secret when Caller authentication is oauth2IntrospectionThe name of a vault secret—
Keep answers for (seconds) when Caller authentication is oauth2IntrospectionNever past the token's expiry. 0 = ask every time.A number; may be a formula or variable60
Audience when Caller authentication is oauth2IntrospectionEmpty = not checked.Text; {{gv.X}}, {{ev.X}} or an = formula—
Required scopes when Caller authentication is appsSpace separated, such as orders:read. The app must hold every one.Text; {{gv.X}}, {{ev.X}} or an = formula—
Accounts when Caller authentication is basicSystem accounts: those with a password and the Call services permission on this project (Admin Console).listed users, system accountslisted users
Users when Caller authentication is basic or wssUsernameTokenEach user name with the stored secret that holds the password (behind a Secret property of this project or the engine). Not used with system accounts.Rows of name and value—
Key header when Caller authentication is apiKey or appsText; {{gv.X}}, {{ev.X}} or an = formulaX-API-Key
Accepted keys when Caller authentication is apiKeyStored secrets behind a Secret property of this project or of the engine; each holds one accepted key.A list—
Token signature when Caller authentication is jwtjwks, publicKey, sharedSecretjwks
JWKS URL when Token signature is jwksText; {{gv.X}}, {{ev.X}} or an = formula—
Public key when Token signature is publicKeyA file on the server, a Certificate property ({{gv.JWT_PUBLIC_KEY}}), or the PEM text of the public key.Code or JSON—
Shared secret (HS256) when Token signature is sharedSecretThe name of a vault secret—
Issuer when Caller authentication is jwtText; {{gv.X}}, {{ev.X}} or an = formula—
Audience when Caller authentication is jwtText; {{gv.X}}, {{ev.X}} or an = formula—
Required scopes when Caller authentication is jwt or oauth2IntrospectionSpace separated. A service can require more per operation.Text; {{gv.X}}, {{ev.X}} or an = formula—
Allowed certificate subjects (CN) when Caller authentication is mtlsEmpty = any certificate signed by the client CA in Server settings.A list—
Trusted certificates when Caller authentication is wssX509The callers' signing certificates, or the certificates (CAs) that issue them; several PEM blocks may follow each other. A file on the server, a Certificate property ({{gv.CLIENT_CERT}}), or the PEM text.Code or JSON—
Allowed certificate subjects (CN) when Caller authentication is wssX509Empty = any trusted certificate.A list—
Identity provider certificate when Caller authentication is wssSamlThe certificate that signs the SAML assertions (several PEM blocks while it changes). A file on the server, a Certificate property ({{gv.CLIENT_CERT}}), or the PEM text.Code or JSON—
Issuer when Caller authentication is wssSamlEmpty = any issuer whose signature checks out.Text; {{gv.X}}, {{ev.X}} or an = formula—
Audience when Caller authentication is wssSamlThis service's name in the assertion's AudienceRestriction. Empty = not checked.Text; {{gv.X}}, {{ev.X}} or an = formula—
Timestamp when Caller authentication is wssUsernameToken or wssX509 or wssSamlA Timestamp that is present is always checked; required refuses messages without one (with X.509, it must be signed).optional, requiredoptional
Allowed clock difference (seconds) when Caller authentication is wssUsernameToken or wssX509 or wssSamlA number; may be a formula or variable300
Private key for encrypted requestsThis service's private key: SOAP requests encrypted for its certificate are decrypted before anything else. A Private key or Secret property, or a key file on the server readable only by the SutraFlow account.The name of a vault secret—
Key passphraseThe name of a vault secret—
Require an encrypted bodyOn or offOff
Encrypt SOAP responsesCaller certificate encrypts for the certificate carried by a verified WS-Security X.509 request. Configured certificate works with UsernameToken, SAML or other callers.off, caller certificate, configured certificateoff
Response recipient certificate when Encrypt SOAP responses is configured certificateA file on the server, a Certificate property ({{gv.CLIENT_CERT}}), or the PEM text.Code or JSON—
Response encryption algorithm when Encrypt SOAP responses is caller certificate or configured certificateThe response content key is sent with RSA-OAEP. Use CBC only for callers that do not support GCM.aes256-gcm, aes128-gcm, aes256-cbc, aes128-cbcaes256-gcm
Require HTTPSOn or offOn
Allowed IP addressesExact IPs or IPv4 CIDR such as 10.0.0.0/8. Empty = any.A list—
Rate limit (requests per minute per caller, 0 = off)A number; may be a formula or variable120
CORS originsBrowser origins allowed to call this API. Empty = none.A list—
Max body size (KB)0 = the service's own limit (REST: its Max body size; SOAP: the gateway's 50 MB).A number; may be a formula or variable0
Max nesting depthObjects, lists or XML elements inside each other. Checked before the message is parsed.A number; may be a formula or variable64
Max fields per messageObject keys, XML elements and attributes in the whole message.A number; may be a formula or variable50000
Max items per listA number; may be a formula or variable50000
Max text value (KB)The longest single text value. XML with a DOCTYPE is always refused (no entity expansion).A number; may be a formula or variable1024
Maximum concurrent activities (0 = unlimited)How much work may use this connection at once, across all engines: Sutra steps that select it (or a connection that uses it, such as a knowledge base or AI memory), plus listener polls and scheduled refreshes. One step counts once, however many requests it makes. Excess steps wait in the queue (no retry used, no worker held, timeout not started); a poll with no room is skipped. A Project property such as {{gv.CRM_LIMIT}} can set it per server. Not a pool size or a rate limit; in-memory Sutras cannot use a limited connection. Admin Console: Connection limits.A number; may be a formula or variable0

AI provider connection

Project → Resources · kind aiProvider

The AI engine used by AI activities: the Claude, Gemini, OpenAI or Hugging Face API; a local server (Ollama, LM Studio, Hugging Face TGI, or any OpenAI-compatible server such as llama.cpp or vLLM), which works offline; or the Claude Code, Gemini or Codex command-line tool installed on this server.

Settings

SettingWhat it doesValuesDefault
EngineClaude API, Claude CLI, Gemini API, Gemini CLI, OpenAI API, OpenAI Codex CLI, Ollama, LM Studio, Hugging Face, Hugging Face TGI (local), OpenAI-compatible serverClaude API
API key (Secret property) when Engine is Claude API or Gemini API or OpenAI API or Hugging Face or LM Studio or Hugging Face TGI (local) or OpenAI-compatible server or OllamaChoose a Secret project property (gv), or an administrator Secret engine property (ev). Required for hosted Claude, Gemini, OpenAI and Hugging Face APIs. Optional for protected local/network servers and Ollama APIs. CLI engines use their installed tool’s server-side login instead.The name of a vault secret—
Model selectionExplicit is the default: select a model below. Automatic deliberately fetches the server list at each request and chooses its first usable model; its order can change. CLI connections require an explicit model.explicit, automaticexplicit
ModelFetch models from the configured URL/key, then select one or enter its exact ID. No hidden default or replacement. Gemini 3.x/4.x IDs are discovered from your account; only generateContent-capable models are listed. CLI: enter the model accepted by the installed tool.Text; {{gv.X}}, {{ev.X}} or an = formula—
AI request timeout (ms)Default 120000 ms (120 seconds). AI activities inherit this limit; their Settings timeout can explicitly override it. Model requests, discovery and cancellation respect this deadline. Agents still have one total step deadline.A number; may be a formula or variable120000
Max output tokens when Engine is Claude API or Gemini API or OpenAI API or Ollama or LM Studio or Hugging Face or Hugging Face TGI (local) or OpenAI-compatible serverA number; may be a formula or variable16000
Server / API URL (local or network) when Engine is Claude API or Gemini API or OpenAI API or Ollama or LM Studio or Hugging Face or Hugging Face TGI (local) or OpenAI-compatible serverOllama: http://127.0.0.1:11434 or http://your-server:11434; an API endpoint URL also works. Other providers accept their API base URL or a compatible gateway. Blank uses the engine’s usual address. Model fetching and inference use this URL, not the designer browser’s machine. Keep keys out of URLs; select a Secret API key property.Text; {{gv.X}}, {{ev.X}} or an = formula—
Ollama API when Engine is Ollamachat: /api/chat with instructions and prompt as messages. generate: /api/generate with prompt and system. An address ending in /api/generate always uses generate.chat, generatechat
Command when Engine is Claude CLI or Gemini CLI or OpenAI Codex CLIEmpty = claude, gemini or codex from the server PATH; or the full path to the tool. Runs only when an administrator allows AI command-line tools and lists this command (Admin Console > Server > Runtime).Text; {{gv.X}}, {{ev.X}} or an = formula—
Arguments when Engine is Claude CLI or Gemini CLI or OpenAI Codex CLIEmpty = -p --output-format json (Claude), --output-format json (Gemini), exec - (Codex). The prompt is sent on standard input. The tool runs in an empty folder; flags that let it act without asking (such as --yolo or --dangerously-skip-permissions) are refused.Text; {{gv.X}}, {{ev.X}} or an = formula—
Maximum concurrent activities (0 = unlimited)How much work may use this connection at once, across all engines: Sutra steps that select it (or a connection that uses it, such as a knowledge base or AI memory), plus listener polls and scheduled refreshes. One step counts once, however many requests it makes. Excess steps wait in the queue (no retry used, no worker held, timeout not started); a poll with no room is skipped. A Project property such as {{gv.CRM_LIMIT}} can set it per server. Not a pool size or a rate limit; in-memory Sutras cannot use a limited connection. Admin Console: Connection limits.A number; may be a formula or variable0

Memory table connection

Project → Resources · kind memoryTable

Small reference data kept by key in the memory of each engine, for lookups without a database round trip: codes and their meanings, rates, routing and reusable values. Loaded from a database query, filled by Sutras, or both; with a copy in the database so a restart or another engine has them too. Not for big tables or files: those stay in the database or are streamed.

Settings

SettingWhat it doesValuesDefault
Key field(s)The field that identifies a row, or several separated by commas (country,city).Text; {{gv.X}}, {{ev.X}} or an = formulaid
Rows come fromfilled by Sutras, database queryfilled by Sutras
Database connection when Rows come from is database queryA Database (DB Ops) from Resources—
Load query when Rows come from is database queryLoads the table at the first use and on each refresh. A WHERE clause loads only part of a big table.Code or JSONSELECT id, name, country, credit_limit FROM customers WHERE active = 1
Lookup query for a missing row when Rows come from is database queryOptional: SELECT ... WHERE id = :key fetches a row that is not in memory and keeps it. :key, or the key field names for a key of several fields.Code or JSON—
Refresh schedule when Rows come from is database queryon demand, interval, cronon demand
Every (minutes) when Refresh schedule is intervalOlder tables with a value here continue to refresh by interval.A number; may be a formula or variable0
Cron expression when Refresh schedule is cronSeconds field optional. The cluster leader executes a durable table refresh once.Text; {{gv.X}}, {{ev.X}} or an = formula0 */15 * * * *
Time zone when Refresh schedule is cronIANA time zone, for example Asia/Kolkata.Text; {{gv.X}}, {{ev.X}} or an = formulaUTC
Rows expire after (seconds)0 = never.A number; may be a formula or variable0
Most rows keptBeyond this, the least recently used rows are dropped (a lookup query fetches them again). At most 100,000.A number; may be a formula or variable10000
Most memory (MB)The same for the size of the rows. A load query that returns more is refused: big data stays in the database. At most 256.A number; may be a formula or variable16
FailsafeCopy in the database: every change is also saved in the SutraFlow database, so an engine that restarts has the rows at once and every engine of a cluster sees the changes within a second. Memory only: fastest, but each engine has its own rows and loses them on a restart.copy in the database, memory onlycopy in the database
Maximum concurrent activities (0 = unlimited)How much work may use this connection at once, across all engines: Sutra steps that select it (or a connection that uses it, such as a knowledge base or AI memory), plus listener polls and scheduled refreshes. One step counts once, however many requests it makes. Excess steps wait in the queue (no retry used, no worker held, timeout not started); a poll with no room is skipped. A Project property such as {{gv.CRM_LIMIT}} can set it per server. Not a pool size or a rate limit; in-memory Sutras cannot use a limited connection. Admin Console: Connection limits.A number; may be a formula or variable0

AI memory store connection

Project → Resources · kind aiMemory

Where AI agents keep conversations between runs, per session (a chat, ticket or customer), and how much of it fits the model.

Settings

SettingWhat it doesValuesDefault
Keep conversations inbuilt-in: the SutraFlow database. database: a table in one of your databases (SQLite, PostgreSQL, MySQL); several servers can share it. folder: one file per session.built-in, database, folderbuilt-in
Database connection when Keep conversations in is databaseA Database (DB Ops) from Resources—
Table when Keep conversations in is databaseMade when missing.Text; {{gv.X}}, {{ev.X}} or an = formulasutra_ai_memory
Folder when Keep conversations in is folderEmpty = ai-memory in the data folder.Text; {{gv.X}}, {{ev.X}} or an = formula—
Context window (tokens)How much the agent may send to the model in one step: instructions, tools, memory, knowledge and the question. Keep it below the limit of the model.A number; may be a formula or variable8000
Kept free for the answer (tokens)A number; may be a formula or variable1000
Recent turns kept word for wordOlder turns are folded into the running summary when the history no longer fits.A number; may be a formula or variable6
When the history no longer fitssummarise older turns, drop the oldestsummarise older turns
AI provider for summariesEmpty = the provider of the agent. A small, fast model is enough.A AI provider from Resources—
Days to keepClear memory with "older than the days to keep" deletes older turns. 0 = keep.A number; may be a formula or variable90
Encrypt the textWith the master key of the server.On or offOff
Maximum concurrent activities (0 = unlimited)How much work may use this connection at once, across all engines: Sutra steps that select it (or a connection that uses it, such as a knowledge base or AI memory), plus listener polls and scheduled refreshes. One step counts once, however many requests it makes. Excess steps wait in the queue (no retry used, no worker held, timeout not started); a poll with no room is skipped. A Project property such as {{gv.CRM_LIMIT}} can set it per server. Not a pool size or a rate limit; in-memory Sutras cannot use a limited connection. Admin Console: Connection limits.A number; may be a formula or variable0

Knowledge base (RAG) connection

Project → Resources · kind aiKnowledge

Documents split into passages with vectors, for agents and Search knowledge to find by meaning (retrieval-augmented generation).

Settings

SettingWhat it doesValuesDefault
Vector storebuilt-in and folder need nothing else: for small knowledge, up to tens of thousands of passages (each search reads them all). For big documents, many documents, or sharing with other tools, use a vector database such as PostgreSQL (pgvector).built-in, folder, PostgreSQL (pgvector), Qdrant, Chroma, Pineconebuilt-in
Folder when Vector store is folderEmpty = knowledge in the data folder.Text; {{gv.X}}, {{ev.X}} or an = formula—
Database connection when Vector store is PostgreSQL (pgvector)A PostgreSQL database with the vector extension (CREATE EXTENSION vector).A Database (DB Ops) from Resources—
Table when Vector store is PostgreSQL (pgvector)Text; {{gv.X}}, {{ev.X}} or an = formulasutra_knowledge
Address when Vector store is Qdrant or Chroma or PineconeQdrant: http://127.0.0.1:6333. Chroma: http://127.0.0.1:8000. Pinecone: the index host, https://<index>-<project>.svc.<region>.pinecone.ioText; {{gv.X}}, {{ev.X}} or an = formula—
Collection when Vector store is Qdrant or ChromaText; {{gv.X}}, {{ev.X}} or an = formulasutra_knowledge
Namespace when Vector store is PineconeText; {{gv.X}}, {{ev.X}} or an = formula—
API key when Vector store is Qdrant or Chroma or PineconeSecret property; needed for Pinecone and for cloud Qdrant or Chroma.The name of a vault secret—
Vectors frombuilt-in: word vectors made here, offline, no model; finds shared words, not synonyms. AI provider: a vector model (Ollama nomic-embed-text, OpenAI text-embedding-3-small, Gemini) finds meaning.built-in, AI providerbuilt-in
AI provider for vectors when Vectors from is AI providerA AI provider from Resources—
Vector model when Vectors from is AI providerFor example nomic-embed-text (Ollama: ollama pull nomic-embed-text). After changing it, use Rebuild in Remove knowledge.Text; {{gv.X}}, {{ev.X}} or an = formula—
Passage size (tokens)A number; may be a formula or variable300
Overlap (tokens)Each passage repeats the end of the one before, so a sentence is not lost at a cut.A number; may be a formula or variable40
Maximum concurrent activities (0 = unlimited)How much work may use this connection at once, across all engines: Sutra steps that select it (or a connection that uses it, such as a knowledge base or AI memory), plus listener polls and scheduled refreshes. One step counts once, however many requests it makes. Excess steps wait in the queue (no retry used, no worker held, timeout not started); a poll with no room is skipped. A Project property such as {{gv.CRM_LIMIT}} can set it per server. Not a pool size or a rate limit; in-memory Sutras cannot use a limited connection. Admin Console: Connection limits.A number; may be a formula or variable0

MCP client (outside tools) connection

Project → Resources · kind mcpClient

Another MCP server whose tools AI agents and Call MCP tool may use: over HTTP, or a command started on this server.

Settings

SettingWhat it doesValuesDefault
Connect byHTTP, commandHTTP
Address when Connect by is HTTPText; {{gv.X}}, {{ev.X}} or an = formulahttps://tools.example.com/mcp
Bearer token when Connect by is HTTPSecret property, sent as Authorization: Bearer.The name of a vault secret—
Headers when Connect by is HTTPRows of name and value—
Command when Connect by is commandRuns as the SutraFlow server user, only when an administrator allows AI command-line tools and lists this command line (Admin Console > Server > Runtime).Text; {{gv.X}}, {{ev.X}} or an = formulanpx -y @modelcontextprotocol/server-filesystem C:/data
Working folder when Connect by is commandText; {{gv.X}}, {{ev.X}} or an = formula—
Time limit per call (seconds)A number; may be a formula or variable60
Allowed toolsComma separated. Empty = every tool of the server.Text; {{gv.X}}, {{ev.X}} or an = formula—
Maximum concurrent activities (0 = unlimited)How much work may use this connection at once, across all engines: Sutra steps that select it (or a connection that uses it, such as a knowledge base or AI memory), plus listener polls and scheduled refreshes. One step counts once, however many requests it makes. Excess steps wait in the queue (no retry used, no worker held, timeout not started); a poll with no room is skipped. A Project property such as {{gv.CRM_LIMIT}} can set it per server. Not a pool size or a rate limit; in-memory Sutras cannot use a limited connection. Admin Console: Connection limits.A number; may be a formula or variable0

MCP server (AI skills) connection

Project → Resources · kind mcpServer

An address on the gateway where AI assistants find a set of skills: every deployed Sutra whose MCP skill trigger names this server is one of its tools.

Settings

SettingWhat it doesValuesDefault
Address on the gatewayFor example /mcp/orders. Assistants connect to https://<server>:8443 followed by this address.Text; {{gv.X}}, {{ev.X}} or an = formula/mcp/skills
TitleText; {{gv.X}}, {{ev.X}} or an = formulaOrder skills
Instructions for the AITold to the assistant when it connects: what this set of skills is for and how to use it.Text; {{gv.X}}, {{ev.X}} or an = formulaTools for looking up and changing orders. Ask for the order number whe…
API security policyWho may use these skills. A tool can set its own policy instead.A API security policy from Resources—
Maximum concurrent activities (0 = unlimited)How much work may use this connection at once, across all engines: Sutra steps that select it (or a connection that uses it, such as a knowledge base or AI memory), plus listener polls and scheduled refreshes. One step counts once, however many requests it makes. Excess steps wait in the queue (no retry used, no worker held, timeout not started); a poll with no room is skipped. A Project property such as {{gv.CRM_LIMIT}} can set it per server. Not a pool size or a rate limit; in-memory Sutras cannot use a limited connection. Admin Console: Connection limits.A number; may be a formula or variable0

Email (SMTP) connection

Project → Resources · kind smtp

Outgoing mail server for Send email.

Settings

SettingWhat it doesValuesDefault
HostText; {{gv.X}}, {{ev.X}} or an = formulasmtp.gmail.com
PortA number; may be a formula or variable587
SecuritySTARTTLS, TLS, noneSTARTTLS
UsernameText; {{gv.X}}, {{ev.X}} or an = formula—
PasswordThe name of a vault secret—
Default FromText; {{gv.X}}, {{ev.X}} or an = formulaSutra <noreply@example.com>
Verify server certificateOn or offOn
Maximum concurrent activities (0 = unlimited)How much work may use this connection at once, across all engines: Sutra steps that select it (or a connection that uses it, such as a knowledge base or AI memory), plus listener polls and scheduled refreshes. One step counts once, however many requests it makes. Excess steps wait in the queue (no retry used, no worker held, timeout not started); a poll with no room is skipped. A Project property such as {{gv.CRM_LIMIT}} can set it per server. Not a pool size or a rate limit; in-memory Sutras cannot use a limited connection. Admin Console: Connection limits.A number; may be a formula or variable0

Email (IMAP) connection

Project → Resources · kind imap

Mailbox read by the Email trigger.

Settings

SettingWhat it doesValuesDefault
HostText; {{gv.X}}, {{ev.X}} or an = formulaimap.gmail.com
PortA number; may be a formula or variable993
TLSOn or offOn
UsernameText; {{gv.X}}, {{ev.X}} or an = formula—
PasswordThe name of a vault secret—
Verify server certificateOn or offOn
Maximum concurrent activities (0 = unlimited)How much work may use this connection at once, across all engines: Sutra steps that select it (or a connection that uses it, such as a knowledge base or AI memory), plus listener polls and scheduled refreshes. One step counts once, however many requests it makes. Excess steps wait in the queue (no retry used, no worker held, timeout not started); a poll with no room is skipped. A Project property such as {{gv.CRM_LIMIT}} can set it per server. Not a pool size or a rate limit; in-memory Sutras cannot use a limited connection. Admin Console: Connection limits.A number; may be a formula or variable0

Database (DB Ops) connection

Project → Resources · kind database

PostgreSQL, MySQL/MariaDB, SQL Server, Oracle or SQLite for the DB Ops palette.

Settings

SettingWhat it doesValuesDefault
Databasepostgres, mysql, mssql, oracle, sqlitepostgres
Host when Database is postgres or mysql or mssql or oracleText; {{gv.X}}, {{ev.X}} or an = formulalocalhost
Port when Database is postgres or mysql or mssql or oraclePostgres 5432, MySQL 3306, SQL Server 1433, Oracle 1521.A number; may be a formula or variable5432
Database / service name when Database is postgres or mysql or mssql or oracleText; {{gv.X}}, {{ev.X}} or an = formula—
User when Database is postgres or mysql or mssql or oracleText; {{gv.X}}, {{ev.X}} or an = formula—
Password when Database is postgres or mysql or mssql or oracleThe name of a vault secret—
Database file when Database is sqliteRelative to the data folder.Text; {{gv.X}}, {{ev.X}} or an = formuladata/app.sqlite
Encrypt connection (TLS) when Database is postgres or mysql or mssqlOn or offOff
Verify server certificate when Encrypt connection (TLS) is onOn or offOn
CA certificate when Encrypt connection (TLS) is onA file on the server (C:\certs\ca.pem, or {{ev.CERTS}}\ca.pem), a Certificate property ({{gv.CA}}), or the PEM text. Empty uses the operating system trust store. Renew by replacing the file or changing the property. For a private CA of PostgreSQL, MySQL or SQL Server. Verification also checks the database server hostname; use the certificate hostname, not an unrelated alias.Code or JSON—
Oracle connect string (optional) when Database is oracleOverrides Host/Port/Service. Use an Oracle Easy Connect/TCPS address or descriptor supplied by your DBA; Oracle TLS/wallet prerequisites are driver-specific. May use Project/Engine properties.Text; {{gv.X}}, {{ev.X}} or an = formula—
Connection pool size when Database is postgres or mysql or mssql or oracleA number; may be a formula or variable10
Maximum concurrent activities (0 = unlimited)How much work may use this connection at once, across all engines: Sutra steps that select it (or a connection that uses it, such as a knowledge base or AI memory), plus listener polls and scheduled refreshes. One step counts once, however many requests it makes. Excess steps wait in the queue (no retry used, no worker held, timeout not started); a poll with no room is skipped. A Project property such as {{gv.CRM_LIMIT}} can set it per server. Not a pool size or a rate limit; in-memory Sutras cannot use a limited connection. Admin Console: Connection limits.A number; may be a formula or variable0

Kafka connection

Project → Resources · kind kafka

Kafka cluster for Publish and Subscribe (Service Bus palette).

Settings

SettingWhat it doesValuesDefault
BrokersA list
Client IDText; {{gv.X}}, {{ev.X}} or an = formulasutraflow
TLSOn or offOff
CA certificate when TLS is onA file on the server (C:\certs\ca.pem, or {{ev.CERTS}}\ca.pem), a Certificate property ({{gv.CA}}), or the PEM text. Empty uses the operating system trust store. Renew by replacing the file or changing the property.Code or JSON—
Client certificate when TLS is onA file on the server, a Certificate property ({{gv.CLIENT_CERT}}), or the PEM text.Code or JSON—
Client private key when TLS is onA Private key or Secret property, or a key file on the server readable only by the SutraFlow account.The name of a vault secret—
Private key passphrase when TLS is onOptional Secret property for an encrypted client private key.The name of a vault secret—
SASLnone, plain, scram-sha-256, scram-sha-512none
Username when SASL is plain or scram-sha-256 or scram-sha-512Text; {{gv.X}}, {{ev.X}} or an = formula—
Password when SASL is plain or scram-sha-256 or scram-sha-512The name of a vault secret—
Maximum concurrent activities (0 = unlimited)How much work may use this connection at once, across all engines: Sutra steps that select it (or a connection that uses it, such as a knowledge base or AI memory), plus listener polls and scheduled refreshes. One step counts once, however many requests it makes. Excess steps wait in the queue (no retry used, no worker held, timeout not started); a poll with no room is skipped. A Project property such as {{gv.CRM_LIMIT}} can set it per server. Not a pool size or a rate limit; in-memory Sutras cannot use a limited connection. Admin Console: Connection limits.A number; may be a formula or variable0

RabbitMQ (AMQP 0-9-1) connection

Project → Resources · kind rabbitmq

RabbitMQ broker for Publish and Subscribe.

Settings

SettingWhat it doesValuesDefault
URLamqps:// for TLS. The password comes from the secret below.Text; {{gv.X}}, {{ev.X}} or an = formulaamqp://localhost:5672/
UsernameText; {{gv.X}}, {{ev.X}} or an = formulaguest
PasswordThe name of a vault secret—
Virtual hostText; {{gv.X}}, {{ev.X}} or an = formula/
CA certificateA file on the server (C:\certs\ca.pem, or {{ev.CERTS}}\ca.pem), a Certificate property ({{gv.CA}}), or the PEM text. Empty uses the operating system trust store. Renew by replacing the file or changing the property.Code or JSON—
Client certificateA file on the server, a Certificate property ({{gv.CLIENT_CERT}}), or the PEM text.Code or JSON—
Client private keyA Private key or Secret property, or a key file on the server readable only by the SutraFlow account.The name of a vault secret—
Private key passphraseOptional, for an encrypted client key.The name of a vault secret—
Maximum concurrent activities (0 = unlimited)How much work may use this connection at once, across all engines: Sutra steps that select it (or a connection that uses it, such as a knowledge base or AI memory), plus listener polls and scheduled refreshes. One step counts once, however many requests it makes. Excess steps wait in the queue (no retry used, no worker held, timeout not started); a poll with no room is skipped. A Project property such as {{gv.CRM_LIMIT}} can set it per server. Not a pool size or a rate limit; in-memory Sutras cannot use a limited connection. Admin Console: Connection limits.A number; may be a formula or variable0

ActiveMQ / AMQP 1.0 connection

Project → Resources · kind amqp1

Apache ActiveMQ (Classic or Artemis), Azure Service Bus and other AMQP 1.0 brokers.

Settings

SettingWhat it doesValuesDefault
HostText; {{gv.X}}, {{ev.X}} or an = formulalocalhost
PortA number; may be a formula or variable5672
TLSOn or offOff
UsernameText; {{gv.X}}, {{ev.X}} or an = formulaadmin
PasswordThe name of a vault secret—
Container ID prefixSutraFlow adds a unique publisher or listener suffix. Keep this prefix distinct for each SutraFlow installation.Text; {{gv.X}}, {{ev.X}} or an = formulasutraflow
Queue address prefixActiveMQ Classic: empty or queue://. Artemis: empty.Text; {{gv.X}}, {{ev.X}} or an = formula—
Topic address prefixActiveMQ Classic: topic://. Artemis: empty, with the address set to multicast.Text; {{gv.X}}, {{ev.X}} or an = formulatopic://
CA certificate when TLS is onA file on the server (C:\certs\ca.pem, or {{ev.CERTS}}\ca.pem), a Certificate property ({{gv.CA}}), or the PEM text. Empty uses the operating system trust store. Renew by replacing the file or changing the property.Code or JSON—
Client certificate when TLS is onA file on the server, a Certificate property ({{gv.CLIENT_CERT}}), or the PEM text.Code or JSON—
Client private key when TLS is onA Private key or Secret property, or a key file on the server readable only by the SutraFlow account.The name of a vault secret—
Private key passphrase when TLS is onOptional, for an encrypted client key.The name of a vault secret—
Maximum concurrent activities (0 = unlimited)How much work may use this connection at once, across all engines: Sutra steps that select it (or a connection that uses it, such as a knowledge base or AI memory), plus listener polls and scheduled refreshes. One step counts once, however many requests it makes. Excess steps wait in the queue (no retry used, no worker held, timeout not started); a poll with no room is skipped. A Project property such as {{gv.CRM_LIMIT}} can set it per server. Not a pool size or a rate limit; in-memory Sutras cannot use a limited connection. Admin Console: Connection limits.A number; may be a formula or variable0

Firebase connection

Project → Resources · kind firebase

Firestore, Realtime Database and Cloud Messaging (push notifications) with a service account.

Settings

SettingWhat it doesValuesDefault
Service account key (JSON)Secret property holding the JSON key downloaded from Firebase > Project settings > Service accounts.The name of a vault secret—
Realtime Database URLText; {{gv.X}}, {{ev.X}} or an = formulahttps://PROJECT-default-rtdb.firebaseio.com
API base (testing only)Leave empty. Lets tests point at an emulator.Text; {{gv.X}}, {{ev.X}} or an = formula—
Maximum concurrent activities (0 = unlimited)How much work may use this connection at once, across all engines: Sutra steps that select it (or a connection that uses it, such as a knowledge base or AI memory), plus listener polls and scheduled refreshes. One step counts once, however many requests it makes. Excess steps wait in the queue (no retry used, no worker held, timeout not started); a poll with no room is skipped. A Project property such as {{gv.CRM_LIMIT}} can set it per server. Not a pool size or a rate limit; in-memory Sutras cannot use a limited connection. Admin Console: Connection limits.A number; may be a formula or variable0

SFTP server connection

Project → Resources · kind sftp

A server reached over SSH file transfer, for the SFTP / FTP palette.

Settings

SettingWhat it doesValuesDefault
HostText; {{gv.X}}, {{ev.X}} or an = formulasftp.example.com
PortA number; may be a formula or variable22
UsernameText; {{gv.X}}, {{ev.X}} or an = formula—
Sign in withpassword, private keypassword
Password when Sign in with is passwordThe name of a vault secret—
Private key when Sign in with is private keyA Private key or Secret property, or a key file on the server (OpenSSH or PEM) readable only by the SutraFlow account.The name of a vault secret—
Key passphrase when Sign in with is private keyThe name of a vault secret—
Host key fingerprintSHA256:... of the server key. Set it to refuse any other server; Test connection shows it.Text; {{gv.X}}, {{ev.X}} or an = formula—
Base folderActivities work inside this folder only.Text; {{gv.X}}, {{ev.X}} or an = formula/
Connect time limit (seconds)Reaching the server and signing in.A number; may be a formula or variable30
Response time limit (seconds)Each operation: list, read, write, rename. A large file is one operation; allow for its transfer time.A number; may be a formula or variable60
Connection attemptsTries to connect again after a network failure. A wrong password or host key is not retried.A number; may be a formula or variable3
Wait between attempts (seconds)A number; may be a formula or variable5
Keep-alive every (seconds)Keeps slow sessions open through firewalls. 0 = off.A number; may be a formula or variable15
Maximum concurrent activities (0 = unlimited)How much work may use this connection at once, across all engines: Sutra steps that select it (or a connection that uses it, such as a knowledge base or AI memory), plus listener polls and scheduled refreshes. One step counts once, however many requests it makes. Excess steps wait in the queue (no retry used, no worker held, timeout not started); a poll with no room is skipped. A Project property such as {{gv.CRM_LIMIT}} can set it per server. Not a pool size or a rate limit; in-memory Sutras cannot use a limited connection. Admin Console: Connection limits.A number; may be a formula or variable0

FTP server connection

Project → Resources · kind ftp

An FTP or FTPS server, for the SFTP / FTP palette.

Settings

SettingWhat it doesValuesDefault
HostText; {{gv.X}}, {{ev.X}} or an = formulaftp.example.com
PortA number; may be a formula or variable21
UsernameText; {{gv.X}}, {{ev.X}} or an = formula—
PasswordThe name of a vault secret—
Securitynone sends the password unencrypted: only inside a trusted network.explicit TLS, implicit TLS, noneexplicit TLS
Verify server certificate when Security is explicit TLS or implicit TLSOn or offOn
Base folderActivities work inside this folder only.Text; {{gv.X}}, {{ev.X}} or an = formula/
Connect time limit (seconds)Reaching the server and signing in.A number; may be a formula or variable30
Response time limit (seconds)Each operation: list, read, write, rename. A large file is one operation; allow for its transfer time.A number; may be a formula or variable60
Connection attemptsTries to connect again after a network failure. A wrong password or host key is not retried.A number; may be a formula or variable3
Wait between attempts (seconds)A number; may be a formula or variable5
Maximum concurrent activities (0 = unlimited)How much work may use this connection at once, across all engines: Sutra steps that select it (or a connection that uses it, such as a knowledge base or AI memory), plus listener polls and scheduled refreshes. One step counts once, however many requests it makes. Excess steps wait in the queue (no retry used, no worker held, timeout not started); a poll with no room is skipped. A Project property such as {{gv.CRM_LIMIT}} can set it per server. Not a pool size or a rate limit; in-memory Sutras cannot use a limited connection. Admin Console: Connection limits.A number; may be a formula or variable0

OAuth connection (Google, YouTube, Twitch, Dropbox, Facebook)

Project → Resources · kind oauthApp

Connects an account with OAuth 2.0 (authorization code). Used by Google Sheets, Drive, Docs, YouTube, Twitch, Dropbox, Facebook and Connected API call. Sign in with Connect account (studio), sutra connect (any server), or a refresh token secret (servers set up by a pipeline).

Settings

SettingWhat it doesValuesDefault
Servicegoogle, dropbox, facebook, microsoft, twitch, customgoogle
Tenant when Service is microsoftMicrosoft: the directory (tenant) ID or domain of an app registered for one organisation (Microsoft Entra ID > App registrations > Overview). common: an app for any organisation or personal accounts.Text; {{gv.X}}, {{ev.X}} or an = formulacommon
Client IDText; {{gv.X}}, {{ev.X}} or an = formula—
Client secretThe name of a vault secret—
ScopesSpace separated. Google: .../auth/spreadsheets, .../auth/drive, .../auth/youtube.readonly, .../auth/youtube.upload, .../auth/youtube.force-ssl, .../auth/yt-analytics.readonly. Twitch: user:read:email channel:manage:broadcast clips:edit user:write:chat moderator:read:followers. Dropbox: files.content.read files.content.write. Facebook: pages_manage_posts pages_read_engagement.Text; {{gv.X}}, {{ev.X}} or an = formulahttps://www.googleapis.com/auth/spreadsheets https://www.googleapis.co…
Refresh token (secret)Optional, for servers without the studio: a refresh token of the account kept as a secret on that server (set by your pipeline with sutra secret set). Used instead of Connect account.The name of a vault secret—
Authorization URL when Service is customText; {{gv.X}}, {{ev.X}} or an = formula—
Token URL when Service is customText; {{gv.X}}, {{ev.X}} or an = formula—
API base URLOptional; for Connected API call with relative paths.Text; {{gv.X}}, {{ev.X}} or an = formula—
Maximum concurrent activities (0 = unlimited)How much work may use this connection at once, across all engines: Sutra steps that select it (or a connection that uses it, such as a knowledge base or AI memory), plus listener polls and scheduled refreshes. One step counts once, however many requests it makes. Excess steps wait in the queue (no retry used, no worker held, timeout not started); a poll with no room is skipped. A Project property such as {{gv.CRM_LIMIT}} can set it per server. Not a pool size or a rate limit; in-memory Sutras cannot use a limited connection. Admin Console: Connection limits.A number; may be a formula or variable0

MongoDB connection

Project → Resources · kind mongodb

Native MongoDB connection with project-specific credentials and a small reusable pool. Atlas M0 is the tested baseline, not a compatibility claim for every MongoDB-compatible service.

Settings

SettingWhat it doesValuesDefault
Authentication configurationA: encrypted complete URI. B: host plus separate credentials. X.509: certificate-based authentication. Each project can use its own connection.username/password, URI secret, X.509username/password
Host when Authentication configuration is username/password or X.509No username/password or scheme. Or use the optional advanced server URI below.Text; {{gv.X}}, {{ev.X}} or an = formula—
DNS SRV connection when Authentication configuration is username/password or X.509On for Atlas SRV hosts. Off uses Host and Port directly.On or offOn
Port when DNS SRV connection is offA number; may be a formula or variable27017
Advanced server URI (optional; no credentials) when Authentication configuration is username/password or X.509Overrides Host when supplied. For Atlas host plus username/password, leave this blank. A complete URI containing credentials belongs only in a Secret GV with URI secret authentication.Text; {{gv.X}}, {{ev.X}} or an = formula—
Username / certificate subject (optional for X.509) when Authentication configuration is username/password or X.509Text; {{gv.X}}, {{ev.X}} or an = formula—
Password when Authentication configuration is username/passwordEnter and store the password here, or select a stored secret. Values are encrypted and never read back.The name of a vault secret—
Authentication database when Authentication configuration is username/passwordAtlas normally uses admin; this is separate from the application database.Text; {{gv.X}}, {{ev.X}} or an = formulaadmin
Authentication mechanism when Authentication configuration is username/passwordDEFAULT lets the official driver negotiate. Only choose a fixed mechanism when required by your server.DEFAULT, SCRAM-SHA-256, SCRAM-SHA-1DEFAULT
Complete URI — Secret property when Authentication configuration is URI secretSelect a Secret GV containing the complete mongodb+srv:// or mongodb:// URI, including credentials. Or create a named Secret project variable here. DNS SRV requires a working process DNS resolver.The name of a vault secret—
TLS enabledKeep On for Atlas and remote servers. Off is accepted only for a direct loopback development connection; never for X.509.On or offOn
CA certificate when TLS enabled is onA file on the server (C:\certs\ca.pem, or {{ev.CERTS}}\ca.pem), a Certificate property ({{gv.CA}}), or the PEM text. Empty uses the operating system trust store. Renew by replacing the file or changing the property. Server certificate and hostname verification stay on.Code or JSON—
Trusted CA certificates (vault) when TLS enabled is onSet before 2.1.1. The CA certificate above is used first.The name of a vault secret—
Client certificate when Authentication configuration is X.509A file on the server, a Certificate property ({{gv.CLIENT_CERT}}), or the PEM text.Code or JSON—
Client private key when Authentication configuration is X.509A Private key or Secret property, or a key file on the server readable only by the SutraFlow account.The name of a vault secret—
Client private-key passphrase (optional) when Authentication configuration is X.509The name of a vault secret—
Read preferenceprimary, primaryPreferred, secondary, secondaryPreferred, nearestprimary
Deployment capabilitiesM0 baseline retains its limits. General enables explicitly opted-in aggregation disk/write-stage options; server capabilities and privileges still apply. Compatible services require separate certification.Atlas M0 baseline, General MongoDBAtlas M0 baseline
DatabaseExplicit application database; authentication database remains an option in the secret URI. Supports project/engine variables.Text; {{gv.X}}, {{ev.X}} or an = formulasutraflow_test
Maximum pooled connectionsA number; may be a formula or variable5
Operation timeout (ms)A number; may be a formula or variable15000
Server selection timeout (ms)A number; may be a formula or variable15000
Maximum concurrent activities (0 = unlimited)How much work may use this connection at once, across all engines: Sutra steps that select it (or a connection that uses it, such as a knowledge base or AI memory), plus listener polls and scheduled refreshes. One step counts once, however many requests it makes. Excess steps wait in the queue (no retry used, no worker held, timeout not started); a poll with no room is skipped. A Project property such as {{gv.CRM_LIMIT}} can set it per server. Not a pool size or a rate limit; in-memory Sutras cannot use a limited connection. Admin Console: Connection limits.A number; may be a formula or variable0

Azure Data Factory connection

Project → Resources · kind azureDataFactory

A data factory whose pipelines Sutras run and monitor. The identity needs the Data Factory Contributor role on the factory (or its resource group).

Settings

SettingWhat it doesValuesDefault
Sign in withA service principal for servers; a managed identity when SutraFlow runs in Azure; the Azure CLI of this server (az login) for development.service principal (client secret), managed identity, Azure CLI (az login)service principal (client secret)
Tenant id when Sign in with is service principal (client secret)Directory (tenant) id of the Entra ID app, or the domain such as contoso.onmicrosoft.com.Text; {{gv.X}}, {{ev.X}} or an = formula—
Client id when Sign in with is service principal (client secret)Application (client) id of the app registration (service principal).Text; {{gv.X}}, {{ev.X}} or an = formula—
Client secret when Sign in with is service principal (client secret)The name of a vault secret—
Managed identity client id when Sign in with is managed identity or Azure managed identityOnly for a user-assigned identity; empty = the system-assigned identity.Text; {{gv.X}}, {{ev.X}} or an = formula—
Subscription idText; {{gv.X}}, {{ev.X}} or an = formula—
Resource groupText; {{gv.X}}, {{ev.X}} or an = formula—
Data factoryText; {{gv.X}}, {{ev.X}} or an = formula—
Check status every (seconds)How often a waiting step asks for the run status.A number; may be a formula or variable15
Azure cloudAzure (global), Azure China, Azure US Government, customAzure (global)
Sign-in address when Azure cloud is customText; {{gv.X}}, {{ev.X}} or an = formulahttps://login.microsoftonline.com
Management address when Azure cloud is customText; {{gv.X}}, {{ev.X}} or an = formulahttps://management.azure.com
Maximum concurrent activities (0 = unlimited)How much work may use this connection at once, across all engines: Sutra steps that select it (or a connection that uses it, such as a knowledge base or AI memory), plus listener polls and scheduled refreshes. One step counts once, however many requests it makes. Excess steps wait in the queue (no retry used, no worker held, timeout not started); a poll with no room is skipped. A Project property such as {{gv.CRM_LIMIT}} can set it per server. Not a pool size or a rate limit; in-memory Sutras cannot use a limited connection. Admin Console: Connection limits.A number; may be a formula or variable0

Databricks workspace connection

Project → Resources · kind databricks

A Databricks workspace (Azure, AWS or Google Cloud) for jobs, notebooks, code blocks on clusters and SQL warehouses.

Settings

SettingWhat it doesValuesDefault
Workspace addressThe address of the workspace as in the browser, without a path.Text; {{gv.X}}, {{ev.X}} or an = formulahttps://adb-1234567890123456.7.azuredatabricks.net
Sign in withpersonal access token, Databricks OAuth (service principal), Azure service principal, Azure managed identity, Azure CLI (az login)personal access token
Access token when Sign in with is personal access tokenUser Settings > Developer > Access tokens. Prefer a service principal for production.The name of a vault secret—
Tenant id when Sign in with is Azure service principalDirectory (tenant) id of the Entra ID app, or the domain such as contoso.onmicrosoft.com.Text; {{gv.X}}, {{ev.X}} or an = formula—
Client id when Sign in with is Databricks OAuth (service principal) or Azure service principalApplication (client) id of the app registration (service principal).Text; {{gv.X}}, {{ev.X}} or an = formula—
Client secret when Sign in with is Databricks OAuth (service principal) or Azure service principalThe name of a vault secret—
Managed identity client id when Sign in with is managed identity or Azure managed identityOnly for a user-assigned identity; empty = the system-assigned identity.Text; {{gv.X}}, {{ev.X}} or an = formula—
Default cluster idFor notebooks and code blocks on an all-purpose cluster: Compute > the cluster > its id in the address. Steps may name another.Text; {{gv.X}}, {{ev.X}} or an = formula—
Default SQL warehouse idFor Databricks SQL: SQL Warehouses > the warehouse > Connection details.Text; {{gv.X}}, {{ev.X}} or an = formula—
Check status every (seconds)A number; may be a formula or variable10
Azure cloud when Sign in with is Azure service principal or Azure managed identity or Azure CLI (az login)Azure (global), Azure China, Azure US Government, customAzure (global)
Sign-in address when Azure cloud is customText; {{gv.X}}, {{ev.X}} or an = formulahttps://login.microsoftonline.com
Management address when Azure cloud is customText; {{gv.X}}, {{ev.X}} or an = formulahttps://management.azure.com
Maximum concurrent activities (0 = unlimited)How much work may use this connection at once, across all engines: Sutra steps that select it (or a connection that uses it, such as a knowledge base or AI memory), plus listener polls and scheduled refreshes. One step counts once, however many requests it makes. Excess steps wait in the queue (no retry used, no worker held, timeout not started); a poll with no room is skipped. A Project property such as {{gv.CRM_LIMIT}} can set it per server. Not a pool size or a rate limit; in-memory Sutras cannot use a limited connection. Admin Console: Connection limits.A number; may be a formula or variable0

Discord connection

Project → Resources · kind discord

A Discord webhook (posts to one channel, nothing to install) or a bot (sends and reads messages in the channels it is invited to).

Settings

SettingWhat it doesValuesDefault
Connect withwebhook: Channel settings > Integrations > Webhooks > New, copy its address. bot: discord.com/developers > Applications > Bot, copy the token, invite the bot with Send Messages and Read Message History (and turn on Message Content Intent to read messages).webhook, botwebhook
Webhook address (secret) when Connect with is webhookThe webhook address is a key: anyone who has it can post. Keep it as a secret.The name of a vault secret—
Bot token (secret) when Connect with is botThe name of a vault secret—
Default channel id when Connect with is botTurn on Developer Mode in Discord, then right-click the channel > Copy Channel ID.Text; {{gv.X}}, {{ev.X}} or an = formula—
API addressLeave as it is.Text; {{gv.X}}, {{ev.X}} or an = formulahttps://discord.com/api/v10
Maximum concurrent activities (0 = unlimited)How much work may use this connection at once, across all engines: Sutra steps that select it (or a connection that uses it, such as a knowledge base or AI memory), plus listener polls and scheduled refreshes. One step counts once, however many requests it makes. Excess steps wait in the queue (no retry used, no worker held, timeout not started); a poll with no room is skipped. A Project property such as {{gv.CRM_LIMIT}} can set it per server. Not a pool size or a rate limit; in-memory Sutras cannot use a limited connection. Admin Console: Connection limits.A number; may be a formula or variable0

Telegram bot connection

Project → Resources · kind telegram

A Telegram bot that sends messages, photos, documents and videos to chats, groups and channels, and receives messages and commands.

Settings

SettingWhat it doesValuesDefault
Bot token (secret)From @BotFather: /newbot gives the token. Add the bot to a group or channel to post there.The name of a vault secret—
Default chat idA chat, group (-100...) or @channelusername. The trigger shows the chat id of every message.Text; {{gv.X}}, {{ev.X}} or an = formula—
API addressLeave as it is, unless you run your own Bot API server.Text; {{gv.X}}, {{ev.X}} or an = formulahttps://api.telegram.org
Maximum concurrent activities (0 = unlimited)How much work may use this connection at once, across all engines: Sutra steps that select it (or a connection that uses it, such as a knowledge base or AI memory), plus listener polls and scheduled refreshes. One step counts once, however many requests it makes. Excess steps wait in the queue (no retry used, no worker held, timeout not started); a poll with no room is skipped. A Project property such as {{gv.CRM_LIMIT}} can set it per server. Not a pool size or a rate limit; in-memory Sutras cannot use a limited connection. Admin Console: Connection limits.A number; may be a formula or variable0

WebSocket connection

Project → Resources · kind websocket

A WebSocket server this server connects to: its address, headers (a token, a key) and how it reconnects.

Settings

SettingWhat it doesValuesDefault
Addressws:// or wss://. May use project variables.Text; {{ }} references or an = formulawss://stream.example.com/ws
HeadersSent when connecting. Values may use a Secret property, such as Authorization = Bearer {{gv.STREAM_TOKEN}}.Rows of name and value—
SubprotocolsComma separated, when the server asks for one.Text; {{gv.X}}, {{ev.X}} or an = formula—
Ping every (seconds)Keeps the connection open through proxies; a server that stops answering is reconnected. 0 = off.A number; may be a formula or variable30
Reconnect after (ms)The first wait after a lost connection; it doubles up to the maximum.A number; may be a formula or variable1000
Longest wait (ms)A number; may be a formula or variable30000
Maximum concurrent activities (0 = unlimited)How much work may use this connection at once, across all engines: Sutra steps that select it (or a connection that uses it, such as a knowledge base or AI memory), plus listener polls and scheduled refreshes. One step counts once, however many requests it makes. Excess steps wait in the queue (no retry used, no worker held, timeout not started); a poll with no room is skipped. A Project property such as {{gv.CRM_LIMIT}} can set it per server. Not a pool size or a rate limit; in-memory Sutras cannot use a limited connection. Admin Console: Connection limits.A number; may be a formula or variable0

52. Function reference

122 functions for formulas and mappings, grouped as in the mapper's function library. Names ignore case. Sample: Functions (New Sutra, Samples) uses every one of them on an order, a Map data step per group with a Log of its results.

String

FunctionWhat it doesExample
concat(a, b, ...)Joins text values.concat('Name : ', {input.name})
substring(text, start, length?)Part of the text; start counts from 1.substring('ABCDEF', 2, 3) = 'BCD'
substring-before(text, find)Text before the first match.substring-before('a@b.com', '@') = 'a'
substring-after(text, find)Text after the first match.substring-after('a@b.com', '@') = 'b.com'
substring-before-last(text, find)Text before the last match.
substring-after-last(text, find)Text after the last match.substring-after-last('a/b/c.txt', '/') = 'c.txt'
upper-case(text)Upper case.
lower-case(text)Lower case.
trim(text)Removes spaces at both ends.
left-trim(text)Removes leading spaces.
right-trim(text)Removes trailing spaces.
normalize-space(text)Trims and collapses inner spaces.
string-length(text)Number of characters.
contains(text, find)True when text contains find.
starts-with(text, prefix)True when text starts with prefix.
ends-with(text, suffix)True when text ends with suffix.
index-of(text, find)Position of find (1-based), 0 when absent.
replace(text, find, with)Replaces every occurrence (plain text).
replace-regex(text, pattern, with)Regular expression replace; $1 refers to groups.
matches(text, pattern)True when the regular expression matches.
translate(text, from, to)Replaces characters one for one.
pad(text, length, char?)Pads on the right.
pad-front(text, length, char?)Pads on the left, e.g. leading zeros.pad-front(42, 6, '0') = '000042'
tokenize(text, separator)Splits text into a list.
string-join(list, separator)Joins a list into text.
capitalize(text)First letter of each word upper case.

Conversion

FunctionWhat it doesExample
xs:string(value)Converts to text (objects become JSON).
xs:integer(value)Whole number (fraction dropped); error when not a number.
xs:int(value)Same as xs:integer.
xs:long(value)Same as xs:integer.
xs:decimal(value)Decimal number; error when not a number.
xs:double(value)Floating-point number (NaN when not a number).
xs:float(value)Same as xs:double.
xs:date(value)Date as YYYY-MM-DD.
xs:dateTime(value)Date and time as ISO 8601.
xs:time(value)Time as HH:mm:ss.
xs:boolean(value)Converts to true/false ("true", "1" and "yes" are true).

Encode/Decode

FunctionWhat it doesExample
string-to-base64(text)Base64 encode.
base64-to-string(base64)Base64 decode.
url-encode(text)Encode for URLs.
url-decode(text)Decode URL encoding.
hex-encode(text)Text to hexadecimal.
hex-decode(hex)Hexadecimal to text.
escape-xml(text)Escape < > & ' " for XML.
unescape-xml(text)Undo XML escaping.
md5(text)MD5 hash (hex).
sha1(text)SHA-1 hash (hex).
sha256(text)SHA-256 hash (hex).
hmac-sha256(key, text, encoding?)HMAC signature, hex or base64.
to-json(value)Data to JSON text.
from-json(text)JSON text to data.

Variables

FunctionWhat it doesExample
get-project-variable('NAME')Current value of a project variable (same as {gv.NAME}, but the name can be computed).
memory-lookup('Table', key, 'field'?)A record of a Memory table in the project, by key, or one field of it; empty when it is not cached. Reads memory only, so it never waits: use Get Memory Record when a missing record should be fetched from the source.
get-engine-variable('NAME')Current value of an administrator-managed Engine property, shared by all projects and read-only to Sutras.

Utility

FunctionWhat it doesExample
newline()A line break, for concat().
tab()A tab character.
uuid()A new random id (UUID v4).
timestamp(date?)Milliseconds since 1970 (now when empty).timestamp() = 1791900000000
timestamp-seconds(date?)Seconds since 1970 (Unix time).
current-timestamp(format?, timezone?)Now as text; default 'YYYYMMDDHHmmssSSS', handy for file names and ids.concat('orders-', current-timestamp('YYYYMMDD-HHmmss'), '.csv')
random-string(length, characters?)Random letters and digits.
type-of(value)text, number, boolean, list, object or null.
hostname()Name of the server running the Sutra.
file-name(path)Last part of a path: C:\in\a.csv gives a.csv.
file-base-name(path)File name without its extension.
file-extension(path)Extension without the dot (csv).
dir-name(path)Folder part of a path.
path-join(a, b, ...)Joins path parts with one separator.path-join({gv.INBOX}, '*.csv')
format-bytes(bytes)Human size: 1536 gives 1.5 KB.
default(value, fallback)The value, or fallback when it is empty.
json-path(object, path)Reads a nested field by path text: json-path({input}, 'order.lines[0].sku').

Date/Time

FunctionWhat it doesExample
current-dateTime()Now, ISO 8601 (UTC).
current-date()Today as YYYY-MM-DD (server time zone).
current-time()Time now as HH:mm:ss.
format-date(format, date, timezone?)Formats a date. Tokens: YYYY YY MMMM MMM MM DD dddd ddd; text in [brackets] stays.format-date('DD-MM-YY', {input.date})
format-time(format, date, timezone?)Formats a time. Tokens: HH hh mm ss SSS A Z.format-time('hh:mm A', {input.at})
format-dateTime(format, date, timezone?)Formats date and time, e.g. in Asia/Kolkata.format-dateTime('DD MMM YYYY HH:mm', {now}, 'Asia/Kolkata')
parse-date(format, text)Reads a date written in the given format; returns ISO 8601.parse-date('DD/MM/YYYY', '31/12/2026')
add-to-date(date, years, months, days)Adds (or with negatives subtracts) years, months and days.
add-to-dateTime(date, years, months, days, hours, minutes, seconds)Adds to a date-time.
days-between(from, to)Whole days from one date to another.
year-from-date(date)Year number.
month-from-date(date)Month number 1 to 12.
day-from-date(date)Day of month.
from-timestamp(ms)Milliseconds since 1970 to ISO date.

Number

FunctionWhat it doesExample
number(value)Converts to a number (commas and currency signs removed).
round(number, decimals?)Rounds half up.
floor(number)Rounds down.
ceiling(number)Rounds up.
abs(number)Absolute value.
power(base, exponent)Base to the power.
format-number(number, pattern)Formats with a pattern such as '#,##0.00'.format-number(1234.5, '#,##0.00') = '1,234.50'
sum(list, field?)Total of a list, or of a field in each item.
avg(list, field?)Average.
min(a, b, ...) or min(list)Smallest value.
max(a, b, ...) or max(list)Largest value.
random(min, max)Random whole number between min and max.
is-number(value)True when the value is a number.

Logical

FunctionWhat it doesExample
if(condition, then, else)Chooses a value; only the chosen side is evaluated.if({input.qty} > 10, 'bulk', 'retail')
coalesce(a, b, ...)First value that is not empty.coalesce({input.mobile}, {input.phone}, 'n/a')
not(value)True when the value is false or empty.
equals-ignore-case(a, b)Case-insensitive comparison.

Sequence

FunctionWhat it doesExample
exists(value)True when the field is present (even if empty text).
empty(value)True when missing, empty text or an empty list.
last() or last(list)Inside a For-Each or [filter]: number of items; with a list: its last item.
position()Inside a For-Each or [filter]: position of the current item (from 1).{input.rows}[position() <= 10]
count(list)Number of items (0 when missing, 1 for a single value).
item-at(list, position)Item at a position (1-based).
first(list)First item.
distinct(list)Removes duplicates.

List

FunctionWhat it doesExample
pluck(list, field)Takes one field from every item.
sort(list, field?, descending?)Sorts a list.
filter-by(list, field, value)Items whose field equals value.
list(a, b, ...)Makes a list.
group-by(list, field)Groups items by a field: a list of { key, items, count }.group-by({input.orders}, 'customer')
count-by(list, field)How many items have each value: { value: count }.
flatten(list, childField?)Flattens nested lists; with a child field, one item per child carrying its parent as _parent.flatten({input.orders}, 'lines')
slice(list, start, count?)Part of a list; start counts from 1.
concat-lists(list, list, ...)Joins lists into one.
contains-item(list, value)True when the list holds the value.
object('key', value, 'key2', value2, ...)Builds an object from key/value pairs.
merge(object, object, ...)Combines objects; later fields win.

53. Template pipes

Pipes change a value inside {{ }}: {{input.name | upper}}, {{input.total | number:2}}, {{input.note | default:"none"}}. Several pipes run left to right.

PipeWhat it does
upperUpper case
lowerLower case
trimRemove spaces at both ends
numberConvert to a number
intConvert to a whole number
stringConvert to text
boolConvert to true/false
jsonTurn data into JSON text
parseTurn JSON text into data
defaultdefault:"x" when empty
lengthNumber of items or characters
firstFirst item
lastLast item
joinjoin:", "
splitsplit:","
roundround:2
addadd:10
subsub:10
mulmul:1.18
divdiv:100
concatconcat:"-":input.id
replacereplace:"a":"b"
substrsubstr:0:5
padpad:6:"0"
base64Encode as Base64
unbase64Decode Base64
urlencodeEncode for a URL
urldecodeDecode a URL part
xmlescapeEscape for XML
datedate:"iso" | "date" | "time" | "epoch"
keysField names of an object
valuesField values of an object
getget:"a.b"
mapmap:"name" picks a field from every item
sumsum or sum:"amount"
listMake sure the value is a list