flow.random

Randomly select and execute a component from the list of component
references set in the random field.

This component uses the standard Python random.choice function that
uses a uniform random distribution to select a choice.

- random:
  - say: Option 1
  - say: Option 2
  - say: Option 3
  - flow: flow.some_flow
    transfer: true
  - say: Option 4

Each item in the random field must contain a valid action field,
meaning the field takes an action spec which maps to the ActionComponentSpec
Python class. This allows you to execute any component.

Element details

type: meya.flow.component.random
class: RandomComponent
path: /meya/flow/component/random.py
signature: random

Fields

fielddescription               requiredsignaturedefaulttype
specOverride the original spec for this element.nullSpec
contextSend context data with this component's event.{}
dict
sensitiveMark this component's event as sensitive. This will encrypt the event if the Sensitive Data integration has been enabled.falsebool
triggersActivate these dynamic triggers when the component runs. Check the component triggers guide for more info.[]list
randomA list of component references to randomly select from.list

Usage reference

Basic

triggers:
  - keyword: meya.flow.component.random
steps:
  - random:
      - COMPONENT

Full

triggers:
  - keyword: meya.flow.component.random
steps:
  - spec:
      type: STRING
      data:
        STRING: ANY
      timeout: 123
      trigger_when: ANY
    context:
      STRING: ANY
    sensitive: false
    triggers:
      - type: STRING
        data:
          STRING: ANY
        timeout: 123
        trigger_when: ANY
    random:
      - COMPONENT