Workflows: the logic behind every page and route
When a visitor opens a page on a Tessryx site, a workflow decides what they get. It's a list of steps. A step might look up a record or call a service, and the last one puts the page together.
Your AI writes them, and they're meant to be read afterward. Steps never loop back or jump ahead, so you read them in the order they run. When something looks off, open the workflow in Workflow Studio and follow it down.
Try it
A workflow, run step by step
- loaddatavariablesget
'league/standings'$standings$data_result - rankvariables$table
$standings.teams^(>points)
$leader$table[0].name
- final transform
'<h1>' & $standings.league & '</h1>' & '<p>Week ' & $standings.week & ': ' & $leader & ' lead.</p>' & '<ol>' & $join($table.('<li>' & name & ' <b>' & points & '</b></li>')) & '</ol>'
Edit any step, or press Run to watch it go.
The output shows up here.
How it works
- 01
Steps switch on the blocks they need
A step uses at most one of each block, from a condition check to a model call. Most steps use one or two.
- 02
Later steps read what earlier ones saved
A block's result lasts until the end of its step. Anything needed further down is saved under a name, which also shows where each value came from.
- 03
One expression produces the output
After the last step, a final expression returns the page's HTML or the route's JSON.
- 04
Pages and schedules can share it
The workflow behind a page can also run on a schedule, or when your AI starts it.
Under the hood
The technical details
- steps
- An ordered list. Each step runs once, in order; there are no jumps, so the flow can always be read top to bottom.
- blocks
- A step enables up to one of each block, and they always fire in this order: assert, conditional, loop, api_call, sub_workflow, data, llm, asset, variables.
- variables
- The only results a later step can see. Everything else a block returns lasts until the end of its own step.
- final_transform
- The expression whose value is the run's output: a page's HTML or a route's JSON.
{
"steps": [
{
"name": "load",
"blocks": ["data", "variables"],
"data": {
"operation": "get",
"datafile": { "language": "jsonata", "source": "'league/standings'" }
},
"variables": [
{ "name": "standings", "value": { "language": "jsonata", "source": "$data_result" } }
]
}
],
"final_transform": {
"language": "jsonata",
"source": "$standings.teams^(>points).name"
}
}Related features
JSONata and JavaScript expressions
Wherever a value has to be worked out, like a total or a filter, there's a small expression. Most are JSONata, a language for reshaping data, and the rest are JavaScript.
Read and write records
A workflow can look up a record, save a new one, list a folder or count what's in it. A sign-up form, for example, posts to a route whose workflow saves the record.
Pages and API routes
Anything your AI builds can go live at a web address. Some addresses are pages people open; others are routes that a page's own scripts call to load or save things.
Loops and parallel steps
A step can repeat for each item in a list, or for as long as a condition holds. Steps that don't depend on each other can run at the same time.