AI Helpers
Use decide and infer LLM statements in DSL, and the per-agent AI assistant to build workflows.
reArray integrates LLM capabilities directly into task scripts and provides a conversational assistant for building workflows.
decide — branching decisions
Use decide inside an if statement to let the model choose a branch based on page context:
flow {
in portal {
if decide "Is the user logged in?" with ($page) {
store greeting extract { css ".welcome" }
} else {
fill { css "#email" } $secrets.username
fill { css "#password" } $secrets.password
click { css "button[type='submit']" }
wait visible { css ".welcome" } timeout 30000
}
}
}
with is required and must use parentheses. The model evaluates the question against the provided context and picks a branch.
infer — value inference
Use infer to derive a value from context:
flow {
in portal {
$tomorrow = infer "tomorrow in YYYY-MM-DD" with ($context.startTime)
fill { css "#date-field" } $tomorrow
}
}
Assign the result to a local with $name = infer ... or persist it with store key infer ....
Allowed with context
Both decide and infer accept these context values inside the with (...) clause:
| Context | Description |
|---|---|
$page | Current page snapshot — only when a fragment cannot answer the question |
fragment { selector } | DOM fragment around a selector (prefer this over $page) |
$name | A local (prefer with ($block) over dumping $store) |
$store.key | A single stored value (prefer over whole $store) |
$params.key | A single execution parameter (prefer over whole $params) |
$settings.key | A single agent setting |
$context.key | A single metadata field (e.g. $context.startTime) |
Combine multiple values in one clause: with ($block, $params.mode), with (fragment { css ".panel" }, $store.invoiceStatus). Whole bags ($page, $store, $params) are valid but oversized when a fragment, local, or key suffices.
Never include $secrets in with clauses. Vault credentials must not be sent to the LLM.
Agent AI assistant
Each agent has a built-in conversational assistant at Agents → select agent → Chat.
Use the assistant to:
- Describe a workflow in plain language and receive DSL suggestions
- Debug failing scripts with awareness of your platform configuration
- Iterate on selectors and flow logic without writing every line manually
The assistant runs in a dedicated assistant session mode with access to the agent's browser context. It is separate from task executions — chat does not queue or run tasks directly, but helps you author them.
Tips for the assistant
- Reference platform handlers by name so the assistant uses correct
in handler { }blocks - Describe the expected page state at each step
- Ask for session-aware login patterns when automating authenticated flows
When to use AI helpers vs. explicit logic
| Approach | Best for |
|---|---|
Explicit if / wait / extract / extract … format | Stable UIs, structured text, repeatable flows |
decide | Ambiguous page states, visual judgment, branching on layout |
infer | Classification or language tasks that extract … format cannot express |
| AI assistant | Initial script authoring, debugging, exploration |
For production-critical automations, prefer explicit conditions where possible and use decide/infer for cases that are hard to express with selectors.