Skip to content
Open the app

Variables ​

Variables allow data to flow between workflow steps. Extract values from pages, use them in commands, and pass them between workflows.

Basic Usage ​

Extract and Use ​

yaml
steps:
  # Step 1: Extract data into a variable
  - type: browser.extract
    selector: ".product-price"
    as: price

  # Step 2: Use the variable
  - type: shell.run
    cmd: "echo 'Price is: {{price}}'"

Multiple Variables ​

yaml
steps:
  - type: browser.extract
    selector: "h1"
    as: title

  - type: browser.extract
    selector: ".author"
    as: author

  - type: llm.generate
    prompt: "Write a review of '{{title}}' by {{author}}"
    as: review

Variable Sources ​

From browser.extract ​

Single element text:

yaml
- type: browser.extract
  selector: "#username"
  as: user_name

From browser.extractAll ​

Multiple elements joined:

yaml
- type: browser.extractAll
  selector: ".tag"
  as: tags
  separator: ", "  # Default: ", "

Result: "javascript, react, typescript"

From browser.exists ​

Boolean check:

yaml
- type: browser.exists
  selector: ".error-banner"
  as: has_error

Result: "true" or "false" (string)

From shell.run ​

Command output:

yaml
- type: shell.run
  cmd: "git rev-parse HEAD"
  as: commit_hash

From llm.generate ​

AI-generated text:

yaml
- type: llm.generate
  prompt: "Summarize: {{content}}"
  as: summary

From llm.classify ​

Category result:

yaml
- type: llm.classify
  input: "{{message}}"
  categories: [urgent, normal, low]
  as: priority

From Workflow Parameters ​

yaml
params:
  repo_name: string

steps:
  - type: llm.generate
    prompt: "Summarize the open issues of {{repo_name}}"
    as: summary

A param's value comes from the door that starts the run: the Run dialog, the API, the MCP, a rule, a request or a playbook's run. A param that lists options takes only one of them (Parameters).

Interpolation Syntax ​

Basic ​

yaml
text: "Hello, {{name}}!"

In URLs ​

yaml
url: "https://github.com/{{org}}/{{repo}}/issues/{{issue_number}}"

In Commands ​

yaml
cmd: "curl -X POST '{{api_url}}' -d '{\"title\": \"{{title}}\"}'"

In LLM Prompts ​

yaml
prompt: |
  Analyze this code:


Focus on: {{focus_areas}}

Environment Variables ​

Defining Env Contexts ​

In the dashboard Settings, create env contexts:

NameValue
github_base_path/Users/me/GitHub
api_keysk-xxx

Using Env Variables ​

yaml
steps:
  - type: shell.run
    cmd: "cd {{env.github_base_path}}/{{repo}}"

  - type: terminal.open
    cwd: "{{env.github_base_path}}/{{repo}}"

Env in Nested Workflows ​

Env contexts automatically flow to child workflows.

Nested Workflow Variables ​

Without Namespace ​

Variables flow directly to parent:

yaml
- type: workflow.call
  workflow: extract_data

# Child's variables available directly
- type: shell.run
  cmd: "echo '{{title}}'"  # From child

With Namespace ​

Use as to namespace child variables:

yaml
- type: workflow.call
  workflow: extract_data
  as: data

# Access with namespace
- type: shell.run
  cmd: "echo '{{data.title}}'"

Passing Parameters ​

yaml
- type: workflow.call
  workflow: process_page
  params:
    url: "{{target_url}}"
    max_items: 10

Magic Context Keys (Embed) ​

When using embed buttons, these are automatically available:

KeyDescriptionExample
_urlFull page URLhttps://github.com/org/repo
_domainHostnamegithub.com
_pathnameURL path/org/repo
_titlePage titleMy Repo
_pathPath segments["org", "repo"]
_path.0First segmentorg
_path.1Second segmentrepo

Use in param_map:

yaml
embed:
  param_map:
    _path.0: "organization"
    _path.1: "repository"
    _domain: "site"

Conditional Logic ​

Use variables in conditions:

yaml
- type: control.if
  condition: "{{status}} == 'ready'"
  then:
    - type: browser.click
      selector: ".start"
  else_steps:
    - type: control.stop
      message: "Status is {{status}}, not ready"

Operators ​

OperatorExample
==" == 'active'"
!=" != '0'"

String Comparison

All comparisons are string-based. "10" does not equal 10.

Data Transformation ​

First Item ​

Get first from a list:

yaml
- type: browser.extractAll
  selector: ".item"
  as: items

- type: data.first
  input: "{{items}}"
  as: first_item

In Shell ​

Use shell for complex transformations:

yaml
- type: shell.run
  cmd: "echo '{{items}}' | cut -d',' -f1"
  as: first_item

Best Practices ​

1. Use Descriptive Names ​

yaml
# Good
as: product_title
as: user_email
as: total_price

# Bad
as: x
as: data
as: temp

2. Namespace Child Workflows ​

yaml
# Good - clear where variables come from
- type: workflow.call
  workflow: get_user
  as: user

- type: shell.run
  cmd: "echo '{{user.name}}'"

# Risky - might conflict
- type: workflow.call
  workflow: get_user
  # name could overwrite parent variable

3. Handle Missing Variables ​

A placeholder that names no variable or param stays in the text as written:

yaml
# If {{optional}} is not set, this stays "Value: {{optional}}"
cmd: "echo 'Value: {{optional}}'"

A declared param that no one gives a value takes its default. With no default, a run the app dispatches passes '', and a playbook's step receives the placeholder as text; the run page names that input (Inputs). Give every param a person may leave out a default.

Where a param may go ​

The runtime puts a value into the text as it is written: quoting does not make a person's characters safe in a shell. So a param a person can set (from the Run dialog, the API, the MCP, a rule, a request or a playbook's run) goes in one place only, inside a sentence of the agent's prompt, in a heredoc whose closing word is quoted:

yaml
- type: terminal.run
  cmd: |
    claude "$(cat <<'SB_PROMPT'
    read the ticket {{ticket_url}} and implement it.
    Work in {{mode}} mode: in interactive mode ask before a decision that is not yours.
    SB_PROMPT
    )"
WhereA param a person can set
Inside a sentence of the quoted prompt (<<'SB_PROMPT')Yes
Alone on its own line, even inside the promptNo
In a cmd outside the prompt, a cwd, a path or a URLNo

A param only the pack or the engine sets, such as entry_path, is not restricted. A worked example: A pack's own switch.