
Understanding Automations
- What are Automations?
- Automation Architecture
In simple words, automations describe what to do and when:
- What to do: A sequence of instructions that process data and perform actions
- When to do it: Triggers that activate the automation when specific conditions are met
- The what would be a fetch instruction calling Slack API to send a message
- The when would be a URL (webhook) trigger that Hubspot calls whenever a new deal is opened
Automation YAML Syntax
Every automation is a YAML file. The visual editor reads and writes that same file, so understanding the syntax is what unlocks the rest of the platform.File anatomy
A minimal automation:Indentation and structure rules
YAML structure is significant. Three rules cover 95 % of the mistakes the editor will surface.- Indentation is spaces, not tabs. Two spaces per level is the convention used everywhere in this documentation. Mixing tabs and spaces fails parsing.
- A list item starts with
-at the parent’s indentation level. The contents of the item are indented one more level. - A key always ends with
:and a single space before its value (except when the value is on the next line).
:, #, {, [, &, *, !, |, >, ', ", %, @, `` `), wrap it in single or double quotes.
Naming and casing conventions
The platform does not enforce most of these, but the visual editor, the Activity view, and the SDK all assume them; sticking to the conventions keeps tooling consistent.
Interpreted keywords
Insidedo: and other instruction lists, these keys are interpreted by the runtime. Any other key is treated as an app or workspace automation call (see Visual Editor and YAML Mapping).
Expressions: {{ … }} and {% … %}
Anywhere a value is expected, you can interpolate an expression.
{{ … }}evaluates and substitutes a single expression. The whole value is replaced by the result.{% … %}evaluates an arithmetic or logical sub-expression while keeping the rest of the string.
Variable scopes
Variables live in different scopes with different lifetimes. Each scope is exposed as a top-level object in expressions.
See Memory Architecture for the full picture, including persistence guarantees.
What the YAML editor reports
The Builder’s Monaco editor validates the YAML as you type, using the same schema the runtime applies on save.- Indentation / parsing errors are flagged on the offending line. Fix them before save; the editor blocks the save button.
- Schema errors (unknown keyword, wrong type for a field) are surfaced with the path of the offending field.
- Lint warnings (e.g. an unused variable, a duplicate slug) appear inline but do not block saving.
Triggers
Automations can be activated through different types of triggers, configured at the top of the automation graph:URL (Webhook/API Endpoint)
URL (Webhook/API Endpoint)
When an automation activates its URL trigger, it becomes publicly available through a URL which you can copy from your Workspace graph or source code. You can then use this URL in external services that support webhooks.From inside the automation, 5 variables give access to input HTTP requests:
Example :By default, these HTTP requests will receive the automation output as a response body. However, an $http variable available inside the automation gives full control over the response:You can also use this variable to implement Server-Sent Events (SSE) for streaming responses:For long-running SSE endpoints, you can configure a keep-alive to avoid timeouts:After this instruction, a When a request is made to Request to Multi-segment Parameters (wildcards):Use Request to
- body: Request body
- headers: Request headers
- method: HTTP method (GET, POST, etc.)
- query: URL query parameters
- pathParams: Extracted path parameter values (when using path parameters like
:id)
body.<fileKey> object variable.Example :
- $http is only available in the URL-triggered automation (not in children calls)
- Headers cannot be set after the first chunk is sent
- When using SSE events, the automation output will also be sent as the last event
- SSE automatically sets appropriate headers (Content-Type, Cache-Control, Connection)
data: {"keepAlive": true} chunk will be regularly emitted until the connection ends.Path Parameters
Webhook endpoints support path parameters for building RESTful APIs. Path parameters allow you to define dynamic URL segments that extract values from incoming requests.Basic Usage:get-user
/webhooks/{workspaceSlug}/v1/users/123, the automation receives:pathParams.id="123"
get-user-post
/webhooks/{workspaceSlug}/v1/users/alice/posts/456 results in:pathParams.userId="alice"pathParams.postId="456"
update-user
*paramName instead of :paramName when the value can contain slashes; for instance, model identifiers like openai/text-embedding-3-large or hierarchical paths.get-model
/webhooks/{workspaceSlug}/v1/models/openai/text-embedding-3-large yields:pathParams.model_id="openai/text-embedding-3-large"
/webhooks/{workspaceSlug}/v1/models/gpt-4o (no slash) matches the same endpoint with pathParams.model_id = "gpt-4o".Path Parameter Behavior:
- Single-segment parameters use
:paramNamesyntax (e.g.,:id,:userId); they match one URL segment and reject values containing/ - Multi-segment parameters use
*paramNamesyntax; they match one or more segments and let you capture values containing/ - All defined parameters are required - requests missing parameters will not match
- Parameter values are automatically URL-decoded
- Exact match endpoints take priority over pattern endpoints
- When multiple patterns could match, the first defined pattern wins
- Patterns like
message:stream(colon without preceding slash) are treated as exact matches, not patterns
Events
Events
An automation can listen to a list of events. Whenever such events are received, the automation is executed and can access:
- payload: Event payload data
- source: Event source information (source IP, correlationId, userId, automation, etc.)
- Native events: Generated automatically by the platform
- Custom events: Emitted from automations in the same workspace
- App events: Emitted from installed Apps
Workspaces can only listen to a specific subset of native events. See the Supported Native Events section for details.
Schedules
Schedules
An automation can be regularly triggered based on cron expressions:A helpful tool for creating cron expressions is crontab.guru.
- Automations can be scheduled at most every 15 minutes
- Schedules use UTC timezone
- When scheduled, the automation runs “on the hour” (e.g., a 20-minute schedule starting at 3:14 will run at 3:20, 3:40, etc.)
- When successfully scheduled, a
runtime.automations.scheduledevent is emitted
Memory Architecture
Automations can use and modify data across different memory scopes:Run Scope
Run Scope
Available only during current execution
{{run.variable}}
Run variables include execution context like:run.date: Current timestamprun.ip: Client IP addressrun.automationSlug: Current automation identifierrun.correlationId: Unique ID for tracing related eventsrun.depth: Current automation depth in the stacktracerun.trigger.type: Trigger type (event, endpoint, automation)run.trigger.value: Trigger value (event name, endpoint path, etc.)run.socketId: Current socket ID if connected by websocketrun.appSlug: Current app slug if running from an appInstancerun.appInstanceSlug: Current appInstance slug if applicablerun.parentAppSlug: Parent app slug if parent is also an appInstance
User Scope
User Scope
Persistent for the authenticated user
{{user.variable}}User variables include:user.id: Unique user identifieruser.email: User’s email addressuser.authData: Authentication informationuser.role: User’s role in the workspace- Custom user-specific data that persists across sessions
Session Scope
Session Scope
Available for the current user session
{{session.variable}}Session variables include:session.id: Current session ID- Custom session data
- Form inputs across multiple steps
- Wizard progress state
- Temporary preferences
Global Scope
Global Scope
Shared across all users and executions
{{global.variable}}Global variables include:global.workspaceId: Current workspace IDglobal.workspaceName: Current workspace nameglobal.apiUrl: Current API instance public URLglobal.studioUrl: Current studio instance public URLglobal.pagesUrl: Current workspace pages public URLglobal.pagesHost: Current pages instance base domainglobal.endpoints: Map of available endpoint slugs to URLsglobal.workspacesRegistry: Map of public workspaces- Custom workspace-wide variables
Socket Scope
Socket Scope
Available for the current websocket connection
{{socket.variable}}Socket scope provides a temporary state local to a websocket connection, useful for separating state between multiple browser tabs. This context automatically expires after 6 hours without any updates.Config Scope
Config Scope
Workspace and app configuration
{{config.variable}}Contains the workspace configuration defined in the workspace settings.$workspace Scope
$workspace Scope
Read-only workspace information
{{$workspace.variable}}This read-only context holds the current workspace definition, allowing access to any of its sections (e.g., installed apps config via $workspace.imports.myApp.config).Except for $workspace, all these contexts can be written to using the
set instruction. Written data will be persisted and available in subsequent requests. However, when setting variables inside session/user contexts from an unauthenticated webhook, they will not be persisted.Working with Variables
Inside your automation instructions, dynamic data can be injected by surrounding a variable name with double braces:{{some.variable.name}}.
Variables can be created and modified using the set instruction and removed using the delete instruction.
For objects or arrays, you can access specific properties:
session.myObjectVariable equals {"mickey": "house"} and item.field equals mickey, the entire expression resolves to house.
Visual Editor and YAML Mapping
Every automation has two equivalent representations:- YAML: the source of truth, stored in the workspace and synchronized with Git.
- Visual graph: a node-based editor that reads and writes the same YAML.
Trigger nodes (Start)
The single Start node represents the automation’swhen block. Its visual sub-labels reflect which trigger fields are populated.
Multiple triggers can coexist on the same Start node; e.g. an automation can be both a webhook and a scheduled job.
Instruction nodes
Each instruction node serializes to a single DSUL key. The table below lists every node available in the editor’s “Add instruction” panel and the YAML it produces.App and workspace automation calls
Beyond the built-in nodes above, the editor also lets you drop any imported app action or any other automation in the same workspace.- An imported app action is rendered as
<App name> → <action>and serializes to the action’s slug, e.g.mySlackInstance.sendMessage. - A workspace automation call uses its slug directly.
Visual-only nodes
A few nodes appear in the graph but have no DSUL counterpart; they exist purely to organize the canvas:- Branch: one per key inside a
conditionsblock; renders the condition expression. - Merge: converges all branches of a
conditionsorallblock.
conditions / all.
Instructions
Once triggered, automations execute a sequence of instructions in order. Here are the available instructions:Logic Instructions
Condition
Condition
Conditionally execute instructions based on variable values or expressions.More details on condition syntax
Repeat
Repeat
Loop through items or execute instructions multiple times.You can also process batches in parallel:
Break
Break
Stop execution of the current automation or loop.When
break is meant to be handled from a parent automation’s try/catch, scope must be set to all.If using the instruction like this : - break: {}, it will default to scope: automation.All
All
Execute multiple operations in parallel.
Try/Catch
Try/Catch
Handle errors gracefully.The
$error variable is accessible both inside and outside the catch block.Data Instructions
Set Instruction
Set Instruction
Create or update variables in different scopes.Like everywhere else, you can also use expressions in the value parameter:
- Basics
- Objects
- Array
Delete Instruction
Delete Instruction
Remove variables when no longer needed.
Integration Instructions
Fetch Instruction
Fetch Instruction
Make HTTP requests to external APIs.
- Basics
- Output options
- multipart/form-data
- application/x-www-form-urlencoded
- HTTP SSE (Server Side Events)
- AWS SigV4
Emit Instruction
Emit Instruction
Trigger events for UI updates or other automations.
- Basics
- Target
- Options
Wait Instruction
Wait Instruction
Pause execution until a specific event is received.Filter values can be scalars (equality match) or MongoDB-style operator objects:
$eq, $ne, $in, $nin, $gt, $gte, $lt, $lte, $regex, $exists.
Keys use dot notation on the event object (e.g. payload.foo.bar). Multiple
filters are joined with AND.Rate Limit Instruction
Rate Limit Instruction
Control resource usage with rate limiting.
Other Instructions
Auth Instruction
Auth Instruction
Generate authentication tokens for internal API calls.
This token cannot be used outside of automations, and is specifically intented for When fetching a Prismeai automation endpoint with such workspace token, a
You can also forward source workspace authentication to a subsequent fetch :
fetch consumption (as an Authorization header).{{run.authenticatedWorkspaceId}} variable (which cannot be manually set) will be made available to securely check calling workspace.You can also forward source workspace authentication to a subsequent fetch :
User Topic Instructions
User Topic Instructions
Manage user subscription topics.User topics allow sending events to multiple users without knowing who they are in advance, automatically granting them read access to these events without requiring any API Key.User topics allow sending events to multiple users without knowing who they are in advance.
Run instruction
Run is a generic instruction allowing you to call runtime modules.These are lightweight NodeJS packages offering various methods for use cases needing raw Javascript for better performances than standard automations. Example :
- module : Module name
- function : Function name
- parameters : Function parameters object
- onError : Exception handling behaviour
breakwill break current automation with given exception (default)emitwill emit an error event but continue current automationcontinuewill only return the error and continue current automation
Embed JavaScript or Python with the Custom Code app
Need to run arbitrary code inline (parsing, hashing, reshaping)? Install the Custom Code app and use
Custom Code.run to invoke a function you defined in YAML.Collections
Store, query, and manage structured data with MongoDB-style queries. This module is generally meant to be used through the Collection application.Collections Module Reference
Functions:
create, findMany, updateOne, deleteOne, aggregate, and moreSecrets
Securely store and retrieve sensitive values (API keys, tokens, credentials) at runtime, with automatic redaction from logs.Secrets Module Reference
Functions:
set, get, delete; scopes: workspace, userAccess Manager
Manage organization service account tokens at runtime with in-memory secret caching and event-driven invalidation.Access Manager Module Reference
Functions:
getServiceAccountToken, createServiceAccount, rotateServiceAccountSecret, deleteServiceAccountText
Pure-JS text processing utilities for splitting text into chunks with configurable separators and overlap.Text Module Reference
Functions:
splitTextInstruction Reference
Quick lookup tables for every built-in instruction. For each one: the full parameter list (with type, default, and notes), the value left inoutput (when applicable), the errors it raises, and the related instructions you typically chain it with.
set
Assigns a value to a variable in any scope.
Output: none. Raises: none. Often chained with:
delete, conditions, emit.
delete
Removes a variable.
Output: none. Raises: none.
emit
Publishes an event on the workspace event bus.
Output: none. Raises: none. Often chained with:
wait, runWorkflow.
fetch
Calls an HTTP endpoint.
Output: the response body, or
{ body, headers, status } if outputMode: detailed_response. Raises: network errors, timeout, non-2xx HTTP (unless emitErrors). Often chained with: set, conditions, repeat (for streams).
wait
Blocks the automation until a matching event arrives or a timeout elapses.
Output: the event, or
null if the timeout elapsed. Raises: none. Often chained with: emit (initiate the request, then wait for the reply).
conditions
Branches on expressions.
Structure:
default runs (if present). See Condition and Expression syntax for operators and helpers.
Output: none. Raises: expression evaluation errors. Often chained with: set, emit, break.
repeat
Iterates over a collection or repeats a fixed number of times.
Inside
do, {{item}} is the current element and {{$index}} the 0-based index. Output: none. Raises: none. Often chained with: break, all.
break
Exits a loop or the whole automation.
all
Runs branches in parallel.
all returns once every branch has completed. Errors in one branch do not cancel the others; wrap with try/catch if you need fail-fast.
try / catch
Catches errors raised by inner instructions.
If
catch is omitted, the error is silently swallowed.
run
Calls a built-in runtime module.
Output: the function’s return value (varies). Raises: module-specific errors (
not_found, user_required, …). See each module’s reference page.
runWorkflow
Calls another automation in the same workspace.
Output: the target automation’s
output. Raises: propagates errors from the target (unless wait: false).
rateLimit
Enforces a sliding-window rate limit.
Output: the limit state. Does not raise; branch on
output.ok to decide what to do.
auth
Issues a short-lived JWT for internal calls.
The token is only valid for
fetch calls back to the platform; it cannot authenticate against external systems.
createUserTopic / joinUserTopic
Manage real-time delivery topics.
Once a user is subscribed,
emit … target: { userTopic: '<topic>' } delivers events to all members in real time.
comment
Free-form annotation. No runtime effect. Renders as a yellow sticky note in the visual editor.
Errors raised by all instructions
Any instruction can raise the following platform errors regardless of its own logic:
Wrap calls in
try/catch to recover from these.
Condition and Expression syntax
Conditions allow you to execute different instructions based on contextual information. You can use a powerful expression syntax in conditions and anywhere with{% ... %} delimiters.
Basic Operators
Logical Operators
Regular Expressions
MongoDB-like Conditional Matches
Deep merge objects
This functiun helps deep merge two objects.Date Functions
Parsing and Access
Formatting
Math Functions
Operators
Functions
String Functions
URL parsing
Parse URL search params :Input & output schemas
An automation declares the inputs it expects — and, optionally, the shape of its output — through theschemas field. schemas is a list of conditional branches, each carrying up to three keys:
payload and output are described with the same typed-field format used across Prisme.ai (type, properties, items, required, format, title, description, plus the secret / redact markers below). Supported type values are string, number, integer, boolean, object, array, and the localized:* variants.
Declaring inputs
The simplest case is a single branch describing the payload. These fields also power the graphical inputs shown when the automation is called from another automation or from the execute modal.someToken field defined with secret: true is automatically redacted from native runtime events to avoid accidental leaks of sensitive information (see Protecting sensitive fields).
Conditional branches
When an automation is exposed as an HTTP endpoint (or handles more than one call shape), you can declare a branch per case and let the runtime route to the matching one:- First match wins. Branches are evaluated top to bottom; the first one whose conditions all match becomes active.
conditionsare dot-paths resolved from the payload root (method,body.kind,query.version…). Each entry must equal the corresponding payload value.methodis matched case-insensitively (POSTmatchespost). Other keys are case-sensitive.- Values are compared as strings after scalar coercion —
version: 2matches?version=2, since query parameters always arrive as strings. An object, an array, or a null condition value (YAML’s valuelesskey:) never matches. - A branch without
conditionsis the default and always matches — put it last as a catch-all.
Protecting sensitive fields
Two markers can be placed on any field of apayload or output schema:
secretonly protects strings. To hide an object or an array (a whole JSON body, a structured credential…), useredact: trueon that field instead —secret: truewould silently do nothing.redactdoes not follow the value across automations. Unlikesecret, which tracks a string value wherever it flows,redactis purely path-based: it only strips the field from the events of the automation that declares it. You must therefore repeatredact: trueon every automation the object passes through — declaring it once upstream does not protect it downstream.secrettakes precedence overredact: a field marked both is value-tracked and path-redacted.redactonly applies to fields reachable throughproperties. A marker placed insideitems,additionalProperties, or aoneOf-style keyword is ignored; redact the parent field instead.
Validation
SetvalidateArguments: true to have the runtime validate incoming payloads against the active branch’s payload schema:
validateArguments is true and no branch matches the payload, the call is rejected. Declare an unconditioned branch (one with no conditions) to accept internal calls or unlisted HTTP methods. Output schemas are never validation-enforced — they only document the output and drive redact.
Backward compatibility with arguments
Automations historically declared their inputs through a top-level arguments map. That format is still fully supported: on save it is automatically converted into a single, unconditioned schemas branch ({ payload: { type: object, properties: <arguments> } }), and collapsed back to arguments when loaded so the editor keeps rendering it. secret and redact markers ride along unchanged.
schemas when you need what arguments cannot express: conditional branches, an output schema, or redact markers. When both arguments and schemas are present, schemas drives validation, while the secret / redact markers declared on arguments stay enforced on every branch.
Advanced Automation Patterns
- Webhook Handling
- Data Processing Pipeline
- Multi-LLM Orchestration
Implement secure webhook endpoints for third-party integrations:
Supported Native Events
Workspaces can listen to a specific subset of native events:Workspace Events
Workspace Events
event
Emitted when workspace configuration is updatedPayload:
event
Emitted when a workspace is deletedPayload:
event
Emitted after import or repository pullPayload:
event
Emitted when a new workspace version is committedPayload:
event
Emitted when a previous version has been rolled backPayload:
Emitted when some page has been shared with someonePayload:
event
Emitted when someone’s access to the page has been removedPayload:
App Events
App Events
Automation Events
Automation Events
Runtime Events
Runtime Events
Best Practices
Modular Design
Modular Design
Create maintainable automation structures:
- Break complex flows into smaller automationsUse events for communication between modulesCreate reusable patterns for common tasksDocument automation purposes and interfaces
Error Handling
Error Handling
Build robust fault tolerance:
- Use try/catch blocks for risky operationsImplement appropriate retry strategiesProvide informative error messagesCreate fallback paths for critical operations
State Management
State Management
Handle data appropriately across scopes:
- Use appropriate memory scopes for different data needsClean up temporary variables when finishedInitialize variables before using themBe mindful of persistence requirements
Security Best Practices
Security Best Practices
Keep your automations secure:
- Store sensitive data in secretsValidate inputs from external sourcesImplement rate limiting for external APIsUse proper authentication for API calls
Performance Optimization
Performance Optimization
Ensure efficient execution:
- Use parallel processing for independent operationsImplement batching for large data setsCache results when appropriateMonitor execution times and optimize bottlenecks
Testing
Testing
Validate automation functionality:
- Test with representative data samplesVerify error handling pathsTest edge cases and unexpected inputsUse Activity view to review execution history
Next Steps
Pages
Pages
Learn how React pages call endpoints and emit workspace events
Testing & Debugging
Testing & Debugging
Trace automation runs with Activity and correlation IDs
Deployment
Deployment
Learn more about deployment strategies