Configure custom events for AI agent
Custom events enable administrators to perform the following tasks:
-
Pass data from the client to create dynamic responses. For example, passing customer name for a personalized greeting.
-
Define a custom exit out from the AI agent to return control to the flow designer. For example, to execute fulfillment within the flow.
-
Set the AI agent to begin from a custom starting point rather than the welcome prompt by using a custom event.
-
Update AI agent state variables. For example, prepopulating the context or slots using custom data passed from the flow designer.
Currently, custom events are supported for scripted AI agents via the voice channel only.
Configure incoming custom event in AI Agent Studio
- Create a new response template in the Responses tab of the AI agent Configuration page.
- Under Default response, add the Voice channel in the Default (Web) section.
- In the Incoming event name field, define the event name that the agent receives.

Invoke custom event from Flow Designer
- In the Webex Contact Center Flow Designer, configure the Virtual Agent V2 activity in the flow.
- In the State Event settings, specify the following details in the Event Name
- Event Data columns:
-
Enter the custom event name that you've configured in the Response tab of the AI Agent configuration page in AI Agent Studio.
- Enter the custom data that you wish to pass from the Flow Designer to the scripted AI agent.
-

Access custom event data in AI Agent Studio
You can access the event data (configured in the Flow Designer) in the
Default response section where you configured your incoming event. In the following
figure, you can see that the custom event name "custom_welcome
" and event
data "store name
" are passed from the Flow Designer to AI Agent
Studio.

Configure custom exit event & payload in AI Agent Studio
-
In the AI Agent Studio, navigate to the scripted AI agent configuration page and go to Response where you want the control to be passed back to the flow designer.
-
Add Custom Event to the Default response section.
-
Enter the event name and event payload data in the JSON that you want to be returned to the flow.

In this example, the slots collected are
returned to the flow with the custom exit event
“order_details”
.
Access custom event data in Flow Designer
You can access the custom event and payload from the Output Variables section of Virtual Agent V2 activity.
The Event name
is returned under the StateEventName
variable and the Event payload
is returned as Metadata
as
shown in the following figure:
Update system values in AI Agent Studio
You can update system values such as context, intent, and slot using a special event
“state_update”
and Event payload
with the values, as
shown in the following example:
{
"intent": "order_status",
"slots": {
"first_name": "John"
}
}