Skip to content

Decisions and confidence

All decisions in a workflow run in one provider call. Each result keeps both the normalized answer and the raw answer.

Primitive Definition Value
one_of Two or more named options with descriptions Chosen option name
whether A yes/no question true when P(true) ≥ 0.5
scale Two or more ordered levels Expected position, zero-based, can be fractional
decisions:
urgent:
decide: whether
question: Does this ticket need immediate attention?
severity:
decide: scale
question: How severe is the customer impact?
levels:
- negligible
- minor
- significant
- critical

With four levels, severity.value is anywhere from 0 to 3, such as 1.7.

Rules can read value, probability, confidence and accepted where available.

  • whether.probability is always P(true), even when the value is false.
  • scale has no probability.
  • Laya’s whether has no confidence; use probability.

Reading a field the backend didn’t supply raises an error.

decisions:
department:
decide: one_of
question: Which team should handle this ticket?
options:
billing: Payments and invoices
support: Product problems
confidence:
minimum: 0.75
flow:
- when: department.accepted == false
do: return
value:
route: human_review
- else:
do: return
value:
route: "{{ department.value }}"

accepted is true when confidence ≥ minimum. Missing confidence fails the policy. Without a policy, accepted is always true.

A policy doesn’t retry or reroute; your rules decide what happens. Pick thresholds from representative data.

Keep inputs and option lists short. Laya’s English checkpoint has a 512-token window, including question headers. See the Laya project.