> ## Documentation Index
> Fetch the complete documentation index at: https://docs.volubile.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Pre-Call Workflow

> Pre-call workflows allow you to execute automated actions right before a call is established.

<Tip>
  This feature is not enabled by default. Please contact <a href="https://support.volubile.ai" target="_blank">support</a> to activate it on your account.
</Tip>

Workflows are particularly useful for enriching the call context with external data, dynamically modifying agent configuration, personalizing the customer experience, and preparing your voice agent with relevant information:

* Retrieve customer history before a call
* Personalize the welcome message based on available data
* Dynamically adapt the agent configuration based on the caller's profile

<Info>
  The pre-call workflow consists of two mandatory main steps:

  1. **Pre-call Trigger** - Initializes the workflow and configures the test data
  2. **Respond to the agent** - Prepares and structures the information that will be available during the call
</Info>

## Configuring the Pre-call Trigger

The pre-call trigger is the starting point of your workflow. It allows you to test and validate the data that will be used by the voice agent.

<Steps>
  <Step title="Create a Sample Data">
    To effectively test your workflow, you need to generate a representative sample of data:

    1. In the configuration interface, locate the section **Generate Sample Data**
    2. Click the **Load Sample Data** button
  </Step>

  <Step title="Configure the Test Data">
    Once the sample is loaded, you can customize the data according to your needs:

    1. Copy and paste the data into the **Test input data** field
    2. Modify the values according to your specific requirements
    3. Click **Test** to validate the configuration
  </Step>
</Steps>

<Warning>
  Ensure that the JSON format is valid before testing your configuration. An incorrect format will lead to
  errors during the execution of the workflow.
</Warning>

## Configuring the Respond to the agent

The **Respond to the agent** is the final step that prepares the information that will be available to the agent during the call.

<Note>
  If you want to return a context and/or configuration for the triggered call, make sure that the last step in the flow is a **Respond to the agent**.
</Note>

<Info>
  The **Respond to the agent** allows you to:

  * Structure relevant information for the agent
  * Ensure continuity between pre-processing and the call
  * Personalize the customer experience based on available data
  * Dynamically adapt the agent configuration based on the caller's profile or the context of the call
</Info>

In the **Respond to the agent** step interface, you can define the structure of the response in JSON format using the data selector to access the variables from previous steps.

<Card title="Set Up Pre-Call Actions" icon="bolt" href="../../product/agents/actions#actions-before-the-call" horizontal />

## Return structure

In the **Respond to the agent** step interface, you can define the response structure in JSON format:

### Option 1: Context only

If you are only modifying the context, return your data directly:

```json theme={null}
{
  "customerHistory": "...",
  "preferences": "...",
  "additionalInfo": "..."
}
```

### Option 2: Context and configuration

If you also want to modify the agent configuration, use this structure:

```json theme={null}
{
  "context": {
    "customerHistory": "...",
    "preferences": "...",
    "additionalInfo": "..."
  },
  "agentConfiguration": {
    "initialMessage": "Hello, how can I assist you today?"
    ...
  }
}
```

<Info>
  To discover all the parameters available in `agentConfiguration` and understand how to use them, see the [complete documentation on dynamic configuration](/en/product/agents/dynamic-configuration).
</Info>

<Warning>
  When using the `agentConfiguration` key, the context must be placed in the `context` key. Anything not in `agentConfiguration` or `context` will be ignored.
</Warning>

### Option 3: Explicitly triggering failover

If you detect a condition that prevents the proper execution of the call (missing critical data, external system unavailable, business rule not met), you can explicitly trigger failover:

```json theme={null}
{
  "failover": true
}
```

<Note>
  When `failover: true` is returned, the failover action configured on the agent will be executed immediately. The rest of the pre-call workflow response will be ignored.
</Note>

<Card title="Configure the failover action" icon="bolt" href="../../product/agents/actions/failover" horizontal>
  Learn how to configure the action that will be executed when failover is triggered
</Card>
