Actions are the functions of a SLang backend. They accept typed parameters, run backend logic, read and modify data, call modules, and return typed values.Documentation Index
Fetch the complete documentation index at: https://docs.withsutro.com/llms.txt
Use this file to discover all available pages before exploring further.
Action Shape
An action has a name, typed parameters, a return type, optional metadata, and either abody or an external implementation.
Reading Data
Usesingle when the action needs one record. In HTTP contexts, a missing record is surfaced as a not-found response.
pageOf when the action returns a collection. A page exposes items, total, and offset. Iterate over page.items, not over the page object itself.
where filters support a limited comparison shape. The left side must be a model field or @id. The right side must be an in-scope value, such as an action parameter or local variable, or an internal value such as @subject. Literal values are not accepted directly on the right side; assign the literal first and compare against that variable.
Writing Data
Usecreate Entity { ... } to insert a record. Use update record { ... } to patch fields on an existing record. Use delete record to remove one.
When you update a variable holding an entity instance, the variable is rebound to the updated instance, so returning the same variable returns the latest fields.
Control Flow
SLang supports:if/elsefor item in arraywhilebreakandcontinue- boolean logic with
and,or, andnot - arithmetic and comparisons for compatible primitive values
assert(description := "...", rule := condition) when an action should fail unless an invariant is true.