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)
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 |
fragment { selector } | DOM fragment around a selector |
$store or $store.key | Values stored so far |
$params or $params.key | Execution parameters |
$settings or $settings.key | Agent settings |
$context or $context.key | Read-only execution metadata (e.g. $context.startTime) |
Combine multiple values in one clause: with ($page, $store), with (fragment { css ".panel" }, $params).
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 | Stable UIs, repeatable flows, production reliability |
decide | Ambiguous page states, visual judgment, branching on layout |
infer | Date formatting, text transformation, derived field values |
| 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.