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](https://docs.cloud.google.com/dialogflow/cx/docs/concept/flow) 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, such as
responding with a specific message, calling an external tool, invoking another
playbook, or performing any other specified action.

## Triggers

You can define triggers as the first step to determine whether a conditional
action is applicable.

The following list details trigger types and the specific triggers for each type:

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

## Conditions

Evaluate any optional conditions after a trigger occurs. Conditions use the
same [condition syntax](https://docs.cloud.google.com/dialogflow/cx/docs/reference/condition) used by flow
routes.

If you don't supply conditions, the trigger alone initiates actions.

You can use the following syntax to reference parameters and last and 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](https://docs.cloud.google.com/dialogflow/cx/docs/reference/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

After a trigger and optional condition evaluation occur, you can configure the
following actions:

- **Provide a response to the end-user:** Text, conditional response, custom payload, and [prerecorded audio](https://docs.cloud.google.com/dialogflow/cx/docs/concept/playbook/conditional-actions#prerecorded-audio). When supplying text, you can insert `[pause]`, `[pauseShort]`, or `[pause long]` to inject pauses in agent speech, for example, `How can I help you today? [pause long] I can help with...`
- **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:** See [DTMF for telephony integrations](https://docs.cloud.google.com/dialogflow/cx/docs/concept/dtmf).