Conditional actions

By default, playbooks use LLMs to control the conversation, take actions, and respond to end-users. If you need more explicit control over the agent's behavior, you can use flows or conditional actions, which are described in this guide.

Conditional actions are an optional configuration for playbooks. You can set conversation triggers and conditions that invoke specific actions like responding with a specific message, calling an external tool, invoking another playbook, or performing any other specified action.

Triggers

You can define triggers that are the first step in determining whether a conditional action is applicable. The following describes trigger types and the specific triggers for each type:

  • Lifecycle stage
    • Playbook start: Triggered the first time a playbook is started.
    • Before the LLM decides its next action: Triggered every time before the LLM predicts the next action.
    • Before the LLM executes its next action: Triggered every time before the LLM executes an action.
  • Event
    • Custom event
    • No input from user

Conditions

Once a trigger occurs, the second step is to evaluate any optionally supplied conditions. Conditions are supplied using the same condition syntax used by flow routes.

If no conditions are supplied, the trigger alone will be used to initiate actions.

You can use the following syntax to reference parameters and last/next actions:

  • Session parameters
    • $session.params.PARAMETER_NAME
  • Playbook input parameters
    • $playbook.input.INPUT_FIELD_NAME
  • Last action (previously executed action)
    • $last-action.name
    • $last-action.input.INPUT_FIELD_NAME
    • $last-action.output.OUTPUT_FIELD_NAME
    • $last-action.status
  • Next action (LLM predicted next action)
    • $next-action.name
    • $next-action.input.INPUT_FIELD_NAME

You can also use system functions.

Examples:

  • $session.params.current_user = null
  • $last-action.name = "query_order"
  • $last-action.name = "query_order" AND $last-action.status != SUCCESS
  • $last-action.name = "query_order" AND $last-action.output.orders = null

Actions

Once a trigger and optional condition evaluation have occurred, you can configure the following actions to take place:

  • Provide a response to the end-user: text, conditional response, customer payload
  • Override the next LLM action: tool use, playbook invocation, playbook completion, flow invocation, playbook transition, flow transition
  • Change speech settings: model name, no speech timeout, endpointer sensitivity, adaptation
  • Enable barge-in
  • Allow cancellation of partial response playback
  • Send Call Companion SMS
  • Enable DTMF