VoiceBooker

Stacks & Call Flows

AI assistants in VoiceBooker usually consist of multiple stages. Stages can be active, meaning the prompts, actions/tools, and functions are part of the LLM request, so the LLM can call your functions based on their purpose and execute actions/functions.

The stack is a simple string array/list that contains all names of the currently active stages. Prompts, tools, and functions are added to the LLM request in the order of the stages in the stack. That means the stage listed last in the stack is the most recent one—its prompt is added last and primarily defines the behavior of the conversation/LLM.

Stack Modifications - Stage Transitions

To define a call flow, each function can optionally receive the stack state as part of the params parameter. This parameter is a string array and can be modified by adding or removing entries and returning the modified stack. This allows developers to build complex voice agent/bot flows. For instance, an existing customer who wants to cancel a contract will be asked/queried a different set of questions/information than a customer who wants to book a certain product.

No Code Stage Transitions

Stage transitions happen during an action, i.e., a function call. A stage transition can therefore be configured directly in the actions/tools section of a function definition/configuration: First, you define the next stage that should be added to the stack, i.e., should be the next active stage.

Second, you can specify Drop current stage to remove the current stage from the stack. This means its actions/tools/functions are no longer available.

Code Stage Transitions

To perform stage transitions programmatically, you first need to enable the stack flag for the function so the stack is passed into the function call via params.

The following example shows how to add the stage "Next Stage" to the stack, and returning it upon leaving the function:

function someFunction(params) {
    params["stack"].push("Next Stage");
    return { stack: params["stack"] };
}

Important: If the stack is not returned via return, changes to the stack will not take effect.

On this page