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 {
      extract { css ".welcome" } as greeting
    } 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. 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 {
  let tomorrow = infer "tomorrow in YYYY-MM-DD" with $metadata.timestamp
  fill { css "#date-field" } tomorrow
}

Allowed with context

Both decide and infer accept these context values in the with clause:

ContextDescription
$pageCurrent page snapshot
fragment { selector }DOM fragment around a selector
$metadataExecution metadata
$store or $store.keyExtracted values so far
$params or $params.keyExecution parameters
$settings or $settings.keyAgent settings

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

ApproachBest for
Explicit if / wait / extractStable UIs, repeatable flows, production reliability
decideAmbiguous page states, visual judgment, branching on layout
inferDate formatting, text transformation, derived field values
AI assistantInitial 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.